2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Support text-color-ed emoji in userpic editor.

This commit is contained in:
John Preston
2023-02-07 20:43:50 +04:00
parent ed9ba07a32
commit fec80c0c64
5 changed files with 11 additions and 60 deletions

View File

@@ -489,14 +489,10 @@ public:
void paint(QPainter &p);
private:
void resolveIsColored();
QRectF _rect;
std::shared_ptr<Data::DocumentMedia> _media;
std::unique_ptr<HistoryView::StickerPlayer> _player;
bool _paused = false;
bool _isColored = false;
bool _isColoredResolved = false;
rpl::lifetime _lifetime;
};
@@ -555,27 +551,11 @@ void EmojiStatusTopBar::setPaused(bool paused) {
_paused = paused;
}
void EmojiStatusTopBar::resolveIsColored() {
if (_isColoredResolved) {
return;
}
const auto document = _media->owner();
const auto manager = &document->owner().customEmojiManager();
const auto coloredSetId = manager->coloredSetId();
if (!coloredSetId) {
return;
}
_isColoredResolved = true;
const auto sticker = document->sticker();
_isColored = sticker && (sticker->set.id == coloredSetId);
}
void EmojiStatusTopBar::paint(QPainter &p) {
if (_player && _player->ready()) {
resolveIsColored();
const auto frame = _player->frame(
_rect.size().toSize(),
(_isColored
(_media->owner()->emojiUsesTextColor()
? st::profileVerifiedCheckBg->c
: QColor(0, 0, 0, 0)),
false,