]> cloud.milkyroute.net Git - dolphin.git/commitdiff
[KStandardItemListWidget] Avoid needless image resizing
authorKai Uwe Broulik <kde@privat.broulik.de>
Wed, 11 Jul 2018 13:41:58 +0000 (15:41 +0200)
committerKai Uwe Broulik <kde@privat.broulik.de>
Wed, 11 Jul 2018 13:41:58 +0000 (15:41 +0200)
There be rounding errors when scaling pixmaps when keeping aspect ratio

Differential Revision: https://phabricator.kde.org/D11319

src/kitemviews/kstandarditemlistwidget.cpp

index bc3bb29de94daf12b115fd18b1579d69ccaa60f9..8b7eacf44352da4d78f2983956b1004ef303254b 100644 (file)
@@ -1011,7 +1011,8 @@ void KStandardItemListWidget::updatePixmapCache()
     const int maxScaledIconHeight = scaledIconSize;
 
     m_scaledPixmapSize = m_pixmap.size();
-    m_scaledPixmapSize.scale(maxScaledIconWidth, maxScaledIconHeight, Qt::KeepAspectRatio);
+    m_scaledPixmapSize.scale(maxScaledIconWidth * qApp->devicePixelRatio(), maxScaledIconHeight * qApp->devicePixelRatio(), Qt::KeepAspectRatio);
+    m_scaledPixmapSize = m_scaledPixmapSize / qApp->devicePixelRatio();
 
     if (iconOnTop) {
         // Center horizontally and align on bottom within the icon-area