Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/djview/files/, app-text/djview/
Date: Sat, 09 Dec 2017 21:10:21
Message-Id: 1512853802.52cb69bbc073cac783662abb24e3b8215a2c68ff.asturm@gentoo
1 commit: 52cb69bbc073cac783662abb24e3b8215a2c68ff
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 9 20:54:46 2017 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 9 21:10:02 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=52cb69bb
7
8 app-text/djview: Fix icons on higher DPIs
9
10 Package-Manager: Portage-2.3.17, Repoman-2.3.6
11
12 app-text/djview/djview-4.10.6-r1.ebuild | 2 +
13 app-text/djview/files/djview-4.10.6-hidpi.patch | 68 +++++++++++++++++++++++++
14 2 files changed, 70 insertions(+)
15
16 diff --git a/app-text/djview/djview-4.10.6-r1.ebuild b/app-text/djview/djview-4.10.6-r1.ebuild
17 index 9765ecc6989..21340c90068 100644
18 --- a/app-text/djview/djview-4.10.6-r1.ebuild
19 +++ b/app-text/djview/djview-4.10.6-r1.ebuild
20 @@ -29,6 +29,8 @@ DEPEND="${RDEPEND}
21
22 DOCS=( README NEWS )
23
24 +PATCHES=( "${FILESDIR}/${P}-hidpi.patch" )
25 +
26 src_prepare() {
27 default
28
29
30 diff --git a/app-text/djview/files/djview-4.10.6-hidpi.patch b/app-text/djview/files/djview-4.10.6-hidpi.patch
31 new file mode 100644
32 index 00000000000..1063b4c5b82
33 --- /dev/null
34 +++ b/app-text/djview/files/djview-4.10.6-hidpi.patch
35 @@ -0,0 +1,68 @@
36 +commit 090398d4181797d2284be16026f8e0573fd0579b
37 +Author: Leon Bottou <leon@××××××.org>
38 +Date: Wed Mar 2 20:52:03 2016 -0500
39 +
40 + High dpi support for page thumbnails
41 +
42 +diff --git a/src/djview.cpp b/src/djview.cpp
43 +index 2571c49..df14110 100644
44 +--- a/src/djview.cpp
45 ++++ b/src/djview.cpp
46 +@@ -137,7 +137,12 @@ QDjViewApplication::QDjViewApplication(int &argc, char **argv)
47 + extern void qt_mac_set_native_menubar(bool);
48 + qt_mac_set_native_menubar(false);
49 + #endif
50 +-
51 ++
52 ++ // Enable highdpi pixmaps
53 ++#if QT_VERSION >= 0x50200
54 ++ setAttribute(Qt::AA_UseHighDpiPixmaps, true);
55 ++#endif
56 ++
57 + // Wire session management signals
58 + connect(this, SIGNAL(saveStateRequest(QSessionManager&)),
59 + this, SLOT(saveSessionState(QSessionManager&)) );
60 +diff --git a/src/qdjviewsidebar.cpp b/src/qdjviewsidebar.cpp
61 +index 38edf45..34e8c3c 100644
62 +--- a/src/qdjviewsidebar.cpp
63 ++++ b/src/qdjviewsidebar.cpp
64 +@@ -603,9 +603,14 @@ QDjViewThumbnails::Model::makeIcon(int pageno) const
65 + if (doc)
66 + {
67 + // render thumbnail
68 +- int w = size;
69 +- int h = size;
70 +- QImage img(size, size, QImage::Format_RGB32);
71 ++#if QT_VERSION >= 0x50200
72 ++ int dpr = djview->devicePixelRatio();
73 ++#else
74 ++ int dpr = 1;
75 ++#endif
76 ++ int w = size * dpr;
77 ++ int h = size * dpr;
78 ++ QImage img(size*dpr, size*dpr, QImage::Format_RGB32);
79 + int status = ddjvu_thumbnail_status(*doc, pageno, 0);
80 + if (status == DDJVU_JOB_NOTSTARTED)
81 + {
82 +@@ -614,9 +619,9 @@ QDjViewThumbnails::Model::makeIcon(int pageno) const
83 + else if (ddjvu_thumbnail_render(*doc, pageno, &w, &h, format,
84 + img.bytesPerLine(), (char*)img.bits() ))
85 + {
86 +- QPixmap pixmap(size,size);
87 ++ QPixmap pixmap(size*dpr,size*dpr);
88 + pixmap.fill();
89 +- QPoint dst((size-w)/2, (size-h)/2);
90 ++ QPoint dst((size*dpr-w)/2, (size*dpr-h)/2);
91 + QRect src(0,0,w,h);
92 + QPainter painter;
93 + painter.begin(&pixmap);
94 +@@ -625,6 +630,9 @@ QDjViewThumbnails::Model::makeIcon(int pageno) const
95 + painter.setPen(Qt::darkGray);
96 + painter.drawRect(dst.x(), dst.y(), w-1, h-1);
97 + painter.end();
98 ++#if QT_VERSION >= 0x50200
99 ++ pixmap.setDevicePixelRatio(dpr);
100 ++#endif
101 + return QIcon(pixmap);
102 + }
103 + }