From 830c17eebb711f4ca48ea9226fe97c80727ac262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 9 Jul 2012 19:34:20 +0200 Subject: [PATCH] Ensure that thumbnails do not get larger than the window Upscaling windows looks really bad. If the thumbnail gets larger than the window it's better to just use the orignal window size and have the thumbnail rendered centered in the requested region. BUG: 297864 FIXED-IN: 4.9.0 REVIEW: 105459 --- scene.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scene.cpp b/scene.cpp index daaa5b44a1..0c5f6339a9 100644 --- a/scene.cpp +++ b/scene.cpp @@ -364,6 +364,9 @@ void Scene::paintWindow(Window* w, int mask, QRegion region, WindowQuadList quad QSizeF size = QSizeF(thumb->size()); size.scale(QSizeF(item->width(), item->height()), Qt::KeepAspectRatio); + if (size.width() > thumb->width() || size.height() > thumb->height()) { + size = QSizeF(thumb->size()); + } thumbData.xScale = size.width() / static_cast(thumb->width()); thumbData.yScale = size.height() / static_cast(thumb->height()); // it can happen in the init/closing phase of the tabbox