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
This commit is contained in:
Martin Gräßlin 2012-07-09 19:34:20 +02:00
parent 3125333f76
commit 830c17eebb

View file

@ -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<qreal>(thumb->width());
thumbData.yScale = size.height() / static_cast<qreal>(thumb->height());
// it can happen in the init/closing phase of the tabbox