From 9feea4a72445b392a5a8cd87593d315c7e86f091 Mon Sep 17 00:00:00 2001 From: John Preston <johnprestonmail@gmail.com> Date: Mon, 3 Feb 2020 14:49:46 +0400 Subject: [PATCH] Don't blur video thumbnail if any side >= 240px. Fixes #6332. --- .../SourceFiles/history/view/media/history_view_gif.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index c317c5a49..5dc6ba35c 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -39,7 +39,7 @@ namespace HistoryView { namespace { constexpr auto kMaxGifForwardedBarLines = 4; -constexpr auto kUseNonBlurredThreshold = 160; +constexpr auto kUseNonBlurredThreshold = 240; int gifMaxStatusWidth(DocumentData *document) { auto result = st::normalFont->width(formatDownloadText(document->size, document->size)); @@ -406,7 +406,7 @@ void Gif::draw(Painter &p, const QRect &r, TextSelection selection, crl::time ms const auto normal = _data->thumbnail(); if (normal && normal->loaded()) { if (normal->width() >= kUseNonBlurredThreshold - && normal->height() >= kUseNonBlurredThreshold) { + || normal->height() >= kUseNonBlurredThreshold) { p.drawPixmap(rthumb.topLeft(), normal->pixSingle(_realParent->fullId(), _thumbw, _thumbh, usew, painth, roundRadius, roundCorners)); } else { p.drawPixmap(rthumb.topLeft(), normal->pixBlurredSingle(_realParent->fullId(), _thumbw, _thumbh, usew, painth, roundRadius, roundCorners)); @@ -1116,8 +1116,8 @@ void Gif::validateGroupedCache( : _data->thumbnailInline(); const auto blur = !useGood && (!useThumb - || (thumb->width() < kUseNonBlurredThreshold) - || (thumb->height() < kUseNonBlurredThreshold)); + || (thumb->width() < kUseNonBlurredThreshold + && thumb->height() < kUseNonBlurredThreshold)); if (good && !useGood) { good->load({}); }