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

Implement animated spoilers.

This commit is contained in:
John Preston
2022-09-17 00:23:27 +04:00
parent 4975254cc1
commit 749fb52113
291 changed files with 814 additions and 556 deletions

View File

@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/text/text_utilities.h"
#include "ui/emoji_config.h"
#include "ui/empty_userpic.h"
#include "ui/painter.h"
#include "ui/ui_utility.h"
#include "data/data_session.h"
#include "data/stickers/data_custom_emoji.h"
@@ -780,16 +781,15 @@ void Notification::repaintText() {
}
void Notification::paintText(Painter &p) {
p.setTextPalette(st::dialogsTextPalette);
p.setPen(st::dialogsTextFg);
p.setFont(st::dialogsTextFont);
_textCache.drawElided(
p,
_textRect.left(),
_textRect.top(),
_textRect.width(),
_textRect.height() / st::dialogsTextFont->height);
p.restoreTextPalette();
_textCache.draw(p, {
.position = _textRect.topLeft(),
.availableWidth = _textRect.width(),
.palette = &st::dialogsTextPalette,
.spoiler = Ui::Text::DefaultSpoilerCache(),
.elisionLines = _textRect.height() / st::dialogsTextFont->height,
});
}
void Notification::updateNotifyDisplay() {
@@ -902,7 +902,7 @@ void Notification::updateNotifyDisplay() {
context);
_textRect = r;
paintText(p);
if (!_textCache.hasCustomEmoji()) {
if (!_textCache.hasPersistentAnimation()) {
_textCache = Ui::Text::String();
}
} else {