Gentoo Archives: gentoo-commits

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/kxstitch/, media-gfx/kxstitch/files/
Date: Wed, 15 Nov 2017 23:28:07
Message-Id: 1510788417.89d6a8e483252a7839cff515f8eed7e32c5aabe8.asturm@gentoo
1 commit: 89d6a8e483252a7839cff515f8eed7e32c5aabe8
2 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
3 AuthorDate: Wed Nov 15 22:02:01 2017 +0000
4 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
5 CommitDate: Wed Nov 15 23:26:57 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=89d6a8e4
7
8 media-gfx/kxstitch: Fix build w/ >=ImageMagick-7
9
10 Closes: https://bugs.gentoo.org/636998
11 Package-Manager: Portage-2.3.14, Repoman-2.3.6
12
13 .../files/kxstitch-2.0.0-imagemagick-7.patch | 93 ++++++++++++++++++++++
14 media-gfx/kxstitch/kxstitch-2.0.0.ebuild | 4 +-
15 2 files changed, 96 insertions(+), 1 deletion(-)
16
17 diff --git a/media-gfx/kxstitch/files/kxstitch-2.0.0-imagemagick-7.patch b/media-gfx/kxstitch/files/kxstitch-2.0.0-imagemagick-7.patch
18 new file mode 100644
19 index 00000000000..fe53efba302
20 --- /dev/null
21 +++ b/media-gfx/kxstitch/files/kxstitch-2.0.0-imagemagick-7.patch
22 @@ -0,0 +1,93 @@
23 +From 295773f44bfda1227d85edf065a8de14dc889159 Mon Sep 17 00:00:00 2001
24 +From: Steve Allewell <steve.allewell@×××××.com>
25 +Date: Wed, 25 Oct 2017 20:57:22 +0100
26 +Subject: Fix for changes to ImageMagick API for importing images
27 +
28 +---
29 + src/FlossScheme.cpp | 4 ++--
30 + src/ImportImageDlg.cpp | 9 ++++++---
31 + src/MainWindow.cpp | 10 ++++++----
32 + 3 files changed, 14 insertions(+), 9 deletions(-)
33 +
34 +diff --git a/src/FlossScheme.cpp b/src/FlossScheme.cpp
35 +index 4c59973..e4cd117 100644
36 +--- a/src/FlossScheme.cpp
37 ++++ b/src/FlossScheme.cpp
38 +@@ -38,8 +38,8 @@ Floss *FlossScheme::convert(const QColor &color)
39 + Magick::Image image = Magick::Image(1, 1, "RGB", MagickLib::CharPixel, c);
40 + #endif
41 + image.map(*m_map);
42 +- const Magick::PixelPacket *pixels = image.getConstPixels(0, 0, 1, 1);
43 +- const Magick::ColorRGB rgb = Magick::Color(*pixels);
44 ++
45 ++ const Magick::ColorRGB rgb = image.pixelColor(0,0);
46 +
47 + return find(QColor((int)(255*rgb.red()), (int)(255*rgb.green()), (int)(255*rgb.blue())));
48 + }
49 +diff --git a/src/ImportImageDlg.cpp b/src/ImportImageDlg.cpp
50 +index d12ca34..79e8c38 100644
51 +--- a/src/ImportImageDlg.cpp
52 ++++ b/src/ImportImageDlg.cpp
53 +@@ -305,9 +305,12 @@ void ImportImageDlg::renderPixmap()
54 + QProgressDialog progress(i18n("Rendering preview"), i18n("Cancel"), 0, pixelCount, this);
55 + progress.setWindowModality(Qt::WindowModal);
56 +
57 ++#if MagickLibVersion < 0x700
58 + bool hasTransparency = m_convertedImage.matte();
59 +- const Magick::PixelPacket *pixels = m_convertedImage.getConstPixels(0, 0, width, height);
60 +-
61 ++#else
62 ++ bool hasTransparency = m_convertedImage.alpha();
63 ++#endif
64 ++
65 + for (int dy = 0 ; dy < height ; dy++) {
66 + QApplication::processEvents();
67 + progress.setValue(dy * width);
68 +@@ -317,7 +320,7 @@ void ImportImageDlg::renderPixmap()
69 + }
70 +
71 + for (int dx = 0 ; dx < width ; dx++) {
72 +- Magick::ColorRGB rgb = Magick::Color(*pixels++);
73 ++ Magick::ColorRGB rgb = m_convertedImage.pixelColor(dx, dy);
74 +
75 + if (hasTransparency && (rgb.alpha() == 1)) {
76 + //ignore this pixel as it is transparent
77 +diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp
78 +index 9713293..1d22e63 100644
79 +--- a/src/MainWindow.cpp
80 ++++ b/src/MainWindow.cpp
81 +@@ -543,7 +543,11 @@ void MainWindow::convertImage(const QString &source)
82 +
83 + bool useFractionals = importImageDlg->useFractionals();
84 +
85 ++#if MagickLibVersion < 0x700
86 + bool hasTransparency = convertedImage.matte();
87 ++#else
88 ++ bool hasTransparency = convertedImage.alpha();
89 ++#endif
90 + bool ignoreColor = importImageDlg->ignoreColor();
91 + Magick::Color ignoreColorValue = importImageDlg->ignoreColorValue();
92 +
93 +@@ -564,8 +568,6 @@ void MainWindow::convertImage(const QString &source)
94 + QProgressDialog progress(i18n("Converting to stitches"), i18n("Cancel"), 0, pixelCount, this);
95 + progress.setWindowModality(Qt::WindowModal);
96 +
97 +- const Magick::PixelPacket *pixels = convertedImage.getConstPixels(0, 0, imageWidth, imageHeight);
98 +-
99 + for (int dy = 0 ; dy < imageHeight ; dy++) {
100 + progress.setValue(dy * imageWidth);
101 + QApplication::processEvents();
102 +@@ -577,8 +579,8 @@ void MainWindow::convertImage(const QString &source)
103 + }
104 +
105 + for (int dx = 0 ; dx < imageWidth ; dx++) {
106 +- Magick::ColorRGB rgb = Magick::Color(*pixels++);
107 +-
108 ++ Magick::ColorRGB rgb = convertedImage.pixelColor(dx, dy);
109 ++
110 + if (hasTransparency && (rgb.alpha() == 1)) {
111 + // ignore this pixel as it is transparent
112 + } else {
113 +--
114 +cgit v0.11.2
115 +
116
117 diff --git a/media-gfx/kxstitch/kxstitch-2.0.0.ebuild b/media-gfx/kxstitch/kxstitch-2.0.0.ebuild
118 index 32222fe706e..02fe8204fac 100644
119 --- a/media-gfx/kxstitch/kxstitch-2.0.0.ebuild
120 +++ b/media-gfx/kxstitch/kxstitch-2.0.0.ebuild
121 @@ -1,4 +1,4 @@
122 -# Copyright 1999-2016 Gentoo Foundation
123 +# Copyright 1999-2017 Gentoo Foundation
124 # Distributed under the terms of the GNU General Public License v2
125
126 EAPI=6
127 @@ -37,3 +37,5 @@ RDEPEND="
128 DEPEND="${RDEPEND}
129 sys-devel/gettext
130 "
131 +
132 +PATCHES=( "${FILESDIR}/${P}-imagemagick-7.patch" )