2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 15:05:56 +00:00

Generate good thumbnail for animated stickers.

This commit is contained in:
John Preston
2019-07-04 10:20:36 +02:00
parent 7034df49e9
commit 0a63eac4f6
4 changed files with 43 additions and 7 deletions

View File

@@ -636,7 +636,10 @@ Image *DocumentData::goodThumbnail() const {
}
void DocumentData::validateGoodThumbnail() {
if (!isVideoFile() && !isAnimation() && !isWallPaper()) {
if (!isVideoFile()
&& !isAnimation()
&& !isWallPaper()
&& (!sticker() || !sticker()->animated)) {
_goodThumbnail = nullptr;
} else if (!_goodThumbnail && hasRemoteLocation()) {
_goodThumbnail = std::make_unique<Image>(
@@ -665,7 +668,10 @@ void DocumentData::setGoodThumbnailOnUpload(
}
_goodThumbnail = std::make_unique<Image>(
std::make_unique<Images::LocalFileSource>(
QString(), std::move(bytes), "JPG", std::move(image)));
QString(),
std::move(bytes),
sticker() ? "WEBP" : "JPG",
std::move(image)));
}
auto DocumentData::bigFileBaseCacheKey() const