From 8a9549dca3adaff6d5e34bd307c7ac7b31e8cc23 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 18 Jul 2022 12:43:41 +0300 Subject: [PATCH] Fix custom emoji preview painting on Retina screen. --- Telegram/SourceFiles/ui/text/custom_emoji_instance.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/text/custom_emoji_instance.cpp b/Telegram/SourceFiles/ui/text/custom_emoji_instance.cpp index 323c3c911..56b811a9a 100644 --- a/Telegram/SourceFiles/ui/text/custom_emoji_instance.cpp +++ b/Telegram/SourceFiles/ui/text/custom_emoji_instance.cpp @@ -43,7 +43,10 @@ void Preview::paint(QPainter &p, int x, int y, const QColor &preview) { if (const auto path = std::get_if(&_data)) { paintPath(p, x, y, preview, *path); } else if (const auto image = std::get_if(&_data)) { - p.drawImage(x, y, *image); + const auto factor = style::DevicePixelRatio(); + const auto width = image->width() / factor; + const auto height = image->height() / factor; + p.drawImage(QRect(x, y, width, height), *image); } }