commit:     bdf9052b496d97f1e0d6f882dfa7fcf160397d70
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 15 19:49:34 2019 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Jul 15 20:51:57 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bdf9052b

kde-misc/skanlite: EAPI-7 bump, HiDPI fix

Package-Manager: Portage-2.3.69, Repoman-2.3.16
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../skanlite/files/skanlite-2.1.0.1-hidpi.patch    | 67 ++++++++++++++++++++++
 kde-misc/skanlite/skanlite-2.1.0.1-r1.ebuild       | 37 ++++++++++++
 2 files changed, 104 insertions(+)

diff --git a/kde-misc/skanlite/files/skanlite-2.1.0.1-hidpi.patch 
b/kde-misc/skanlite/files/skanlite-2.1.0.1-hidpi.patch
new file mode 100644
index 00000000000..563f5950063
--- /dev/null
+++ b/kde-misc/skanlite/files/skanlite-2.1.0.1-hidpi.patch
@@ -0,0 +1,67 @@
+From cb382f87d63bdc3736696ee289875bde2ecee9e5 Mon Sep 17 00:00:00 2001
+From: Alexander Volkov <a.vol...@rusbitech.ru>
+Date: Thu, 25 Apr 2019 18:09:59 +0300
+Subject: Add HiDPI support
+
+Reviewers: sars, davidedmundson, ngraham
+
+Reviewed By: sars
+
+Differential Revision: https://phabricator.kde.org/D20821
+---
+ src/ImageViewer.cpp | 14 +++++++++++---
+ src/main.cpp        |  1 +
+ 2 files changed, 12 insertions(+), 3 deletions(-)
+
+diff --git a/src/ImageViewer.cpp b/src/ImageViewer.cpp
+index 09f9b3d..5cf1439 100644
+--- a/src/ImageViewer.cpp
++++ b/src/ImageViewer.cpp
+@@ -87,14 +87,19 @@ void ImageViewer::setQImage(QImage *img)
+     }
+ 
+     d->img = img;
+-    d->scene->setSceneRect(0, 0, img->width(), img->height());
++    const auto dpr = devicePixelRatioF();
++    d->img->setDevicePixelRatio(dpr);
++    d->scene->setSceneRect(0, 0, img->width() / dpr, img->height() / dpr);
+ }
+ 
+ // ------------------------------------------------------------------------
+ void ImageViewer::drawBackground(QPainter *painter, const QRectF &rect)
+ {
+     painter->fillRect(rect, QColor(0x70, 0x70, 0x70));
+-    painter->drawImage(rect, *d->img, rect);
++    QRectF r = rect & sceneRect();
++    const auto dpr = d->img->devicePixelRatio();
++    QRectF srcRect = QRectF(r.topLeft() * dpr, r.size() * dpr);
++    painter->drawImage(r, *d->img, srcRect);
+ }
+ 
+ // ------------------------------------------------------------------------
+@@ -118,7 +123,10 @@ void ImageViewer::zoomActualSize()
+ // ------------------------------------------------------------------------
+ void ImageViewer::zoom2Fit()
+ {
+-    fitInView(d->img->rect(), Qt::KeepAspectRatio);
++    QRectF r = d->img->rect();
++    const auto dpr = d->img->devicePixelRatio();
++    r = QRectF(r.topLeft() / dpr, r.size() / dpr);
++    fitInView(r, Qt::KeepAspectRatio);
+ }
+ 
+ // ------------------------------------------------------------------------
+diff --git a/src/main.cpp b/src/main.cpp
+index aa704be..ae0d9b6 100644
+--- a/src/main.cpp
++++ b/src/main.cpp
+@@ -34,6 +34,7 @@
+ 
+ int main(int argc, char *argv[])
+ {
++    QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+     QApplication app(argc, argv);
+ 
+     Kdelibs4ConfigMigrator migrate(QLatin1String("Skanlite"));
+-- 
+cgit v1.1

diff --git a/kde-misc/skanlite/skanlite-2.1.0.1-r1.ebuild 
b/kde-misc/skanlite/skanlite-2.1.0.1-r1.ebuild
new file mode 100644
index 00000000000..dec84c60dfe
--- /dev/null
+++ b/kde-misc/skanlite/skanlite-2.1.0.1-r1.ebuild
@@ -0,0 +1,37 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+KDE_HANDBOOK="forceoptional"
+KDE_TEST="forceoptional"
+inherit kde5
+
+DESCRIPTION="KDE image scanning application"
+HOMEPAGE="https://kde.org/applications/graphics/skanlite";
+SRC_URI="mirror://kde/stable/${PN}/2.1/${P}.tar.xz"
+
+LICENSE="|| ( GPL-2 GPL-3 ) handbook? ( FDL-1.2+ )"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+DEPEND="
+       $(add_frameworks_dep kconfig)
+       $(add_frameworks_dep kconfigwidgets)
+       $(add_frameworks_dep kcoreaddons)
+       $(add_frameworks_dep ki18n)
+       $(add_frameworks_dep kio)
+       $(add_frameworks_dep kjobwidgets)
+       $(add_frameworks_dep kwidgetsaddons)
+       $(add_frameworks_dep kxmlgui)
+       $(add_kdeapps_dep libksane)
+       $(add_qt_dep qtgui)
+       $(add_qt_dep qtwidgets)
+       media-libs/libpng:0=
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}/${P}-cmake.patch"
+       "${FILESDIR}/${P}-hidpi.patch"
+)

Reply via email to