1
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-03-25 04:38:23 +00:00

Remove unnecessary repaints in an inactive window.

This commit is contained in:
John Preston 2019-12-18 22:00:19 +03:00
parent 92d87f96e1
commit 9f96237b85

View File

@ -252,10 +252,8 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms
const auto autoPaused = App::wnd()->sessionController()->isGifPausedAtLeastFor(Window::GifPauseReason::Any);
const auto cornerDownload = downloadInCorner();
const auto canBePlayed = _data->canBePlayed();
const auto activeRoundPlaying = activeRoundStreamed();
const auto activeOwnPlaying = activeOwnStreamed();
const auto autoplay = autoplayEnabled() && canBePlayed;
const auto streamingMode = _streamed || activeRoundPlaying || autoplay;
const auto activeRoundPlaying = activeRoundStreamed();
const auto startPlayAsync = autoplay
&& !_streamed
&& !activeRoundPlaying;
@ -268,6 +266,8 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms
&& !_streamed->instance.failed()) {
startStreamedPlayer();
}
const auto streamingMode = _streamed || activeRoundPlaying || autoplay;
const auto activeOwnPlaying = activeOwnStreamed();
auto paintx = 0, painty = 0, paintw = width(), painth = height();
bool bubble = _parent->hasBubble();
@ -1246,6 +1246,10 @@ void Gif::repaintStreamedContent() {
if (own && !own->frozenFrame.isNull()) {
return;
}
if (App::wnd()->sessionController()->isGifPausedAtLeastFor(Window::GifPauseReason::Any)
&& !activeRoundStreamed()) {
return;
}
history()->owner().requestViewRepaint(_parent);
}