mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Improve verified badge display.
This commit is contained in:
@@ -31,6 +31,12 @@ namespace {
|
||||
|
||||
constexpr auto kDontCacheLottieAfterArea = 512 * 512;
|
||||
|
||||
[[nodiscard]] uint64 LocalStickerId(QStringView name) {
|
||||
auto full = u"local_sticker:"_q;
|
||||
full.append(name);
|
||||
return XXH64(full.data(), full.size() * sizeof(QChar), 0);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
uint8 LottieCacheKeyShift(uint8 replacementsTag, StickerLottieSize sizeTag) {
|
||||
@@ -315,16 +321,9 @@ QSize ComputeStickerSize(not_null<DocumentData*> document, QSize box) {
|
||||
return HistoryView::NonEmptySize(request.size(dimensions, 8) / ratio);
|
||||
}
|
||||
|
||||
[[nodiscard]] uint64 LocalTgsStickerId(QStringView name) {
|
||||
auto full = u"local_tgs_sticker:"_q;
|
||||
full.append(name);
|
||||
return XXH64(full.data(), full.size() * sizeof(QChar), 0);
|
||||
}
|
||||
|
||||
not_null<DocumentData*> GenerateLocalTgsSticker(
|
||||
not_null<DocumentData*> GenerateLocalSticker(
|
||||
not_null<Main::Session*> session,
|
||||
const QString &name) {
|
||||
const auto path = u":/animations/"_q + name + u".tgs"_q;
|
||||
const QString &path) {
|
||||
auto task = FileLoadTask(
|
||||
session,
|
||||
path,
|
||||
@@ -335,7 +334,7 @@ not_null<DocumentData*> GenerateLocalTgsSticker(
|
||||
{},
|
||||
false,
|
||||
nullptr,
|
||||
LocalTgsStickerId(name));
|
||||
LocalStickerId(path));
|
||||
task.process({ .generateGoodThumbnail = false });
|
||||
const auto result = task.peekResult();
|
||||
Assert(result != nullptr);
|
||||
@@ -348,8 +347,18 @@ not_null<DocumentData*> GenerateLocalTgsSticker(
|
||||
document->setLocation(Core::FileLocation(path));
|
||||
|
||||
Ensures(document->sticker());
|
||||
Ensures(document->sticker()->isLottie());
|
||||
return document;
|
||||
}
|
||||
|
||||
not_null<DocumentData*> GenerateLocalTgsSticker(
|
||||
not_null<Main::Session*> session,
|
||||
const QString &name) {
|
||||
const auto result = GenerateLocalSticker(
|
||||
session,
|
||||
u":/animations/"_q + name + u".tgs"_q);
|
||||
|
||||
Ensures(result->sticker()->isLottie());
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace ChatHelpers
|
||||
|
||||
Reference in New Issue
Block a user