diff options
| author | Peter Penz <[email protected]> | 2011-10-27 22:34:33 +0200 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2011-10-27 22:36:47 +0200 |
| commit | f63daef339dde16c7ef598f6fdaa5d2191da4685 (patch) | |
| tree | 61755265d43aa83bd44ff618bd2332b177cca506 /src/kitemviews/kpixmapmodifier.cpp | |
| parent | 528262a6be4ab2ad7e17860a281ea80b90c1605b (diff) | |
Fix minor visual issues in the view-engine
- Increasing the window-size should not result in increasing the
size from previously invisible items
- Rename group 'Numerics' to '0 - 9'
- Fix "damaged" icons when changing the view-sizes or changing the
view-mode
Diffstat (limited to 'src/kitemviews/kpixmapmodifier.cpp')
| -rw-r--r-- | src/kitemviews/kpixmapmodifier.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/kitemviews/kpixmapmodifier.cpp b/src/kitemviews/kpixmapmodifier.cpp index 07c5286d7..f6838c032 100644 --- a/src/kitemviews/kpixmapmodifier.cpp +++ b/src/kitemviews/kpixmapmodifier.cpp @@ -327,13 +327,19 @@ namespace { void KPixmapModifier::scale(QPixmap& pixmap, const QSize& scaledSize) { + if (scaledSize.isEmpty()) { + pixmap = QPixmap(); + return; + } + #if defined(Q_WS_X11) && defined(HAVE_XRENDER) // Assume that the texture size limit is 2048x2048 if ((pixmap.width() <= 2048) && (pixmap.height() <= 2048) && pixmap.x11PictureHandle()) { + const QPixmap unscaledPixmap = pixmap.copy(); // Make a deep copy for XRender QSize scaledPixmapSize = pixmap.size(); scaledPixmapSize.scale(scaledSize, Qt::KeepAspectRatio); - const qreal factor = scaledPixmapSize.width() / qreal(pixmap.width()); + const qreal factor = scaledPixmapSize.width() / qreal(unscaledPixmap.width()); XTransform xform = {{ { XDoubleToFixed(1 / factor), 0, 0 }, @@ -348,11 +354,11 @@ void KPixmapModifier::scale(QPixmap& pixmap, const QSize& scaledSize) XRenderPictureAttributes attr; attr.repeat = RepeatPad; - XRenderChangePicture(dpy, pixmap.x11PictureHandle(), CPRepeat, &attr); + XRenderChangePicture(dpy, unscaledPixmap.x11PictureHandle(), CPRepeat, &attr); - XRenderSetPictureFilter(dpy, pixmap.x11PictureHandle(), FilterBilinear, 0, 0); - XRenderSetPictureTransform(dpy, pixmap.x11PictureHandle(), &xform); - XRenderComposite(dpy, PictOpOver, pixmap.x11PictureHandle(), None, scaledPixmap.x11PictureHandle(), + XRenderSetPictureFilter(dpy, unscaledPixmap.x11PictureHandle(), FilterBilinear, 0, 0); + XRenderSetPictureTransform(dpy, unscaledPixmap.x11PictureHandle(), &xform); + XRenderComposite(dpy, PictOpOver, unscaledPixmap.x11PictureHandle(), None, scaledPixmap.x11PictureHandle(), 0, 0, 0, 0, 0, 0, scaledPixmap.width(), scaledPixmap.height()); pixmap = scaledPixmap; } else { |
