From 51d350c3568df8f9eda9b3ee7c6778e23ae6c49e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 5 Aug 2019 11:28:46 +0100 Subject: [PATCH] Fix stickers and emoji render. --- Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp | 7 ++++--- .../history/view/media/history_view_sticker.cpp | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp index 011af491b..03a3b171c 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp @@ -263,6 +263,7 @@ QImage EmojiImageLoader::prepare(const IsolatedEmoji &emoji) { auto result = QImage( CalculateSize(emoji), QImage::Format_ARGB32_Premultiplied); + const auto factor = cIntRetinaFactor(); result.fill(Qt::transparent); { QPainter p(&result); @@ -275,9 +276,9 @@ QImage EmojiImageLoader::prepare(const IsolatedEmoji &emoji) { _images->draw( p, single, - st::largeEmojiSize * cIntRetinaFactor(), - x, - y); + st::largeEmojiSize * factor, + x * factor, + y * factor); x += st::largeEmojiSize + st::largeEmojiSkip; } } diff --git a/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp b/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp index 4c7d54d20..a5dd6db3d 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_sticker.cpp @@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_item.h" #include "history/view/history_view_element.h" #include "history/view/history_view_cursor_state.h" +#include "history/view/media/history_view_media_common.h" #include "ui/image/image.h" #include "ui/emoji_config.h" #include "main/main_session.h" @@ -59,6 +60,10 @@ QSize Sticker::size() { return int(size * st::maxStickerSize * zoom / kIdealStickerSize); }; _size = QSize(convert(_size.width()), convert(_size.height())); + } else { + _size = DownscaledSize( + _size, + { st::maxStickerSize, st::maxStickerSize }); } return _size; }