[SCM] kiconthemes packaging branch, master, updated. debian/5.28.0-1-5-g58234cb
Maximiliano Curia
maxy at moszumanska.debian.org
Mon Apr 3 10:48:18 UTC 2017
Gitweb-URL: http://git.debian.org/?p=pkg-kde/frameworks/kiconthemes.git;a=commitdiff;h=3ec1d1d
The following commit has been merged in the master branch:
commit 3ec1d1dbad0a4598da45282ee86b2cb2ef055880
Author: Maximiliano Curia <maxy at gnuservers.com.ar>
Date: Mon Apr 3 12:31:03 2017 +0200
Add new upstream patch: KIconEngine-Center-icon-in-requested-rect.patch
---
...KIconEngine-Center-icon-in-requested-rect.patch | 71 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 72 insertions(+)
diff --git a/debian/patches/KIconEngine-Center-icon-in-requested-rect.patch b/debian/patches/KIconEngine-Center-icon-in-requested-rect.patch
new file mode 100644
index 0000000..ef6f0c4
--- /dev/null
+++ b/debian/patches/KIconEngine-Center-icon-in-requested-rect.patch
@@ -0,0 +1,71 @@
+From: David Rosca <nowrep at gmail.com>
+Date: Sun, 22 Jan 2017 17:36:03 +0100
+Subject: KIconEngine: Center icon in requested rect
+
+Match the behavior of Qt's internal icon engines.
+
+Differential Revision: https://phabricator.kde.org/D4247
+---
+ autotests/kiconengine_unittest.cpp | 15 +++++++++++++++
+ src/kiconengine.cpp | 10 ++--------
+ 2 files changed, 17 insertions(+), 8 deletions(-)
+
+diff --git a/autotests/kiconengine_unittest.cpp b/autotests/kiconengine_unittest.cpp
+index ac26b8d..60476df 100644
+--- a/autotests/kiconengine_unittest.cpp
++++ b/autotests/kiconengine_unittest.cpp
+@@ -127,6 +127,21 @@ private Q_SLOTS:
+ QCOMPARE(icon3.name(), nonExistingIconName);
+
+ }
++
++ void testCenterIcon()
++ {
++ QIcon icon(new KIconEngine(QStringLiteral("kde"), KIconLoader::global()));
++ QVERIFY(!icon.isNull());
++
++ // "kde" icon is actually "test-22x22.png", so this is original icon image
++ const QImage image = icon.pixmap(22, 22).toImage();
++
++ // center vertically
++ QVERIFY(icon.pixmap(22, 26).toImage().copy(0, 2, 22, 22) == image);
++
++ // center horizontally
++ QVERIFY(icon.pixmap(26, 22).toImage().copy(2, 0, 22, 22) == image);
++ }
+ private:
+ QDir testIconsDir;
+ };
+diff --git a/src/kiconengine.cpp b/src/kiconengine.cpp
+index 6f3288c..da6051e 100644
+--- a/src/kiconengine.cpp
++++ b/src/kiconengine.cpp
+@@ -72,18 +72,12 @@ void KIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode,
+ return;
+ }
+
+- Q_UNUSED(state)
+-
+ #if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
+ const qreal dpr = painter->device()->devicePixelRatioF();
+ #else
+ const qreal dpr = painter->device()->devicePixelRatio();
+ #endif
+-
+- const int kstate = qIconModeToKIconState(mode);
+- 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);
++ painter->drawPixmap(rect, pixmap(rect.size() * dpr, mode, state));
+ }
+
+ QPixmap KIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
+@@ -113,7 +107,7 @@ QPixmap KIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
+ pix2.fill(QColor(0, 0, 0, 0));
+
+ QPainter painter(&pix2);
+- painter.drawPixmap(QPoint(), pix);
++ painter.drawPixmap(QPoint((pix2.width() - pix.width()) / 2, (pix2.height() - pix.height()) / 2), pix);
+
+ return pix2;
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 0257d03..90df572 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
Inform-QIconLoader-also-when-the-desktop-icon-theme-is-ch.patch
+KIconEngine-Center-icon-in-requested-rect.patch
--
kiconthemes packaging
More information about the pkg-kde-commits
mailing list