mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Support colored emoji statuses.
This commit is contained in:
@@ -169,9 +169,12 @@ int PeerBadge::drawGetWidth(
|
||||
}
|
||||
if (!_emojiStatus) {
|
||||
_emojiStatus = std::make_unique<EmojiStatus>();
|
||||
const auto size = st::emojiSize * 1.;
|
||||
const auto emoji = Ui::Text::AdjustCustomEmojiSize(st::emojiSize);
|
||||
_emojiStatus->skip = (st::emojiSize - emoji) / 2;
|
||||
const auto size = st::emojiSize;
|
||||
const auto emoji = Ui::Text::AdjustCustomEmojiSize(size);
|
||||
_emojiStatus->skip = (size - emoji) / 2;
|
||||
_emojiStatus->colored = std::make_unique<
|
||||
Ui::Text::CustomEmojiColored
|
||||
>();
|
||||
}
|
||||
if (_emojiStatus->id != id) {
|
||||
auto &manager = peer->session().data().customEmojiManager();
|
||||
@@ -180,8 +183,10 @@ int PeerBadge::drawGetWidth(
|
||||
id,
|
||||
descriptor.customEmojiRepaint);
|
||||
}
|
||||
_emojiStatus->colored->color = (*descriptor.premiumFg)->c;
|
||||
_emojiStatus->emoji->paint(p, {
|
||||
.preview = descriptor.preview,
|
||||
.colored = _emojiStatus->colored.get(),
|
||||
.now = descriptor.now,
|
||||
.position = QPoint(
|
||||
iconx - 2 * _emojiStatus->skip,
|
||||
|
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace Ui::Text {
|
||||
class CustomEmoji;
|
||||
struct CustomEmojiColored;
|
||||
} // namespace Ui::Text
|
||||
|
||||
namespace Ui {
|
||||
@@ -41,6 +42,7 @@ public:
|
||||
const style::icon *verified = nullptr;
|
||||
const style::icon *premium = nullptr;
|
||||
const style::color *scam = nullptr;
|
||||
const style::color *premiumFg = nullptr;
|
||||
QColor preview;
|
||||
Fn<void()> customEmojiRepaint;
|
||||
crl::time now = 0;
|
||||
@@ -58,6 +60,7 @@ private:
|
||||
struct EmojiStatus {
|
||||
DocumentId id = 0;
|
||||
std::unique_ptr<Ui::Text::CustomEmoji> emoji;
|
||||
std::unique_ptr<Ui::Text::CustomEmojiColored> colored;
|
||||
int skip = 0;
|
||||
};
|
||||
std::unique_ptr<EmojiStatus> _emojiStatus;
|
||||
|
Reference in New Issue
Block a user