mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Support optimized lottie emoji.
This commit is contained in:
@@ -27,6 +27,10 @@ constexpr auto kDontCacheLottieAfterArea = 512 * 512;
|
||||
|
||||
} // namespace
|
||||
|
||||
uint8 LottieCacheKeyShift(uint8 replacementsTag, StickerLottieSize sizeTag) {
|
||||
return ((replacementsTag << 4) & 0xF0) | (uint8(sizeTag) & 0x0F);
|
||||
}
|
||||
|
||||
template <typename Method>
|
||||
auto LottieCachedFromContent(
|
||||
Method &&method,
|
||||
@@ -115,8 +119,9 @@ std::unique_ptr<Lottie::SinglePlayer> LottiePlayerFromDocument(
|
||||
replacements,
|
||||
std::move(renderer));
|
||||
};
|
||||
const auto tag = replacements ? replacements->tag : uint8(0);
|
||||
const auto keyShift = ((tag << 4) & 0xF0) | (uint8(sizeTag) & 0x0F);
|
||||
const auto keyShift = LottieCacheKeyShift(
|
||||
replacements ? replacements->tag : uint8(0),
|
||||
sizeTag);
|
||||
return LottieFromDocument(method, media, uint8(keyShift), box);
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@ using StickersSetFlags = base::flags<StickersSetFlag>;
|
||||
|
||||
namespace ChatHelpers {
|
||||
|
||||
enum class StickerLottieSize : uchar {
|
||||
enum class StickerLottieSize : uint8 {
|
||||
MessageHistory,
|
||||
StickerSet,
|
||||
StickersPanel,
|
||||
@@ -66,6 +66,9 @@ enum class StickerLottieSize : uchar {
|
||||
EmojiInteractionReserved7,
|
||||
PremiumReactionPreview,
|
||||
};
|
||||
[[nodiscard]] uint8 LottieCacheKeyShift(
|
||||
uint8 replacementsTag,
|
||||
StickerLottieSize sizeTag);
|
||||
|
||||
[[nodiscard]] std::unique_ptr<Lottie::SinglePlayer> LottiePlayerFromDocument(
|
||||
not_null<Data::DocumentMedia*> media,
|
||||
|
Reference in New Issue
Block a user