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

Support custom emoji in IsolatedEmoji.

This commit is contained in:
John Preston
2022-07-25 17:54:37 +03:00
parent 9b941bae97
commit edfb7bb65a
10 changed files with 183 additions and 62 deletions

View File

@@ -19,7 +19,7 @@ namespace Ui::CustomEmoji {
namespace {
constexpr auto kMaxSize = 128;
constexpr auto kMaxFrames = 512;
constexpr auto kMaxFrames = 180;
constexpr auto kMaxFrameDuration = 86400 * crl::time(1000);
constexpr auto kCacheVersion = 1;
constexpr auto kPreloadFrames = 3;
@@ -415,7 +415,7 @@ void Renderer::frameReady(
}
if (const auto count = generator->count()) {
if (!_cache.frames()) {
_cache.reserve(count);
_cache.reserve(std::max(count, kMaxFrames));
}
}
const auto current = _cache.currentFrame();
@@ -425,7 +425,7 @@ void Renderer::frameReady(
if (explicitRepaint && _repaint) {
_repaint();
}
if (!duration) {
if (!duration || total + 1 >= kMaxFrames) {
finish();
} else if (current + kPreloadFrames > total) {
renderNext(std::move(generator), std::move(frame));