diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp index a1d9dc2ac0..d86ab76db4 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.cpp @@ -25,6 +25,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_saved_sublist.h" #include "data/data_session.h" #include "data/data_user.h" +#include "data/data_document.h" #include "data/stickers/data_custom_emoji.h" #include "info_profile_actions.h" #include "info/info_controller.h" @@ -219,6 +220,17 @@ TopBar::TopBar( _hasBackground = collectible != nullptr; _cachedClipPath = QPainterPath(); _cachedGradient = QImage(); + _patternEmojis.clear(); + if (collectible && collectible->patternDocumentId) { + const auto document = _peer->owner().document( + collectible->patternDocumentId); + _patternEmoji = document->owner().customEmojiManager().create( + document, + [=] { update(); }, + Data::CustomEmojiSizeTag::Large); + } else { + _patternEmoji = nullptr; + } update(); if (collectible) { constexpr auto kMinContrast = 5.5; @@ -593,6 +605,20 @@ void TopBar::paintEvent(QPaintEvent *e) { } else { p.drawImage(x, y, _cachedGradient); } + + if (_patternEmoji && _patternEmoji->ready()) { + const auto collectible = _peer->emojiStatusId().collectible; + if (collectible) { + Ui::PaintBgPoints( + p, + Ui::PatternBgPoints(), + _patternEmojis, + _patternEmoji.get(), + collectible->patternColor, + rect(), + 1.); + } + } } paintUserpic(p); } diff --git a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h index 9cf1e4dc30..39584c4714 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_top_bar.h +++ b/Telegram/SourceFiles/info/profile/info_profile_top_bar.h @@ -23,6 +23,9 @@ class TopicIconView; namespace Ui { class VideoUserpicPlayer; +namespace Text { +class CustomEmoji; +} // namespace Text } // namespace Ui class PeerData; @@ -132,6 +135,8 @@ private: bool _hasBackground = false; QImage _cachedGradient; QPainterPath _cachedClipPath; + std::unique_ptr _patternEmoji; + base::flat_map _patternEmojis; Ui::PeerUserpicView _userpicView; InMemoryKey _userpicUniqueKey;