From 7c537cd7873787cbb0fa4bb1983a78404e337147 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 2 Jan 2023 12:35:18 +0400 Subject: [PATCH] Revert "Removed downscaling of 2560px images before displaying them" This reverts commit 0f3ec7893d5f4f6ad4a2e3401551c95ce335740a. Instead correct max limits of 2560x2560 will be used. --- Telegram/SourceFiles/data/data_photo_media.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Telegram/SourceFiles/data/data_photo_media.cpp b/Telegram/SourceFiles/data/data_photo_media.cpp index 2a2a24620..312b672f5 100644 --- a/Telegram/SourceFiles/data/data_photo_media.cpp +++ b/Telegram/SourceFiles/data/data_photo_media.cpp @@ -101,6 +101,14 @@ void PhotoMedia::set( QImage image, QByteArray bytes) { const auto index = PhotoSizeIndex(size); + const auto limit = PhotoData::SideLimit(); + if (image.width() > limit || image.height() > limit) { + image = image.scaled( + limit, + limit, + Qt::KeepAspectRatio, + Qt::SmoothTransformation); + } _images[index] = PhotoImage{ .data = std::make_unique(std::move(image)), .bytes = std::move(bytes),