2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Stop GIFs that are far away from the screen.

This commit is contained in:
John Preston
2019-12-11 17:15:29 +03:00
parent 9339db900f
commit dbdd9aa481
3 changed files with 15 additions and 7 deletions

View File

@@ -1389,9 +1389,10 @@ void Session::unloadHeavyViewParts(
if (_heavyViewParts.empty()) {
return;
}
const auto remove = ranges::count(_heavyViewParts, delegate, [](not_null<ViewElement*> element) {
return element->delegate();
});
const auto remove = ranges::count(
_heavyViewParts,
delegate,
[](not_null<ViewElement*> element) { return element->delegate(); });
if (remove == _heavyViewParts.size()) {
for (const auto view : base::take(_heavyViewParts)) {
view->unloadHeavyPart();
@@ -3225,10 +3226,12 @@ void Session::unregisterContactItem(
void Session::registerPlayingVideoFile(not_null<ViewElement*> view) {
_playingVideoFiles.emplace(view);
registerHeavyViewPart(view);
}
void Session::unregisterPlayingVideoFile(not_null<ViewElement*> view) {
_playingVideoFiles.remove(view);
unregisterHeavyViewPart(view);
}
void Session::stopPlayingVideoFiles() {