[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kiconthemes] src: Fix KIconEngine::paint to handle different devicePixelRatios
From:       David Edmundson <kde () davidedmundson ! co ! uk>
Date:       2015-03-11 14:41:53
Message-ID: E1YVhpZ-0008NF-Gc () scm ! kde ! org
[Download RAW message or body]

Git commit 841f23a712dfc6be7fee16f8a6451ec4a084c45c by David Edmundson.
Committed on 09/03/2015 at 17:51.
Pushed by davidedmundson into branch 'master'.

Fix KIconEngine::paint to handle different devicePixelRatios

This now matches the behaviour of QPixmapIconEngine::paint

REVIEW: 122875

M  +3    -1    src/kiconengine.cpp

http://commits.kde.org/kiconthemes/841f23a712dfc6be7fee16f8a6451ec4a084c45c

diff --git a/src/kiconengine.cpp b/src/kiconengine.cpp
index 6dff533..208c055 100644
--- a/src/kiconengine.cpp
+++ b/src/kiconengine.cpp
@@ -69,8 +69,10 @@ void KIconEngine::paint(QPainter *painter, const QRect &rect, \
QIcon::Mode mode,  
     Q_UNUSED(state)
 
+    qreal dpr = painter->device()->devicePixelRatio();
+
     const int kstate = qIconModeToKIconState(mode);
-    const int iconSize = qMin(rect.width(), rect.height());
+    const int iconSize = qMin(rect.width(), rect.height()) * dpr;
     const QPixmap pix = mIconLoader.data()->loadIcon(mIconName, \
KIconLoader::Desktop, iconSize, kstate, mOverlays);  painter->drawPixmap(rect, pix);
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic