mirror of https://github.com/procxx/kepka.git
Stop GIFs that are far away from the screen.
This commit is contained in:
parent
9339db900f
commit
dbdd9aa481
|
@ -1389,9 +1389,10 @@ void Session::unloadHeavyViewParts(
|
||||||
if (_heavyViewParts.empty()) {
|
if (_heavyViewParts.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto remove = ranges::count(_heavyViewParts, delegate, [](not_null<ViewElement*> element) {
|
const auto remove = ranges::count(
|
||||||
return element->delegate();
|
_heavyViewParts,
|
||||||
});
|
delegate,
|
||||||
|
[](not_null<ViewElement*> element) { return element->delegate(); });
|
||||||
if (remove == _heavyViewParts.size()) {
|
if (remove == _heavyViewParts.size()) {
|
||||||
for (const auto view : base::take(_heavyViewParts)) {
|
for (const auto view : base::take(_heavyViewParts)) {
|
||||||
view->unloadHeavyPart();
|
view->unloadHeavyPart();
|
||||||
|
@ -3225,10 +3226,12 @@ void Session::unregisterContactItem(
|
||||||
|
|
||||||
void Session::registerPlayingVideoFile(not_null<ViewElement*> view) {
|
void Session::registerPlayingVideoFile(not_null<ViewElement*> view) {
|
||||||
_playingVideoFiles.emplace(view);
|
_playingVideoFiles.emplace(view);
|
||||||
|
registerHeavyViewPart(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::unregisterPlayingVideoFile(not_null<ViewElement*> view) {
|
void Session::unregisterPlayingVideoFile(not_null<ViewElement*> view) {
|
||||||
_playingVideoFiles.remove(view);
|
_playingVideoFiles.remove(view);
|
||||||
|
unregisterHeavyViewPart(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Session::stopPlayingVideoFiles() {
|
void Session::stopPlayingVideoFiles() {
|
||||||
|
|
|
@ -369,10 +369,11 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms
|
||||||
}
|
}
|
||||||
|
|
||||||
if (radial
|
if (radial
|
||||||
|| (!streamed
|
|| (!startPlayAsync
|
||||||
&& !startPlayAsync
|
&& (!_streamed
|
||||||
&& ((_streamed && _streamed->player().failed())
|
|| _streamed->waitingShown()
|
||||||
|| (!_data->loaded() && !_data->loading())
|
|| _streamed->player().failed())
|
||||||
|
&& ((!_data->loaded() && !_data->loading())
|
||||||
|| !autoplayEnabled()))) {
|
|| !autoplayEnabled()))) {
|
||||||
auto radialOpacity = (radial && _data->loaded() && item->id > 0)
|
auto radialOpacity = (radial && _data->loaded() && item->id > 0)
|
||||||
? _animation->radial.opacity()
|
? _animation->radial.opacity()
|
||||||
|
|
|
@ -80,6 +80,10 @@ public:
|
||||||
|
|
||||||
void parentTextUpdated() override;
|
void parentTextUpdated() override;
|
||||||
|
|
||||||
|
void unloadHeavyPart() override {
|
||||||
|
stopAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float64 dataProgress() const override;
|
float64 dataProgress() const override;
|
||||||
bool dataFinished() const override;
|
bool dataFinished() const override;
|
||||||
|
|
Loading…
Reference in New Issue