diff options
| author | David Edmundson <[email protected]> | 2015-03-27 15:43:06 +0100 |
|---|---|---|
| committer | David Edmundson <[email protected]> | 2015-03-27 16:28:57 +0100 |
| commit | 1b6ee5d6cd918b81c59a5163c9d6371f35f9885c (patch) | |
| tree | c3163b42590feb0d53962c51e1c42c9eaf3e0453 /src/kitemviews/private/kpixmapmodifier.cpp | |
| parent | 35c0972671c1f90f76d8d86b002b2e1f8bac79dd (diff) | |
review comments
Diffstat (limited to 'src/kitemviews/private/kpixmapmodifier.cpp')
| -rw-r--r-- | src/kitemviews/private/kpixmapmodifier.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/kitemviews/private/kpixmapmodifier.cpp b/src/kitemviews/private/kpixmapmodifier.cpp index 3e0edf02c..4693b313a 100644 --- a/src/kitemviews/private/kpixmapmodifier.cpp +++ b/src/kitemviews/private/kpixmapmodifier.cpp @@ -38,6 +38,7 @@ #include <QPainter> #include <QPixmap> #include <QSize> +#include <QGuiApplication> #include <config-X11.h> // for HAVE_XRENDER @@ -374,22 +375,23 @@ void KPixmapModifier::scale(QPixmap& pixmap, const QSize& scaledSize) void KPixmapModifier::applyFrame(QPixmap& icon, const QSize& scaledSize) { static TileSet tileSet; - qreal dpr = icon.devicePixelRatio(); + qreal dpr = qApp->devicePixelRatio(); // Resize the icon to the maximum size minus the space required for the frame - const QSize size(scaledSize.width() - (TileSet::LeftMargin + TileSet::RightMargin) * dpr, - scaledSize.height() - (TileSet::TopMargin + TileSet::BottomMargin) * dpr); - scale(icon, size); + const QSize size(scaledSize.width() - TileSet::LeftMargin - TileSet::RightMargin, + scaledSize.height() - TileSet::TopMargin - TileSet::BottomMargin); + scale(icon, size * dpr); + icon.setDevicePixelRatio(dpr); QPixmap framedIcon(icon.size().width() + (TileSet::LeftMargin + TileSet::RightMargin) * dpr, - icon.size().height() + (TileSet::TopMargin + TileSet::BottomMargin * dpr) ); + icon.size().height() + (TileSet::TopMargin + TileSet::BottomMargin) * dpr); framedIcon.setDevicePixelRatio(dpr); framedIcon.fill(Qt::transparent); QPainter painter; painter.begin(&framedIcon); painter.setCompositionMode(QPainter::CompositionMode_Source); - tileSet.paint(&painter, framedIcon.rect()); + tileSet.paint(&painter, QRect(QPoint(0,0), framedIcon.size() / dpr)); painter.setCompositionMode(QPainter::CompositionMode_SourceOver); painter.drawPixmap(TileSet::LeftMargin, TileSet::TopMargin, icon); |
