From a441a9fca97c8f3edeab7a3f5b8f39368b170bdc Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 7 Mar 2017 20:54:30 +0300 Subject: [PATCH] Fix service message highlighting. --- .../SourceFiles/history/history_service_layout.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/history_service_layout.cpp b/Telegram/SourceFiles/history/history_service_layout.cpp index b3ba91678d..47d6572ba9 100644 --- a/Telegram/SourceFiles/history/history_service_layout.cpp +++ b/Telegram/SourceFiles/history/history_service_layout.cpp @@ -193,12 +193,16 @@ void ServiceMessagePainter::paint(Painter &p, const HistoryService *message, con if (animms > st::activeFadeInDuration + st::activeFadeOutDuration) { App::main()->stopAnimActive(); } else { - int skiph = st::msgServiceMargin.top() - st::msgServiceMargin.bottom(); + auto top = st::msgServiceMargin.top(); + auto bottom = st::msgServiceMargin.bottom(); + auto fill = qMin(top, bottom); + auto skiptop = top - fill; + auto fillheight = fill + height + fill; - float64 dt = (animms > st::activeFadeInDuration) ? (1 - (animms - st::activeFadeInDuration) / float64(st::activeFadeOutDuration)) : (animms / float64(st::activeFadeInDuration)); - float64 o = p.opacity(); + auto dt = (animms > st::activeFadeInDuration) ? (1. - (animms - st::activeFadeInDuration) / float64(st::activeFadeOutDuration)) : (animms / float64(st::activeFadeInDuration)); + auto o = p.opacity(); p.setOpacity(o * dt); - p.fillRect(0, skiph, message->history()->width, message->height() - skiph, st::defaultTextPalette.selectOverlay); + p.fillRect(0, skiptop, message->history()->width, fillheight, st::defaultTextPalette.selectOverlay); p.setOpacity(o); } }