Line 0
Link Here
|
|
|
1 |
Obtained from: Arch Linux |
2 |
https://git.archlinux.org/svntogit/packages.git/plain/trunk/poppler-fixes-from-master.patch?h=packages/inkscape |
3 |
|
4 |
From bee18ea9799e34aaf9141141f14384fd6b9cf7bd Mon Sep 17 00:00:00 2001 |
5 |
From: Eduard Braun <eduard.braun2@gmx.de> |
6 |
Date: Tue, 24 Apr 2018 19:18:26 +0200 |
7 |
Subject: [PATCH 1/4] Fix compilation with poppler 0.64 |
8 |
|
9 |
--- |
10 |
src/extension/internal/pdfinput/pdf-parser.cpp | 10 +++++----- |
11 |
src/extension/internal/pdfinput/pdf-parser.h | 2 +- |
12 |
src/extension/internal/pdfinput/svg-builder.cpp | 4 ++-- |
13 |
src/extension/internal/pdfinput/svg-builder.h | 3 +-- |
14 |
4 files changed, 9 insertions(+), 10 deletions(-) |
15 |
|
16 |
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp |
17 |
index 604b7f8079..721524e10a 100644 |
18 |
--- src/extension/internal/pdfinput/pdf-parser.cpp |
19 |
+++ src/extension/internal/pdfinput/pdf-parser.cpp |
20 |
@@ -2582,7 +2582,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) |
21 |
} |
22 |
} |
23 |
|
24 |
-void PdfParser::doShowText(GooString *s) { |
25 |
+void PdfParser::doShowText(const GooString *s) { |
26 |
GfxFont *font; |
27 |
int wMode; |
28 |
double riseX, riseY; |
29 |
@@ -2601,7 +2601,7 @@ void PdfParser::doShowText(GooString *s) { |
30 |
font = state->getFont(); |
31 |
wMode = font->getWMode(); |
32 |
|
33 |
- builder->beginString(state, s); |
34 |
+ builder->beginString(state); |
35 |
|
36 |
// handle a Type 3 char |
37 |
if (font->getType() == fontType3 && 0) {//out->interpretType3Chars()) { |
38 |
@@ -2631,7 +2631,7 @@ void PdfParser::doShowText(GooString *s) { |
39 |
double lineX = state->getLineX(); |
40 |
double lineY = state->getLineY(); |
41 |
oldParser = parser; |
42 |
- p = s->getCString(); |
43 |
+ p = g_strdup(s->getCString()); |
44 |
len = s->getLength(); |
45 |
while (len > 0) { |
46 |
n = font->getNextChar(p, len, &code, |
47 |
@@ -2686,7 +2686,7 @@ void PdfParser::doShowText(GooString *s) { |
48 |
|
49 |
} else { |
50 |
state->textTransformDelta(0, state->getRise(), &riseX, &riseY); |
51 |
- p = s->getCString(); |
52 |
+ p = g_strdup(s->getCString()); |
53 |
len = s->getLength(); |
54 |
while (len > 0) { |
55 |
n = font->getNextChar(p, len, &code, |
56 |
@@ -2732,7 +2732,7 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/) |
57 |
{ |
58 |
Object obj1, obj2, obj3, refObj; |
59 |
|
60 |
- char *name = args[0].getName(); |
61 |
+ char *name = g_strdup(args[0].getName()); |
62 |
#if defined(POPPLER_NEW_OBJECT_API) |
63 |
if ((obj1 = res->lookupXObject(name)).isNull()) { |
64 |
#else |
65 |
diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h |
66 |
index e28fecc2e1..f985b15cad 100644 |
67 |
--- src/extension/internal/pdfinput/pdf-parser.h |
68 |
+++ src/extension/internal/pdfinput/pdf-parser.h |
69 |
@@ -287,7 +287,7 @@ private: |
70 |
void opMoveShowText(Object args[], int numArgs); |
71 |
void opMoveSetShowText(Object args[], int numArgs); |
72 |
void opShowSpaceText(Object args[], int numArgs); |
73 |
- void doShowText(GooString *s); |
74 |
+ void doShowText(const GooString *s); |
75 |
|
76 |
// XObject operators |
77 |
void opXObject(Object args[], int numArgs); |
78 |
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp |
79 |
index a448be6397..617861928d 100644 |
80 |
--- src/extension/internal/pdfinput/svg-builder.cpp |
81 |
+++ src/extension/internal/pdfinput/svg-builder.cpp |
82 |
@@ -1020,7 +1020,7 @@ void SvgBuilder::updateFont(GfxState *state) { |
83 |
GfxFont *font = state->getFont(); |
84 |
// Store original name |
85 |
if (font->getName()) { |
86 |
- _font_specification = font->getName()->getCString(); |
87 |
+ _font_specification = g_strdup(font->getName()->getCString()); |
88 |
} else { |
89 |
_font_specification = (char*) "Arial"; |
90 |
} |
91 |
@@ -1361,7 +1361,7 @@ void SvgBuilder::_flushText() { |
92 |
_glyphs.clear(); |
93 |
} |
94 |
|
95 |
-void SvgBuilder::beginString(GfxState *state, GooString * /*s*/) { |
96 |
+void SvgBuilder::beginString(GfxState *state) { |
97 |
if (_need_font_update) { |
98 |
updateFont(state); |
99 |
} |
100 |
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h |
101 |
index ad15c9c06f..ed2a4d48e0 100644 |
102 |
--- src/extension/internal/pdfinput/svg-builder.h |
103 |
+++ src/extension/internal/pdfinput/svg-builder.h |
104 |
@@ -29,7 +29,6 @@ namespace Inkscape { |
105 |
#include <glibmm/ustring.h> |
106 |
|
107 |
#include "CharTypes.h" |
108 |
-class GooString; |
109 |
class Function; |
110 |
class GfxState; |
111 |
struct GfxColor; |
112 |
@@ -136,7 +135,7 @@ public: |
113 |
void clearSoftMask(GfxState *state); |
114 |
|
115 |
// Text handling |
116 |
- void beginString(GfxState *state, GooString *s); |
117 |
+ void beginString(GfxState *state); |
118 |
void endString(GfxState *state); |
119 |
void addChar(GfxState *state, double x, double y, |
120 |
double dx, double dy, |
121 |
-- |
122 |
2.19.1 |
123 |
|
124 |
|
125 |
From 60d37b26a344a749c0b2eda003c92bad7470ebba Mon Sep 17 00:00:00 2001 |
126 |
From: Jan Palus <atler@pld-linux.org> |
127 |
Date: Fri, 25 May 2018 00:30:17 +0200 |
128 |
Subject: [PATCH 2/4] Fix compilation with poppler 0.65.0 |
129 |
|
130 |
replace unused includes with one that is actually used |
131 |
|
132 |
Signed-off-by: Jan Palus <atler@pld-linux.org> |
133 |
--- |
134 |
src/extension/internal/pdfinput/pdf-parser.cpp | 3 +-- |
135 |
1 file changed, 1 insertion(+), 2 deletions(-) |
136 |
|
137 |
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp |
138 |
index 721524e10a..a3aa3213a1 100644 |
139 |
--- src/extension/internal/pdfinput/pdf-parser.cpp |
140 |
+++ src/extension/internal/pdfinput/pdf-parser.cpp |
141 |
@@ -37,8 +37,7 @@ extern "C" { |
142 |
#include "util/units.h" |
143 |
|
144 |
#include "goo/gmem.h" |
145 |
-#include "goo/GooTimer.h" |
146 |
-#include "goo/GooHash.h" |
147 |
+#include "goo/GooString.h" |
148 |
#include "GlobalParams.h" |
149 |
#include "CharTypes.h" |
150 |
#include "Object.h" |
151 |
-- |
152 |
2.19.1 |
153 |
|
154 |
|
155 |
From 20795fdf1314a2f0047d6834f290a92e493764c7 Mon Sep 17 00:00:00 2001 |
156 |
From: Eduard Braun <eduard.braun2@gmx.de> |
157 |
Date: Wed, 5 Sep 2018 00:31:06 +0200 |
158 |
Subject: [PATCH 3/4] Modified fix for compatibility with poppler 0.64 |
159 |
|
160 |
This is slightly uglier than a600c6438fef2f4c06f9a4a7d933d99fb054a973 |
161 |
but avoids duplicating strings (which is unnecessary and leaked memory). |
162 |
|
163 |
It's also closer to what upstream intended with the changes in 0.64. |
164 |
--- |
165 |
.../internal/pdfinput/pdf-parser.cpp | 19 ++++++++++++++++--- |
166 |
src/extension/internal/pdfinput/pdf-parser.h | 6 ++++++ |
167 |
.../internal/pdfinput/svg-builder.cpp | 6 +++--- |
168 |
src/extension/internal/pdfinput/svg-builder.h | 4 ++-- |
169 |
4 files changed, 27 insertions(+), 8 deletions(-) |
170 |
|
171 |
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp |
172 |
index a3aa3213a1..ea9f902e09 100644 |
173 |
--- src/extension/internal/pdfinput/pdf-parser.cpp |
174 |
+++ src/extension/internal/pdfinput/pdf-parser.cpp |
175 |
@@ -36,6 +36,7 @@ extern "C" { |
176 |
#include "pdf-parser.h" |
177 |
#include "util/units.h" |
178 |
|
179 |
+#include "glib/poppler-features.h" |
180 |
#include "goo/gmem.h" |
181 |
#include "goo/GooString.h" |
182 |
#include "GlobalParams.h" |
183 |
@@ -2581,7 +2582,11 @@ void PdfParser::opShowSpaceText(Object args[], int /*numArgs*/) |
184 |
} |
185 |
} |
186 |
|
187 |
+#if POPPLER_CHECK_VERSION(0,64,0) |
188 |
void PdfParser::doShowText(const GooString *s) { |
189 |
+#else |
190 |
+void PdfParser::doShowText(GooString *s) { |
191 |
+#endif |
192 |
GfxFont *font; |
193 |
int wMode; |
194 |
double riseX, riseY; |
195 |
@@ -2594,7 +2599,11 @@ void PdfParser::doShowText(const GooString *s) { |
196 |
Object charProc; |
197 |
Dict *resDict; |
198 |
Parser *oldParser; |
199 |
+#if POPPLER_CHECK_VERSION(0,64,0) |
200 |
+ const char *p; |
201 |
+#else |
202 |
char *p; |
203 |
+#endif |
204 |
int len, n, uLen; |
205 |
|
206 |
font = state->getFont(); |
207 |
@@ -2630,7 +2639,7 @@ void PdfParser::doShowText(const GooString *s) { |
208 |
double lineX = state->getLineX(); |
209 |
double lineY = state->getLineY(); |
210 |
oldParser = parser; |
211 |
- p = g_strdup(s->getCString()); |
212 |
+ p = s->getCString(); |
213 |
len = s->getLength(); |
214 |
while (len > 0) { |
215 |
n = font->getNextChar(p, len, &code, |
216 |
@@ -2685,7 +2694,7 @@ void PdfParser::doShowText(const GooString *s) { |
217 |
|
218 |
} else { |
219 |
state->textTransformDelta(0, state->getRise(), &riseX, &riseY); |
220 |
- p = g_strdup(s->getCString()); |
221 |
+ p = s->getCString(); |
222 |
len = s->getLength(); |
223 |
while (len > 0) { |
224 |
n = font->getNextChar(p, len, &code, |
225 |
@@ -2731,7 +2740,11 @@ void PdfParser::opXObject(Object args[], int /*numArgs*/) |
226 |
{ |
227 |
Object obj1, obj2, obj3, refObj; |
228 |
|
229 |
- char *name = g_strdup(args[0].getName()); |
230 |
+#if POPPLER_CHECK_VERSION(0,64,0) |
231 |
+ const char *name = args[0].getName(); |
232 |
+#else |
233 |
+ char *name = args[0].getName(); |
234 |
+#endif |
235 |
#if defined(POPPLER_NEW_OBJECT_API) |
236 |
if ((obj1 = res->lookupXObject(name)).isNull()) { |
237 |
#else |
238 |
diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h |
239 |
index f985b15cad..ed28274f42 100644 |
240 |
--- src/extension/internal/pdfinput/pdf-parser.h |
241 |
+++ src/extension/internal/pdfinput/pdf-parser.h |
242 |
@@ -25,6 +25,7 @@ namespace Inkscape { |
243 |
// TODO clean up and remove using: |
244 |
using Inkscape::Extension::Internal::SvgBuilder; |
245 |
|
246 |
+#include "glib/poppler-features.h" |
247 |
#include "goo/gtypes.h" |
248 |
#include "Object.h" |
249 |
|
250 |
@@ -287,7 +288,12 @@ private: |
251 |
void opMoveShowText(Object args[], int numArgs); |
252 |
void opMoveSetShowText(Object args[], int numArgs); |
253 |
void opShowSpaceText(Object args[], int numArgs); |
254 |
+#if POPPLER_CHECK_VERSION(0,64,0) |
255 |
void doShowText(const GooString *s); |
256 |
+#else |
257 |
+ void doShowText(GooString *s); |
258 |
+#endif |
259 |
+ |
260 |
|
261 |
// XObject operators |
262 |
void opXObject(Object args[], int numArgs); |
263 |
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp |
264 |
index 617861928d..767c8af4d4 100644 |
265 |
--- src/extension/internal/pdfinput/svg-builder.cpp |
266 |
+++ src/extension/internal/pdfinput/svg-builder.cpp |
267 |
@@ -1020,9 +1020,9 @@ void SvgBuilder::updateFont(GfxState *state) { |
268 |
GfxFont *font = state->getFont(); |
269 |
// Store original name |
270 |
if (font->getName()) { |
271 |
- _font_specification = g_strdup(font->getName()->getCString()); |
272 |
+ _font_specification = font->getName()->getCString(); |
273 |
} else { |
274 |
- _font_specification = (char*) "Arial"; |
275 |
+ _font_specification = "Arial"; |
276 |
} |
277 |
|
278 |
// Prune the font name to get the correct font family name |
279 |
@@ -1030,7 +1030,7 @@ void SvgBuilder::updateFont(GfxState *state) { |
280 |
char *font_family = NULL; |
281 |
char *font_style = NULL; |
282 |
char *font_style_lowercase = NULL; |
283 |
- char *plus_sign = strstr(_font_specification, "+"); |
284 |
+ const char *plus_sign = strstr(_font_specification, "+"); |
285 |
if (plus_sign) { |
286 |
font_family = g_strdup(plus_sign + 1); |
287 |
_font_specification = plus_sign + 1; |
288 |
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h |
289 |
index ed2a4d48e0..55daacee74 100644 |
290 |
--- src/extension/internal/pdfinput/svg-builder.h |
291 |
+++ src/extension/internal/pdfinput/svg-builder.h |
292 |
@@ -80,7 +80,7 @@ struct SvgGlyph { |
293 |
bool style_changed; // Set to true if style has to be reset |
294 |
SPCSSAttr *style; |
295 |
int render_mode; // Text render mode |
296 |
- char *font_specification; // Pointer to current font specification |
297 |
+ const char *font_specification; // Pointer to current font specification |
298 |
}; |
299 |
|
300 |
/** |
301 |
@@ -202,7 +202,7 @@ private: |
302 |
|
303 |
SPCSSAttr *_font_style; // Current font style |
304 |
GfxFont *_current_font; |
305 |
- char *_font_specification; |
306 |
+ const char *_font_specification; |
307 |
double _font_scaling; |
308 |
bool _need_font_update; |
309 |
Geom::Affine _text_matrix; |
310 |
-- |
311 |
2.19.1 |
312 |
|
313 |
|
314 |
From bc2b40c17dc4fdbb90675b6dc80e30e7e08c4488 Mon Sep 17 00:00:00 2001 |
315 |
From: Thomas Holder <thomas@thomas-holder.de> |
316 |
Date: Fri, 28 Sep 2018 18:05:30 +0000 |
317 |
Subject: [PATCH 4/4] fix 1789208 poppler 0.69 |
318 |
|
319 |
--- |
320 |
CMakeScripts/DefineDependsandFlags.cmake | 12 ----- |
321 |
src/extension/internal/pdfinput/pdf-input.cpp | 2 +- |
322 |
src/extension/internal/pdfinput/pdf-input.h | 1 + |
323 |
.../internal/pdfinput/pdf-parser.cpp | 46 ++++++++----------- |
324 |
src/extension/internal/pdfinput/pdf-parser.h | 12 +++-- |
325 |
.../pdfinput/poppler-transition-api.h | 39 ++++++++++++++++ |
326 |
.../internal/pdfinput/svg-builder.cpp | 22 ++++----- |
327 |
src/extension/internal/pdfinput/svg-builder.h | 3 +- |
328 |
8 files changed, 80 insertions(+), 57 deletions(-) |
329 |
create mode 100644 src/extension/internal/pdfinput/poppler-transition-api.h |
330 |
|
331 |
diff --git a/CMakeScripts/DefineDependsandFlags.cmake b/CMakeScripts/DefineDependsandFlags.cmake |
332 |
index c33a3bfb5e..fa67f67714 100644 |
333 |
--- CMakeScripts/DefineDependsandFlags.cmake |
334 |
+++ CMakeScripts/DefineDependsandFlags.cmake |
335 |
@@ -116,18 +116,6 @@ if(ENABLE_POPPLER) |
336 |
set(HAVE_POPPLER_GLIB ON) |
337 |
endif() |
338 |
endif() |
339 |
- if(POPPLER_VERSION VERSION_GREATER "0.26.0" OR |
340 |
- POPPLER_VERSION VERSION_EQUAL "0.26.0") |
341 |
- set(POPPLER_EVEN_NEWER_COLOR_SPACE_API ON) |
342 |
- endif() |
343 |
- if(POPPLER_VERSION VERSION_GREATER "0.29.0" OR |
344 |
- POPPLER_VERSION VERSION_EQUAL "0.29.0") |
345 |
- set(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API ON) |
346 |
- endif() |
347 |
- if(POPPLER_VERSION VERSION_GREATER "0.58.0" OR |
348 |
- POPPLER_VERSION VERSION_EQUAL "0.58.0") |
349 |
- set(POPPLER_NEW_OBJECT_API ON) |
350 |
- endif() |
351 |
else() |
352 |
set(ENABLE_POPPLER_CAIRO OFF) |
353 |
endif() |
354 |
diff --git a/src/extension/internal/pdfinput/pdf-input.cpp b/src/extension/internal/pdfinput/pdf-input.cpp |
355 |
index e3115620e3..9621e306a0 100644 |
356 |
--- src/extension/internal/pdfinput/pdf-input.cpp |
357 |
+++ src/extension/internal/pdfinput/pdf-input.cpp |
358 |
@@ -793,7 +793,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, const gchar * uri) { |
359 |
dlg->getImportSettings(prefs); |
360 |
|
361 |
// Apply crop settings |
362 |
- PDFRectangle *clipToBox = NULL; |
363 |
+ _POPPLER_CONST PDFRectangle *clipToBox = NULL; |
364 |
double crop_setting; |
365 |
sp_repr_get_double(prefs, "cropTo", &crop_setting); |
366 |
|
367 |
diff --git a/src/extension/internal/pdfinput/pdf-input.h b/src/extension/internal/pdfinput/pdf-input.h |
368 |
index 6e36603c31..73bbfe2a71 100644 |
369 |
--- src/extension/internal/pdfinput/pdf-input.h |
370 |
+++ src/extension/internal/pdfinput/pdf-input.h |
371 |
@@ -15,6 +15,7 @@ |
372 |
#endif |
373 |
|
374 |
#ifdef HAVE_POPPLER |
375 |
+#include "poppler-transition-api.h" |
376 |
|
377 |
#include <gtkmm/dialog.h> |
378 |
|
379 |
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp |
380 |
index ea9f902e09..4a7fd8a5e5 100644 |
381 |
--- src/extension/internal/pdfinput/pdf-parser.cpp |
382 |
+++ src/extension/internal/pdfinput/pdf-parser.cpp |
383 |
@@ -295,8 +295,8 @@ PdfParser::PdfParser(XRef *xrefA, |
384 |
int /*pageNum*/, |
385 |
int rotate, |
386 |
Dict *resDict, |
387 |
- PDFRectangle *box, |
388 |
- PDFRectangle *cropBox) : |
389 |
+ _POPPLER_CONST PDFRectangle *box, |
390 |
+ _POPPLER_CONST PDFRectangle *cropBox) : |
391 |
xref(xrefA), |
392 |
builder(builderA), |
393 |
subPage(gFalse), |
394 |
@@ -318,7 +318,7 @@ PdfParser::PdfParser(XRef *xrefA, |
395 |
builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"), |
396 |
Inkscape::Util::Quantity::convert(state->getPageHeight(), "pt", "px")); |
397 |
|
398 |
- double *ctm = state->getCTM(); |
399 |
+ const double *ctm = state->getCTM(); |
400 |
double scaledCTM[6]; |
401 |
for (int i = 0; i < 6; ++i) { |
402 |
baseMatrix[i] = ctm[i]; |
403 |
@@ -353,7 +353,7 @@ PdfParser::PdfParser(XRef *xrefA, |
404 |
PdfParser::PdfParser(XRef *xrefA, |
405 |
Inkscape::Extension::Internal::SvgBuilder *builderA, |
406 |
Dict *resDict, |
407 |
- PDFRectangle *box) : |
408 |
+ _POPPLER_CONST PDFRectangle *box) : |
409 |
xref(xrefA), |
410 |
builder(builderA), |
411 |
subPage(gTrue), |
412 |
@@ -572,7 +572,7 @@ const char *PdfParser::getPreviousOperator(unsigned int look_back) { |
413 |
|
414 |
void PdfParser::execOp(Object *cmd, Object args[], int numArgs) { |
415 |
PdfOperator *op; |
416 |
- char *name; |
417 |
+ const char *name; |
418 |
Object *argPtr; |
419 |
int i; |
420 |
|
421 |
@@ -620,7 +620,7 @@ void PdfParser::execOp(Object *cmd, Object args[], int numArgs) { |
422 |
(this->*op->func)(argPtr, numArgs); |
423 |
} |
424 |
|
425 |
-PdfOperator* PdfParser::findOp(char *name) { |
426 |
+PdfOperator* PdfParser::findOp(const char *name) { |
427 |
int a = -1; |
428 |
int b = numOps; |
429 |
int cmp = -1; |
430 |
@@ -1752,7 +1752,7 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat, |
431 |
GBool stroke, GBool eoFill) { |
432 |
GfxShading *shading; |
433 |
GfxPath *savedPath; |
434 |
- double *ctm, *btm, *ptm; |
435 |
+ const double *ctm, *btm, *ptm; |
436 |
double m[6], ictm[6], m1[6]; |
437 |
double xMin, yMin, xMax, yMax; |
438 |
double det; |
439 |
@@ -1994,7 +1994,7 @@ void PdfParser::doFunctionShFill1(GfxFunctionShading *shading, |
440 |
GfxColor color0M, color1M, colorM0, colorM1, colorMM; |
441 |
GfxColor colors2[4]; |
442 |
double functionColorDelta = colorDeltas[pdfFunctionShading-1]; |
443 |
- double *matrix; |
444 |
+ const double *matrix; |
445 |
double xM, yM; |
446 |
int nComps, i, j; |
447 |
|
448 |
@@ -2174,7 +2174,7 @@ void PdfParser::doPatchMeshShFill(GfxPatchMeshShading *shading) { |
449 |
} |
450 |
} |
451 |
|
452 |
-void PdfParser::fillPatch(GfxPatch *patch, int nComps, int depth) { |
453 |
+void PdfParser::fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth) { |
454 |
GfxPatch patch00 = blankPatch(); |
455 |
GfxPatch patch01 = blankPatch(); |
456 |
GfxPatch patch10 = blankPatch(); |
457 |
@@ -2595,7 +2595,7 @@ void PdfParser::doShowText(GooString *s) { |
458 |
double x, y, dx, dy, tdx, tdy; |
459 |
double originX, originY, tOriginX, tOriginY; |
460 |
double oldCTM[6], newCTM[6]; |
461 |
- double *mat; |
462 |
+ const double *mat; |
463 |
Object charProc; |
464 |
Dict *resDict; |
465 |
Parser *oldParser; |
466 |
@@ -3669,7 +3669,6 @@ void PdfParser::opBeginImage(Object /*args*/[], int /*numArgs*/) |
467 |
Stream *PdfParser::buildImageStream() { |
468 |
Object dict; |
469 |
Object obj; |
470 |
- char *key; |
471 |
Stream *str; |
472 |
|
473 |
// build dictionary |
474 |
@@ -3687,26 +3686,17 @@ Stream *PdfParser::buildImageStream() { |
475 |
obj.free(); |
476 |
#endif |
477 |
} else { |
478 |
- key = copyString(obj.getName()); |
479 |
-#if defined(POPPLER_NEW_OBJECT_API) |
480 |
- obj = parser->getObj(); |
481 |
-#else |
482 |
- obj.free(); |
483 |
- parser->getObj(&obj); |
484 |
-#endif |
485 |
- if (obj.isEOF() || obj.isError()) { |
486 |
- gfree(key); |
487 |
+ Object obj2; |
488 |
+ _POPPLER_CALL(obj2, parser->getObj); |
489 |
+ if (obj2.isEOF() || obj2.isError()) { |
490 |
+ _POPPLER_FREE(obj); |
491 |
break; |
492 |
} |
493 |
-#if defined(POPPLER_NEW_OBJECT_API) |
494 |
- dict.dictAdd(key, std::move(obj)); |
495 |
+ _POPPLER_DICTADD(dict, obj.getName(), obj2); |
496 |
+ _POPPLER_FREE(obj); |
497 |
+ _POPPLER_FREE(obj2); |
498 |
} |
499 |
- obj = parser->getObj(); |
500 |
-#else |
501 |
- dict.dictAdd(key, &obj); |
502 |
- } |
503 |
- parser->getObj(&obj); |
504 |
-#endif |
505 |
+ _POPPLER_CALL(obj, parser->getObj); |
506 |
} |
507 |
if (obj.isEOF()) { |
508 |
error(errSyntaxError, getPos(), "End of file in inline image"); |
509 |
diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h |
510 |
index ed28274f42..0a04c81d46 100644 |
511 |
--- src/extension/internal/pdfinput/pdf-parser.h |
512 |
+++ src/extension/internal/pdfinput/pdf-parser.h |
513 |
@@ -9,6 +9,7 @@ |
514 |
#define PDF_PARSER_H |
515 |
|
516 |
#ifdef HAVE_POPPLER |
517 |
+#include "poppler-transition-api.h" |
518 |
|
519 |
#ifdef USE_GCC_PRAGMAS |
520 |
#pragma interface |
521 |
@@ -128,11 +129,14 @@ public: |
522 |
|
523 |
// Constructor for regular output. |
524 |
PdfParser(XRef *xrefA, SvgBuilder *builderA, int pageNum, int rotate, |
525 |
- Dict *resDict, PDFRectangle *box, PDFRectangle *cropBox); |
526 |
+ Dict *resDict, |
527 |
+ _POPPLER_CONST PDFRectangle *box, |
528 |
+ _POPPLER_CONST PDFRectangle *cropBox); |
529 |
|
530 |
// Constructor for a sub-page object. |
531 |
PdfParser(XRef *xrefA, Inkscape::Extension::Internal::SvgBuilder *builderA, |
532 |
- Dict *resDict, PDFRectangle *box); |
533 |
+ Dict *resDict, |
534 |
+ _POPPLER_CONST PDFRectangle *box); |
535 |
|
536 |
virtual ~PdfParser(); |
537 |
|
538 |
@@ -186,7 +190,7 @@ private: |
539 |
|
540 |
void go(GBool topLevel); |
541 |
void execOp(Object *cmd, Object args[], int numArgs); |
542 |
- PdfOperator *findOp(char *name); |
543 |
+ PdfOperator *findOp(const char *name); |
544 |
GBool checkArg(Object *arg, TchkType type); |
545 |
int getPos(); |
546 |
|
547 |
@@ -257,7 +261,7 @@ private: |
548 |
double x2, double y2, GfxColor *color2, |
549 |
int nComps, int depth); |
550 |
void doPatchMeshShFill(GfxPatchMeshShading *shading); |
551 |
- void fillPatch(GfxPatch *patch, int nComps, int depth); |
552 |
+ void fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth); |
553 |
void doEndPath(); |
554 |
|
555 |
// path clipping operators |
556 |
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h |
557 |
new file mode 100644 |
558 |
index 0000000000..898e64bf2b |
559 |
--- /dev/null |
560 |
+++ src/extension/internal/pdfinput/poppler-transition-api.h |
561 |
@@ -0,0 +1,39 @@ |
562 |
+#ifndef SEEN_POPPLER_TRANSITION_API_H |
563 |
+#define SEEN_POPPLER_TRANSITION_API_H |
564 |
+ |
565 |
+#include <glib/poppler-features.h> |
566 |
+ |
567 |
+#if POPPLER_CHECK_VERSION(0,70,0) |
568 |
+#define _POPPLER_CONST const |
569 |
+#else |
570 |
+#define _POPPLER_CONST |
571 |
+#endif |
572 |
+ |
573 |
+#if POPPLER_CHECK_VERSION(0,69,0) |
574 |
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(key, std::move(obj)) |
575 |
+#elif POPPLER_CHECK_VERSION(0,58,0) |
576 |
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), std::move(obj)) |
577 |
+#else |
578 |
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), &obj) |
579 |
+#endif |
580 |
+ |
581 |
+#if POPPLER_CHECK_VERSION(0,58,0) |
582 |
+#define POPPLER_NEW_OBJECT_API |
583 |
+#define _POPPLER_FREE(obj) |
584 |
+#define _POPPLER_CALL(ret, func) (ret = func()) |
585 |
+#define _POPPLER_CALL_ARGS(ret, func, ...) (ret = func(__VA_ARGS__)) |
586 |
+#else |
587 |
+#define _POPPLER_FREE(obj) (obj).free() |
588 |
+#define _POPPLER_CALL(ret, func) (*func(&ret)) |
589 |
+#define _POPPLER_CALL_ARGS(ret, func, ...) (*func(__VA_ARGS__, &ret)) |
590 |
+#endif |
591 |
+ |
592 |
+#if POPPLER_CHECK_VERSION(0, 29, 0) |
593 |
+#define POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API |
594 |
+#endif |
595 |
+ |
596 |
+#if POPPLER_CHECK_VERSION(0, 25, 0) |
597 |
+#define POPPLER_EVEN_NEWER_COLOR_SPACE_API |
598 |
+#endif |
599 |
+ |
600 |
+#endif |
601 |
diff --git a/src/extension/internal/pdfinput/svg-builder.cpp b/src/extension/internal/pdfinput/svg-builder.cpp |
602 |
index 767c8af4d4..d449d1af52 100644 |
603 |
--- src/extension/internal/pdfinput/svg-builder.cpp |
604 |
+++ src/extension/internal/pdfinput/svg-builder.cpp |
605 |
@@ -625,7 +625,7 @@ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, GfxState *state, bool is_ |
606 |
if ( pattern != NULL ) { |
607 |
if ( pattern->getType() == 2 ) { // Shading pattern |
608 |
GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); |
609 |
- double *ptm; |
610 |
+ const double *ptm; |
611 |
double m[6] = {1, 0, 0, 1, 0, 0}; |
612 |
double det; |
613 |
|
614 |
@@ -672,7 +672,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, |
615 |
|
616 |
Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern"); |
617 |
// Set pattern transform matrix |
618 |
- double *p2u = tiling_pattern->getMatrix(); |
619 |
+ const double *p2u = tiling_pattern->getMatrix(); |
620 |
double m[6] = {1, 0, 0, 1, 0, 0}; |
621 |
double det; |
622 |
det = _ttm[0] * _ttm[3] - _ttm[1] * _ttm[2]; // see LP Bug 1168908 |
623 |
@@ -698,7 +698,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, |
624 |
pattern_node->setAttribute("patternUnits", "userSpaceOnUse"); |
625 |
// Set pattern tiling |
626 |
// FIXME: don't ignore XStep and YStep |
627 |
- double *bbox = tiling_pattern->getBBox(); |
628 |
+ const double *bbox = tiling_pattern->getBBox(); |
629 |
sp_repr_set_svg_double(pattern_node, "x", 0.0); |
630 |
sp_repr_set_svg_double(pattern_node, "y", 0.0); |
631 |
sp_repr_set_svg_double(pattern_node, "width", bbox[2] - bbox[0]); |
632 |
@@ -751,7 +751,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPattern *tiling_pattern, |
633 |
*/ |
634 |
gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for_shading) { |
635 |
Inkscape::XML::Node *gradient; |
636 |
- Function *func; |
637 |
+ _POPPLER_CONST Function *func; |
638 |
int num_funcs; |
639 |
bool extend0, extend1; |
640 |
|
641 |
@@ -865,7 +865,7 @@ static bool svgGetShadingColorRGB(GfxShading *shading, double offset, GfxRGB *re |
642 |
|
643 |
#define INT_EPSILON 8 |
644 |
bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading, |
645 |
- Function *func) { |
646 |
+ _POPPLER_CONST Function *func) { |
647 |
int type = func->getType(); |
648 |
if ( type == 0 || type == 2 ) { // Sampled or exponential function |
649 |
GfxRGB stop1, stop2; |
650 |
@@ -877,9 +877,9 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh |
651 |
_addStopToGradient(gradient, 1.0, &stop2, 1.0); |
652 |
} |
653 |
} else if ( type == 3 ) { // Stitching |
654 |
- StitchingFunction *stitchingFunc = static_cast<StitchingFunction*>(func); |
655 |
- double *bounds = stitchingFunc->getBounds(); |
656 |
- double *encode = stitchingFunc->getEncode(); |
657 |
+ auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func); |
658 |
+ const double *bounds = stitchingFunc->getBounds(); |
659 |
+ const double *encode = stitchingFunc->getEncode(); |
660 |
int num_funcs = stitchingFunc->getNumFuncs(); |
661 |
|
662 |
// Add stops from all the stitched functions |
663 |
@@ -890,7 +890,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *sh |
664 |
svgGetShadingColorRGB(shading, bounds[i + 1], &color); |
665 |
// Add stops |
666 |
if (stitchingFunc->getFunc(i)->getType() == 2) { // process exponential fxn |
667 |
- double expE = (static_cast<ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE(); |
668 |
+ double expE = (static_cast<_POPPLER_CONST ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE(); |
669 |
if (expE > 1.0) { |
670 |
expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1 |
671 |
if (encode[2*i] == 0) { // normal sequence |
672 |
@@ -1148,7 +1148,7 @@ void SvgBuilder::updateFont(GfxState *state) { |
673 |
Inkscape::CSSOStringStream os_font_size; |
674 |
double css_font_size = _font_scaling * state->getFontSize(); |
675 |
if ( font->getType() == fontType3 ) { |
676 |
- double *font_matrix = font->getFontMatrix(); |
677 |
+ const double *font_matrix = font->getFontMatrix(); |
678 |
if ( font_matrix[0] != 0.0 ) { |
679 |
css_font_size *= font_matrix[3] / font_matrix[0]; |
680 |
} |
681 |
@@ -1193,7 +1193,7 @@ void SvgBuilder::updateTextPosition(double tx, double ty) { |
682 |
void SvgBuilder::updateTextMatrix(GfxState *state) { |
683 |
_flushText(); |
684 |
// Update text matrix |
685 |
- double *text_matrix = state->getTextMat(); |
686 |
+ const double *text_matrix = state->getTextMat(); |
687 |
double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] ); |
688 |
double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] ); |
689 |
double max_scale; |
690 |
diff --git a/src/extension/internal/pdfinput/svg-builder.h b/src/extension/internal/pdfinput/svg-builder.h |
691 |
index 55daacee74..34b42e17b8 100644 |
692 |
--- src/extension/internal/pdfinput/svg-builder.h |
693 |
+++ src/extension/internal/pdfinput/svg-builder.h |
694 |
@@ -15,6 +15,7 @@ |
695 |
#endif |
696 |
|
697 |
#ifdef HAVE_POPPLER |
698 |
+#include "poppler-transition-api.h" |
699 |
|
700 |
class SPDocument; |
701 |
namespace Inkscape { |
702 |
@@ -174,7 +175,7 @@ private: |
703 |
void _addStopToGradient(Inkscape::XML::Node *gradient, double offset, |
704 |
GfxRGB *color, double opacity); |
705 |
bool _addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading, |
706 |
- Function *func); |
707 |
+ _POPPLER_CONST Function *func); |
708 |
gchar *_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxState *state, |
709 |
bool is_stroke=false); |
710 |
// Image/mask creation |
711 |
-- |
712 |
2.19.1 |
713 |
|