2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 22:55:11 +00:00

Fix for message highlight

This commit is contained in:
RadRussianRus
2020-01-19 07:31:54 +03:00
parent 2b70e6d74f
commit ac4bf4dcab

View File

@@ -919,7 +919,7 @@ void Gif::drawGrouped(
const auto roundRadius = ImageRoundRadius::Large; const auto roundRadius = ImageRoundRadius::Large;
auto drawHighlighted = [&](const auto &painter, auto geometry, auto frame, bool isPixmap = false) { auto drawHighlighted = [&](auto painterCallback) {
const auto animms = _parent->delegate()->elementHighlightTime(_parent); const auto animms = _parent->delegate()->elementHighlightTime(_parent);
const auto realId = _realParent->id; const auto realId = _realParent->id;
const auto mainWidget = App::main(); const auto mainWidget = App::main();
@@ -931,12 +931,12 @@ void Gif::drawGrouped(
? ((animms / float64(st::activeFadeInDuration))) ? ((animms / float64(st::activeFadeInDuration)))
: (1. - (animms - st::activeFadeInDuration) : (1. - (animms - st::activeFadeInDuration)
/ float64(st::activeFadeOutDuration)); / float64(st::activeFadeOutDuration));
const auto o = painter.opacity(); const auto o = p.opacity();
painter.setOpacity(o - dt * 0.8); p.setOpacity(o - dt * 0.8);
(isPixmap ? painter.drawPixmap(geometry, frame) : painter.drawImage(geometry, frame) ); painterCallback();
painter.setOpacity(o); p.setOpacity(o);
} else { } else {
(isPixmap ? painter.drawPixmap(geometry, frame) : painter.drawImage(geometry, frame) ); painterCallback();
} }
}; };
@@ -962,20 +962,29 @@ void Gif::drawGrouped(
activeOwnPlaying->frozenRequest = request; activeOwnPlaying->frozenRequest = request;
activeOwnPlaying->frozenFrame = streamed->frame(request); activeOwnPlaying->frozenFrame = streamed->frame(request);
} }
drawHighlighted(p, geometry, activeOwnPlaying->frozenFrame);
drawHighlighted([&]() {
p.drawImage(geometry, activeOwnPlaying->frozenFrame);
});
} else { } else {
if (activeOwnPlaying) { if (activeOwnPlaying) {
activeOwnPlaying->frozenFrame = QImage(); activeOwnPlaying->frozenFrame = QImage();
activeOwnPlaying->frozenStatusText = QString(); activeOwnPlaying->frozenStatusText = QString();
} }
drawHighlighted(p, geometry, streamed->frame(request));
drawHighlighted([&]() {
p.drawImage(geometry, streamed->frame(request));
});
if (!paused) { if (!paused) {
streamed->markFrameShown(); streamed->markFrameShown();
} }
} }
} else { } else {
validateGroupedCache(geometry, corners, cacheKey, cache); validateGroupedCache(geometry, corners, cacheKey, cache);
drawHighlighted(p, geometry, *cache, true); drawHighlighted([&]() {
p.drawPixmap(geometry, *cache);
});
} }
if (selected) { if (selected) {