2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix caching for large sticker area.

This commit is contained in:
John Preston
2019-06-27 18:57:32 +02:00
parent 808583c5ae
commit 4a7b5a8e01
11 changed files with 80 additions and 33 deletions

View File

@@ -23,6 +23,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_chat_helpers.h"
namespace Stickers {
namespace {
constexpr auto kDontCacheLottieAfterArea = 512 * 512;
} // namespace
void ApplyArchivedResult(const MTPDmessages_stickerSetInstallResultArchive &d) {
auto &v = d.vsets.v;
@@ -1093,6 +1098,13 @@ std::unique_ptr<Lottie::Animation> LottieFromDocument(
QSize box) {
const auto data = document->data();
const auto filepath = document->filepath();
if (box.width() & box.height() > kDontCacheLottieAfterArea) {
// Don't use frame caching for large stickers.
return Lottie::FromContent(
data,
filepath,
Lottie::FrameRequest{ box });
}
if (const auto baseKey = document->bigFileBaseCacheKey()) {
const auto key = Storage::Cache::Key{
baseKey->high,
@@ -1116,7 +1128,7 @@ std::unique_ptr<Lottie::Animation> LottieFromDocument(
filepath,
Lottie::FrameRequest{ box });
}
return Lottie::FromContent(data, filepath);
return Lottie::FromContent(data, filepath, Lottie::FrameRequest{ box });
}
} // namespace Stickers