Line 0
Link Here
|
|
|
1 |
--- CMakeScripts/DefineDependsandFlags.cmake.orig 2018-03-11 20:38:09 UTC |
2 |
+++ CMakeScripts/DefineDependsandFlags.cmake |
3 |
@@ -116,18 +116,6 @@ if(ENABLE_POPPLER) |
4 |
set(HAVE_POPPLER_GLIB ON) |
5 |
endif() |
6 |
endif() |
7 |
- if(POPPLER_VERSION VERSION_GREATER "0.26.0" OR |
8 |
- POPPLER_VERSION VERSION_EQUAL "0.26.0") |
9 |
- set(POPPLER_EVEN_NEWER_COLOR_SPACE_API ON) |
10 |
- endif() |
11 |
- if(POPPLER_VERSION VERSION_GREATER "0.29.0" OR |
12 |
- POPPLER_VERSION VERSION_EQUAL "0.29.0") |
13 |
- set(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API ON) |
14 |
- endif() |
15 |
- if(POPPLER_VERSION VERSION_GREATER "0.58.0" OR |
16 |
- POPPLER_VERSION VERSION_EQUAL "0.58.0") |
17 |
- set(POPPLER_NEW_OBJECT_API ON) |
18 |
- endif() |
19 |
else() |
20 |
set(ENABLE_POPPLER_CAIRO OFF) |
21 |
endif() |
22 |
--- src/extension/internal/pdfinput/pdf-input.cpp.orig 2018-03-11 20:38:09 UTC |
23 |
+++ src/extension/internal/pdfinput/pdf-input.cpp |
24 |
@@ -319,7 +319,7 @@ PdfImportDialog::PdfImportDialog(PDFDoc *doc, const gc |
25 |
_render_thumb = true; |
26 |
|
27 |
// Create PopplerDocument |
28 |
- Glib::ustring filename = _pdf_doc->getFileName()->getCString(); |
29 |
+ Glib::ustring filename = _pdf_doc->getFileName()->c_str(); |
30 |
if (!Glib::path_is_absolute(filename)) { |
31 |
filename = Glib::build_filename(Glib::get_current_dir(),filename); |
32 |
} |
33 |
@@ -793,7 +793,7 @@ PdfInput::open(::Inkscape::Extension::Input * /*mod*/, |
34 |
dlg->getImportSettings(prefs); |
35 |
|
36 |
// Apply crop settings |
37 |
- PDFRectangle *clipToBox = NULL; |
38 |
+ _POPPLER_CONST PDFRectangle *clipToBox = NULL; |
39 |
double crop_setting; |
40 |
sp_repr_get_double(prefs, "cropTo", &crop_setting); |
41 |
|
42 |
--- src/extension/internal/pdfinput/pdf-input.h.orig 2018-03-11 20:38:09 UTC |
43 |
+++ src/extension/internal/pdfinput/pdf-input.h |
44 |
@@ -15,6 +15,7 @@ |
45 |
#endif |
46 |
|
47 |
#ifdef HAVE_POPPLER |
48 |
+#include "poppler-transition-api.h" |
49 |
|
50 |
#include <gtkmm/dialog.h> |
51 |
|
52 |
--- src/extension/internal/pdfinput/pdf-parser.cpp.orig 2018-03-11 20:38:09 UTC |
53 |
+++ src/extension/internal/pdfinput/pdf-parser.cpp |
54 |
@@ -38,7 +38,6 @@ extern "C" { |
55 |
|
56 |
#include "goo/gmem.h" |
57 |
#include "goo/GooTimer.h" |
58 |
-#include "goo/GooHash.h" |
59 |
#include "GlobalParams.h" |
60 |
#include "CharTypes.h" |
61 |
#include "Object.h" |
62 |
@@ -271,7 +270,7 @@ class ClipHistoryEntry { (public) |
63 |
// Manipulate clip path stack |
64 |
ClipHistoryEntry *save(); |
65 |
ClipHistoryEntry *restore(); |
66 |
- GBool hasSaves() { return saved != NULL; } |
67 |
+ bool hasSaves() { return saved != NULL; } |
68 |
void setClip(GfxPath *newClipPath, GfxClipType newClipType = clipNormal); |
69 |
GfxPath *getClipPath() { return clipPath; } |
70 |
GfxClipType getClipType() { return clipType; } |
71 |
@@ -295,15 +294,15 @@ PdfParser::PdfParser(XRef *xrefA, |
72 |
int /*pageNum*/, |
73 |
int rotate, |
74 |
Dict *resDict, |
75 |
- PDFRectangle *box, |
76 |
- PDFRectangle *cropBox) : |
77 |
+ _POPPLER_CONST PDFRectangle *box, |
78 |
+ _POPPLER_CONST PDFRectangle *cropBox) : |
79 |
xref(xrefA), |
80 |
builder(builderA), |
81 |
- subPage(gFalse), |
82 |
+ subPage(false), |
83 |
printCommands(false), |
84 |
res(new GfxResources(xref, resDict, NULL)), // start the resource stack |
85 |
- state(new GfxState(72.0, 72.0, box, rotate, gTrue)), |
86 |
- fontChanged(gFalse), |
87 |
+ state(new GfxState(72.0, 72.0, box, rotate, true)), |
88 |
+ fontChanged(false), |
89 |
clip(clipNone), |
90 |
ignoreUndef(0), |
91 |
baseMatrix(), |
92 |
@@ -318,7 +317,7 @@ PdfParser::PdfParser(XRef *xrefA, |
93 |
builder->setDocumentSize(Inkscape::Util::Quantity::convert(state->getPageWidth(), "pt", "px"), |
94 |
Inkscape::Util::Quantity::convert(state->getPageHeight(), "pt", "px")); |
95 |
|
96 |
- double *ctm = state->getCTM(); |
97 |
+ const double *ctm = state->getCTM(); |
98 |
double scaledCTM[6]; |
99 |
for (int i = 0; i < 6; ++i) { |
100 |
baseMatrix[i] = ctm[i]; |
101 |
@@ -353,14 +352,14 @@ PdfParser::PdfParser(XRef *xrefA, |
102 |
PdfParser::PdfParser(XRef *xrefA, |
103 |
Inkscape::Extension::Internal::SvgBuilder *builderA, |
104 |
Dict *resDict, |
105 |
- PDFRectangle *box) : |
106 |
+ _POPPLER_CONST PDFRectangle *box) : |
107 |
xref(xrefA), |
108 |
builder(builderA), |
109 |
- subPage(gTrue), |
110 |
+ subPage(true), |
111 |
printCommands(false), |
112 |
res(new GfxResources(xref, resDict, NULL)), // start the resource stack |
113 |
- state(new GfxState(72, 72, box, 0, gFalse)), |
114 |
- fontChanged(gFalse), |
115 |
+ state(new GfxState(72, 72, box, 0, false)), |
116 |
+ fontChanged(false), |
117 |
clip(clipNone), |
118 |
ignoreUndef(0), |
119 |
baseMatrix(), |
120 |
@@ -409,7 +408,7 @@ PdfParser::~PdfParser() { |
121 |
} |
122 |
} |
123 |
|
124 |
-void PdfParser::parse(Object *obj, GBool topLevel) { |
125 |
+void PdfParser::parse(Object *obj, bool topLevel) { |
126 |
Object obj2; |
127 |
|
128 |
if (obj->isArray()) { |
129 |
@@ -434,13 +433,13 @@ void PdfParser::parse(Object *obj, GBool topLevel) { |
130 |
error(errInternal, -1, "Weird page contents"); |
131 |
return; |
132 |
} |
133 |
- parser = new Parser(xref, new Lexer(xref, obj), gFalse); |
134 |
+ parser = new Parser(xref, new Lexer(xref, obj), false); |
135 |
go(topLevel); |
136 |
delete parser; |
137 |
parser = NULL; |
138 |
} |
139 |
|
140 |
-void PdfParser::go(GBool /*topLevel*/) |
141 |
+void PdfParser::go(bool /*topLevel*/) |
142 |
{ |
143 |
Object obj; |
144 |
Object args[maxArgs]; |
145 |
@@ -572,7 +571,7 @@ const char *PdfParser::getPreviousOperator(unsigned in |
146 |
|
147 |
void PdfParser::execOp(Object *cmd, Object args[], int numArgs) { |
148 |
PdfOperator *op; |
149 |
- char *name; |
150 |
+ const char *name; |
151 |
Object *argPtr; |
152 |
int i; |
153 |
|
154 |
@@ -620,7 +619,7 @@ void PdfParser::execOp(Object *cmd, Object args[], int |
155 |
(this->*op->func)(argPtr, numArgs); |
156 |
} |
157 |
|
158 |
-PdfOperator* PdfParser::findOp(char *name) { |
159 |
+PdfOperator* PdfParser::findOp(const char *name) { |
160 |
int a = -1; |
161 |
int b = numOps; |
162 |
int cmp = -1; |
163 |
@@ -640,7 +639,7 @@ PdfOperator* PdfParser::findOp(char *name) { |
164 |
return &opTab[a]; |
165 |
} |
166 |
|
167 |
-GBool PdfParser::checkArg(Object *arg, TchkType type) { |
168 |
+bool PdfParser::checkArg(Object *arg, TchkType type) { |
169 |
switch (type) { |
170 |
case tchkBool: return arg->isBool(); |
171 |
case tchkInt: return arg->isInt(); |
172 |
@@ -650,9 +649,9 @@ GBool PdfParser::checkArg(Object *arg, TchkType type) |
173 |
case tchkArray: return arg->isArray(); |
174 |
case tchkProps: return arg->isDict() || arg->isName(); |
175 |
case tchkSCN: return arg->isNum() || arg->isName(); |
176 |
- case tchkNone: return gFalse; |
177 |
+ case tchkNone: return false; |
178 |
} |
179 |
- return gFalse; |
180 |
+ return false; |
181 |
} |
182 |
|
183 |
int PdfParser::getPos() { |
184 |
@@ -707,7 +706,7 @@ void PdfParser::opConcat(Object args[], int /*numArgs* |
185 |
builder->pushGroup(); |
186 |
builder->setTransform(a0, a1, a2, a3, a4, a5); |
187 |
} |
188 |
- fontChanged = gTrue; |
189 |
+ fontChanged = true; |
190 |
} |
191 |
|
192 |
// TODO not good that numArgs is ignored but args[] is used: |
193 |
@@ -773,8 +772,8 @@ void PdfParser::opSetExtGState(Object args[], int /*nu |
194 |
Object obj1, obj2, obj3, obj4, obj5; |
195 |
Function *funcs[4] = {0, 0, 0, 0}; |
196 |
GfxColor backdropColor; |
197 |
- GBool haveBackdropColor = gFalse; |
198 |
- GBool alpha = gFalse; |
199 |
+ bool haveBackdropColor = false; |
200 |
+ bool alpha = false; |
201 |
|
202 |
#if defined(POPPLER_NEW_OBJECT_API) |
203 |
if ((obj1 = res->lookupGState(args[0].getName())).isNull()) { |
204 |
@@ -830,7 +829,7 @@ void PdfParser::opSetExtGState(Object args[], int /*nu |
205 |
#endif |
206 |
|
207 |
// fill/stroke overprint |
208 |
- GBool haveFillOP = gFalse; |
209 |
+ bool haveFillOP = false; |
210 |
#if defined(POPPLER_NEW_OBJECT_API) |
211 |
if ((haveFillOP = (obj2 = obj1.dictLookup(const_cast<char*>("op"))).isBool())) { |
212 |
#else |
213 |
@@ -925,9 +924,9 @@ void PdfParser::opSetExtGState(Object args[], int /*nu |
214 |
#else |
215 |
if (obj2.dictLookup(const_cast<char*>("S"), &obj3)->isName(const_cast<char*>("Alpha"))) { |
216 |
#endif |
217 |
- alpha = gTrue; |
218 |
+ alpha = true; |
219 |
} else { // "Luminosity" |
220 |
- alpha = gFalse; |
221 |
+ alpha = false; |
222 |
} |
223 |
#if !defined(POPPLER_NEW_OBJECT_API) |
224 |
obj3.free(); |
225 |
@@ -978,8 +977,8 @@ void PdfParser::opSetExtGState(Object args[], int /*nu |
226 |
if (obj3.streamGetDict()->lookup(const_cast<char*>("Group"), &obj4)->isDict()) { |
227 |
#endif |
228 |
GfxColorSpace *blendingColorSpace = 0; |
229 |
- GBool isolated = gFalse; |
230 |
- GBool knockout = gFalse; |
231 |
+ bool isolated = false; |
232 |
+ bool knockout = false; |
233 |
#if defined(POPPLER_NEW_OBJECT_API) |
234 |
if (!((obj5 = obj4.dictLookup(const_cast<char*>("CS"))).isNull())) { |
235 |
#else |
236 |
@@ -1050,9 +1049,9 @@ void PdfParser::opSetExtGState(Object args[], int /*nu |
237 |
#endif |
238 |
} |
239 |
|
240 |
-void PdfParser::doSoftMask(Object *str, GBool alpha, |
241 |
+void PdfParser::doSoftMask(Object *str, bool alpha, |
242 |
GfxColorSpace *blendingColorSpace, |
243 |
- GBool isolated, GBool knockout, |
244 |
+ bool isolated, bool knockout, |
245 |
Function *transferFunc, GfxColor *backdropColor) { |
246 |
Dict *dict, *resDict; |
247 |
double m[6], bbox[4]; |
248 |
@@ -1145,7 +1144,7 @@ void PdfParser::doSoftMask(Object *str, GBool alpha, |
249 |
|
250 |
// draw it |
251 |
++formDepth; |
252 |
- doForm1(str, resDict, m, bbox, gTrue, gTrue, |
253 |
+ doForm1(str, resDict, m, bbox, true, true, |
254 |
blendingColorSpace, isolated, knockout, |
255 |
alpha, transferFunc, backdropColor); |
256 |
--formDepth; |
257 |
@@ -1615,7 +1614,7 @@ void PdfParser::opFill(Object /*args*/[], int /*numArg |
258 |
if (state->isPath()) { |
259 |
if (state->getFillColorSpace()->getMode() == csPattern && |
260 |
!builder->isPatternTypeSupported(state->getFillPattern())) { |
261 |
- doPatternFillFallback(gFalse); |
262 |
+ doPatternFillFallback(false); |
263 |
} else { |
264 |
builder->addPath(state, true, false); |
265 |
} |
266 |
@@ -1632,7 +1631,7 @@ void PdfParser::opEOFill(Object /*args*/[], int /*numA |
267 |
if (state->isPath()) { |
268 |
if (state->getFillColorSpace()->getMode() == csPattern && |
269 |
!builder->isPatternTypeSupported(state->getFillPattern())) { |
270 |
- doPatternFillFallback(gTrue); |
271 |
+ doPatternFillFallback(true); |
272 |
} else { |
273 |
builder->addPath(state, true, false, true); |
274 |
} |
275 |
@@ -1647,7 +1646,7 @@ void PdfParser::opFillStroke(Object /*args*/[], int /* |
276 |
return; |
277 |
} |
278 |
if (state->isPath()) { |
279 |
- doFillAndStroke(gFalse); |
280 |
+ doFillAndStroke(false); |
281 |
} else { |
282 |
builder->addPath(state, true, true); |
283 |
} |
284 |
@@ -1662,7 +1661,7 @@ void PdfParser::opCloseFillStroke(Object /*args*/[], i |
285 |
} |
286 |
if (state->isPath()) { |
287 |
state->closePath(); |
288 |
- doFillAndStroke(gFalse); |
289 |
+ doFillAndStroke(false); |
290 |
} |
291 |
doEndPath(); |
292 |
} |
293 |
@@ -1674,7 +1673,7 @@ void PdfParser::opEOFillStroke(Object /*args*/[], int |
294 |
return; |
295 |
} |
296 |
if (state->isPath()) { |
297 |
- doFillAndStroke(gTrue); |
298 |
+ doFillAndStroke(true); |
299 |
} |
300 |
doEndPath(); |
301 |
} |
302 |
@@ -1687,20 +1686,20 @@ void PdfParser::opCloseEOFillStroke(Object /*args*/[], |
303 |
} |
304 |
if (state->isPath()) { |
305 |
state->closePath(); |
306 |
- doFillAndStroke(gTrue); |
307 |
+ doFillAndStroke(true); |
308 |
} |
309 |
doEndPath(); |
310 |
} |
311 |
|
312 |
-void PdfParser::doFillAndStroke(GBool eoFill) { |
313 |
- GBool fillOk = gTrue, strokeOk = gTrue; |
314 |
+void PdfParser::doFillAndStroke(bool eoFill) { |
315 |
+ bool fillOk = true, strokeOk = true; |
316 |
if (state->getFillColorSpace()->getMode() == csPattern && |
317 |
!builder->isPatternTypeSupported(state->getFillPattern())) { |
318 |
- fillOk = gFalse; |
319 |
+ fillOk = false; |
320 |
} |
321 |
if (state->getStrokeColorSpace()->getMode() == csPattern && |
322 |
!builder->isPatternTypeSupported(state->getStrokePattern())) { |
323 |
- strokeOk = gFalse; |
324 |
+ strokeOk = false; |
325 |
} |
326 |
if (fillOk && strokeOk) { |
327 |
builder->addPath(state, true, true, eoFill); |
328 |
@@ -1710,7 +1709,7 @@ void PdfParser::doFillAndStroke(GBool eoFill) { |
329 |
} |
330 |
} |
331 |
|
332 |
-void PdfParser::doPatternFillFallback(GBool eoFill) { |
333 |
+void PdfParser::doPatternFillFallback(bool eoFill) { |
334 |
GfxPattern *pattern; |
335 |
|
336 |
if (!(pattern = state->getFillPattern())) { |
337 |
@@ -1720,7 +1719,7 @@ void PdfParser::doPatternFillFallback(GBool eoFill) { |
338 |
case 1: |
339 |
break; |
340 |
case 2: |
341 |
- doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), gFalse, eoFill); |
342 |
+ doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), false, eoFill); |
343 |
break; |
344 |
default: |
345 |
error(errUnimplemented, getPos(), "Unimplemented pattern type (%d) in fill", |
346 |
@@ -1739,7 +1738,7 @@ void PdfParser::doPatternStrokeFallback() { |
347 |
case 1: |
348 |
break; |
349 |
case 2: |
350 |
- doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), gTrue, gFalse); |
351 |
+ doShadingPatternFillFallback(static_cast<GfxShadingPattern *>(pattern), true, false); |
352 |
break; |
353 |
default: |
354 |
error(errUnimplemented, getPos(), "Unimplemented pattern type ({0:d}) in stroke", |
355 |
@@ -1749,10 +1748,10 @@ void PdfParser::doPatternStrokeFallback() { |
356 |
} |
357 |
|
358 |
void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat, |
359 |
- GBool stroke, GBool eoFill) { |
360 |
+ bool stroke, bool eoFill) { |
361 |
GfxShading *shading; |
362 |
GfxPath *savedPath; |
363 |
- double *ctm, *btm, *ptm; |
364 |
+ const double *ctm, *btm, *ptm; |
365 |
double m[6], ictm[6], m1[6]; |
366 |
double xMin, yMin, xMax, yMax; |
367 |
double det; |
368 |
@@ -1863,7 +1862,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs* |
369 |
double xTemp, yTemp; |
370 |
double gradientTransform[6]; |
371 |
double *matrix = NULL; |
372 |
- GBool savedState = gFalse; |
373 |
+ bool savedState = false; |
374 |
|
375 |
#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API) |
376 |
if (!(shading = res->lookupShading(args[0].getName(), NULL, NULL))) { |
377 |
@@ -1879,13 +1878,13 @@ void PdfParser::opShFill(Object args[], int /*numArgs* |
378 |
if (shading->getType() != 2 && shading->getType() != 3) { |
379 |
savedPath = state->getPath()->copy(); |
380 |
saveState(); |
381 |
- savedState = gTrue; |
382 |
+ savedState = true; |
383 |
} else { // get gradient transform if possible |
384 |
// check proper operator sequence |
385 |
// first there should be one W(*) and then one 'cm' somewhere before 'sh' |
386 |
- GBool seenClip, seenConcat; |
387 |
+ bool seenClip, seenConcat; |
388 |
seenClip = (clipHistory->getClipPath() != NULL); |
389 |
- seenConcat = gFalse; |
390 |
+ seenConcat = false; |
391 |
int i = 1; |
392 |
while (i <= maxOperatorHistoryDepth) { |
393 |
const char *opName = getPreviousOperator(i); |
394 |
@@ -1893,7 +1892,7 @@ void PdfParser::opShFill(Object args[], int /*numArgs* |
395 |
if (seenConcat) { // more than one 'cm' |
396 |
break; |
397 |
} else { |
398 |
- seenConcat = gTrue; |
399 |
+ seenConcat = true; |
400 |
} |
401 |
} |
402 |
i++; |
403 |
@@ -1994,7 +1993,7 @@ void PdfParser::doFunctionShFill1(GfxFunctionShading * |
404 |
GfxColor color0M, color1M, colorM0, colorM1, colorMM; |
405 |
GfxColor colors2[4]; |
406 |
double functionColorDelta = colorDeltas[pdfFunctionShading-1]; |
407 |
- double *matrix; |
408 |
+ const double *matrix; |
409 |
double xM, yM; |
410 |
int nComps, i, j; |
411 |
|
412 |
@@ -2174,7 +2173,7 @@ void PdfParser::doPatchMeshShFill(GfxPatchMeshShading |
413 |
} |
414 |
} |
415 |
|
416 |
-void PdfParser::fillPatch(GfxPatch *patch, int nComps, int depth) { |
417 |
+void PdfParser::fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth) { |
418 |
GfxPatch patch00 = blankPatch(); |
419 |
GfxPatch patch01 = blankPatch(); |
420 |
GfxPatch patch10 = blankPatch(); |
421 |
@@ -2348,7 +2347,7 @@ void PdfParser::opBeginText(Object /*args*/[], int /*n |
422 |
state->setTextMat(1, 0, 0, 1, 0, 0); |
423 |
state->textMoveTo(0, 0); |
424 |
builder->updateTextPosition(0.0, 0.0); |
425 |
- fontChanged = gTrue; |
426 |
+ fontChanged = true; |
427 |
builder->beginTextObject(state); |
428 |
} |
429 |
|
430 |
@@ -2376,20 +2375,20 @@ void PdfParser::opSetFont(Object args[], int /*numArgs |
431 |
// unsetting the font (drawing no text) is better than using the |
432 |
// previous one and drawing random glyphs from it |
433 |
state->setFont(NULL, args[1].getNum()); |
434 |
- fontChanged = gTrue; |
435 |
+ fontChanged = true; |
436 |
return; |
437 |
} |
438 |
if (printCommands) { |
439 |
printf(" font: tag=%s name='%s' %g\n", |
440 |
- font->getTag()->getCString(), |
441 |
- font->getName() ? font->getName()->getCString() : "???", |
442 |
+ font->getTag()->c_str(), |
443 |
+ font->getName() ? font->getName()->c_str() : "???", |
444 |
args[1].getNum()); |
445 |
fflush(stdout); |
446 |
} |
447 |
|
448 |
font->incRefCnt(); |
449 |
state->setFont(font, args[1].getNum()); |
450 |
- fontChanged = gTrue; |
451 |
+ fontChanged = true; |
452 |
} |
453 |
|
454 |
// TODO not good that numArgs is ignored but args[] is used: |
455 |
@@ -2422,7 +2421,7 @@ void PdfParser::opSetHorizScaling(Object args[], int / |
456 |
{ |
457 |
state->setHorizScaling(args[0].getNum()); |
458 |
builder->updateTextMatrix(state); |
459 |
- fontChanged = gTrue; |
460 |
+ fontChanged = true; |
461 |
} |
462 |
|
463 |
//------------------------------------------------------------------------ |
464 |
@@ -2462,7 +2461,7 @@ void PdfParser::opSetTextMatrix(Object args[], int /*n |
465 |
state->textMoveTo(0, 0); |
466 |
builder->updateTextMatrix(state); |
467 |
builder->updateTextPosition(0.0, 0.0); |
468 |
- fontChanged = gTrue; |
469 |
+ fontChanged = true; |
470 |
} |
471 |
|
472 |
void PdfParser::opTextNextLine(Object /*args*/[], int /*numArgs*/) |
473 |
@@ -2488,7 +2487,7 @@ void PdfParser::opShowText(Object args[], int /*numArg |
474 |
} |
475 |
if (fontChanged) { |
476 |
builder->updateFont(state); |
477 |
- fontChanged = gFalse; |
478 |
+ fontChanged = false; |
479 |
} |
480 |
doShowText(args[0].getString()); |
481 |
} |
482 |
@@ -2505,7 +2504,7 @@ void PdfParser::opMoveShowText(Object args[], int /*nu |
483 |
} |
484 |
if (fontChanged) { |
485 |
builder->updateFont(state); |
486 |
- fontChanged = gFalse; |
487 |
+ fontChanged = false; |
488 |
} |
489 |
tx = state->getLineX(); |
490 |
ty = state->getLineY() - state->getLeading(); |
491 |
@@ -2526,7 +2525,7 @@ void PdfParser::opMoveSetShowText(Object args[], int / |
492 |
} |
493 |
if (fontChanged) { |
494 |
builder->updateFont(state); |
495 |
- fontChanged = gFalse; |
496 |
+ fontChanged = false; |
497 |
} |
498 |
state->setWordSpace(args[0].getNum()); |
499 |
state->setCharSpace(args[1].getNum()); |
500 |
@@ -2550,7 +2549,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*n |
501 |
} |
502 |
if (fontChanged) { |
503 |
builder->updateFont(state); |
504 |
- fontChanged = gFalse; |
505 |
+ fontChanged = false; |
506 |
} |
507 |
wMode = state->getFont()->getWMode(); |
508 |
a = args[0].getArray(); |
509 |
@@ -2582,7 +2581,7 @@ void PdfParser::opShowSpaceText(Object args[], int /*n |
510 |
} |
511 |
} |
512 |
|
513 |
-void PdfParser::doShowText(GooString *s) { |
514 |
+void PdfParser::doShowText(const GooString *s) { |
515 |
GfxFont *font; |
516 |
int wMode; |
517 |
double riseX, riseY; |
518 |
@@ -2591,11 +2590,11 @@ void PdfParser::doShowText(GooString *s) { |
519 |
double x, y, dx, dy, tdx, tdy; |
520 |
double originX, originY, tOriginX, tOriginY; |
521 |
double oldCTM[6], newCTM[6]; |
522 |
- double *mat; |
523 |
+ const double *mat; |
524 |
Object charProc; |
525 |
Dict *resDict; |
526 |
Parser *oldParser; |
527 |
- char *p; |
528 |
+ const char *p; |
529 |
int len, n, uLen; |
530 |
|
531 |
font = state->getFont(); |
532 |
@@ -2631,7 +2630,7 @@ void PdfParser::doShowText(GooString *s) { |
533 |
double lineX = state->getLineX(); |
534 |
double lineY = state->getLineY(); |
535 |
oldParser = parser; |
536 |
- p = s->getCString(); |
537 |
+ p = s->c_str(); |
538 |
len = s->getLength(); |
539 |
while (len > 0) { |
540 |
n = font->getNextChar(p, len, &code, |
541 |
@@ -2660,7 +2659,7 @@ void PdfParser::doShowText(GooString *s) { |
542 |
pushResources(resDict); |
543 |
} |
544 |
if (charProc.isStream()) { |
545 |
- //parse(&charProc, gFalse); // TODO: parse into SVG font |
546 |
+ //parse(&charProc, false); // TODO: parse into SVG font |
547 |
} else { |
548 |
error(errSyntaxError, getPos(), "Missing or bad Type3 CharProc entry"); |
549 |
} |
550 |
@@ -2686,7 +2685,7 @@ void PdfParser::doShowText(GooString *s) { |
551 |
|
552 |
} else { |
553 |
state->textTransformDelta(0, state->getRise(), &riseX, &riseY); |
554 |
- p = s->getCString(); |
555 |
+ p = s->c_str(); |
556 |
len = s->getLength(); |
557 |
while (len > 0) { |
558 |
n = font->getNextChar(p, len, &code, |
559 |
@@ -2732,7 +2731,7 @@ void PdfParser::opXObject(Object args[], int /*numArgs |
560 |
{ |
561 |
Object obj1, obj2, obj3, refObj; |
562 |
|
563 |
- char *name = args[0].getName(); |
564 |
+ const char *name = args[0].getName(); |
565 |
#if defined(POPPLER_NEW_OBJECT_API) |
566 |
if ((obj1 = res->lookupXObject(name)).isNull()) { |
567 |
#else |
568 |
@@ -2758,7 +2757,7 @@ void PdfParser::opXObject(Object args[], int /*numArgs |
569 |
#else |
570 |
res->lookupXObjectNF(name, &refObj); |
571 |
#endif |
572 |
- doImage(&refObj, obj1.getStream(), gFalse); |
573 |
+ doImage(&refObj, obj1.getStream(), false); |
574 |
#if !defined(POPPLER_NEW_OBJECT_API) |
575 |
refObj.free(); |
576 |
#endif |
577 |
@@ -2783,19 +2782,19 @@ void PdfParser::opXObject(Object args[], int /*numArgs |
578 |
#endif |
579 |
} |
580 |
|
581 |
-void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg) |
582 |
+void PdfParser::doImage(Object * /*ref*/, Stream *str, bool inlineImg) |
583 |
{ |
584 |
Dict *dict; |
585 |
int width, height; |
586 |
int bits; |
587 |
- GBool interpolate; |
588 |
+ bool interpolate; |
589 |
StreamColorSpaceMode csMode; |
590 |
- GBool mask; |
591 |
- GBool invert; |
592 |
+ bool mask; |
593 |
+ bool invert; |
594 |
Object maskObj, smaskObj; |
595 |
- GBool haveColorKeyMask, haveExplicitMask, haveSoftMask; |
596 |
- GBool maskInvert; |
597 |
- GBool maskInterpolate; |
598 |
+ bool haveColorKeyMask, haveExplicitMask, haveSoftMask; |
599 |
+ bool maskInvert; |
600 |
+ bool maskInterpolate; |
601 |
Object obj1, obj2; |
602 |
|
603 |
// get info from the stream |
604 |
@@ -2873,11 +2872,11 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
605 |
if (obj1.isBool()) |
606 |
interpolate = obj1.getBool(); |
607 |
else |
608 |
- interpolate = gFalse; |
609 |
+ interpolate = false; |
610 |
#if !defined(POPPLER_NEW_OBJECT_API) |
611 |
obj1.free(); |
612 |
#endif |
613 |
- maskInterpolate = gFalse; |
614 |
+ maskInterpolate = false; |
615 |
|
616 |
// image or mask? |
617 |
#if defined(POPPLER_NEW_OBJECT_API) |
618 |
@@ -2893,7 +2892,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
619 |
dict->lookup(const_cast<char*>("IM"), &obj1); |
620 |
#endif |
621 |
} |
622 |
- mask = gFalse; |
623 |
+ mask = false; |
624 |
if (obj1.isBool()) { |
625 |
mask = obj1.getBool(); |
626 |
} |
627 |
@@ -2937,7 +2936,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
628 |
if (bits != 1) { |
629 |
goto err1; |
630 |
} |
631 |
- invert = gFalse; |
632 |
+ invert = false; |
633 |
#if defined(POPPLER_NEW_OBJECT_API) |
634 |
obj1 = dict->lookup(const_cast<char*>("Decode")); |
635 |
#else |
636 |
@@ -2958,7 +2957,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
637 |
obj1.arrayGet(0, &obj2); |
638 |
#endif |
639 |
if (obj2.isInt() && obj2.getInt() == 1) { |
640 |
- invert = gTrue; |
641 |
+ invert = true; |
642 |
} |
643 |
#if !defined(POPPLER_NEW_OBJECT_API) |
644 |
obj2.free(); |
645 |
@@ -3055,11 +3054,11 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
646 |
|
647 |
// get the mask |
648 |
int maskColors[2*gfxColorMaxComps]; |
649 |
- haveColorKeyMask = haveExplicitMask = haveSoftMask = gFalse; |
650 |
+ haveColorKeyMask = haveExplicitMask = haveSoftMask = false; |
651 |
Stream *maskStr = NULL; |
652 |
int maskWidth = 0; |
653 |
int maskHeight = 0; |
654 |
- maskInvert = gFalse; |
655 |
+ maskInvert = false; |
656 |
GfxImageColorMap *maskColorMap = NULL; |
657 |
#if defined(POPPLER_NEW_OBJECT_API) |
658 |
maskObj = dict->lookup(const_cast<char*>("Mask")); |
659 |
@@ -3146,7 +3145,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
660 |
if (obj1.isBool()) |
661 |
maskInterpolate = obj1.getBool(); |
662 |
else |
663 |
- maskInterpolate = gFalse; |
664 |
+ maskInterpolate = false; |
665 |
#if defined(POPPLER_NEW_OBJECT_API) |
666 |
obj1 = maskDict->lookup(const_cast<char*>("ColorSpace")); |
667 |
#else |
668 |
@@ -3215,7 +3214,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
669 |
goto err1; |
670 |
} |
671 |
//~ handle the Matte entry |
672 |
- haveSoftMask = gTrue; |
673 |
+ haveSoftMask = true; |
674 |
} else if (maskObj.isArray()) { |
675 |
// color key mask |
676 |
int i; |
677 |
@@ -3230,7 +3229,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
678 |
obj1.free(); |
679 |
#endif |
680 |
} |
681 |
- haveColorKeyMask = gTrue; |
682 |
+ haveColorKeyMask = true; |
683 |
} else if (maskObj.isStream()) { |
684 |
// explicit mask |
685 |
if (inlineImg) { |
686 |
@@ -3307,11 +3306,11 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
687 |
if (obj1.isBool()) |
688 |
maskInterpolate = obj1.getBool(); |
689 |
else |
690 |
- maskInterpolate = gFalse; |
691 |
+ maskInterpolate = false; |
692 |
#if !defined(POPPLER_NEW_OBJECT_API) |
693 |
obj1.free(); |
694 |
#endif |
695 |
- maskInvert = gFalse; |
696 |
+ maskInvert = false; |
697 |
#if defined(POPPLER_NEW_OBJECT_API) |
698 |
obj1 = maskDict->lookup(const_cast<char*>("Decode")); |
699 |
#else |
700 |
@@ -3332,7 +3331,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
701 |
obj1.arrayGet(0, &obj2); |
702 |
#endif |
703 |
if (obj2.isInt() && obj2.getInt() == 1) { |
704 |
- maskInvert = gTrue; |
705 |
+ maskInvert = true; |
706 |
} |
707 |
#if !defined(POPPLER_NEW_OBJECT_API) |
708 |
obj2.free(); |
709 |
@@ -3343,7 +3342,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
710 |
#if !defined(POPPLER_NEW_OBJECT_API) |
711 |
obj1.free(); |
712 |
#endif |
713 |
- haveExplicitMask = gTrue; |
714 |
+ haveExplicitMask = true; |
715 |
} |
716 |
|
717 |
// draw it |
718 |
@@ -3378,7 +3377,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, |
719 |
|
720 |
void PdfParser::doForm(Object *str) { |
721 |
Dict *dict; |
722 |
- GBool transpGroup, isolated, knockout; |
723 |
+ bool transpGroup, isolated, knockout; |
724 |
GfxColorSpace *blendingColorSpace; |
725 |
Object matrixObj, bboxObj; |
726 |
double m[6], bbox[4]; |
727 |
@@ -3472,7 +3471,7 @@ void PdfParser::doForm(Object *str) { |
728 |
resDict = resObj.isDict() ? resObj.getDict() : (Dict *)NULL; |
729 |
|
730 |
// check for a transparency group |
731 |
- transpGroup = isolated = knockout = gFalse; |
732 |
+ transpGroup = isolated = knockout = false; |
733 |
blendingColorSpace = NULL; |
734 |
#if defined(POPPLER_NEW_OBJECT_API) |
735 |
if ((obj1 = dict->lookup(const_cast<char*>("Group"))).isDict()) { |
736 |
@@ -3481,7 +3480,7 @@ void PdfParser::doForm(Object *str) { |
737 |
if (dict->lookup(const_cast<char*>("Group"), &obj1)->isDict()) { |
738 |
if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) { |
739 |
#endif |
740 |
- transpGroup = gTrue; |
741 |
+ transpGroup = true; |
742 |
#if defined(POPPLER_NEW_OBJECT_API) |
743 |
if (!((obj3 = obj1.dictLookup(const_cast<char*>("CS"))).isNull())) { |
744 |
#else |
745 |
@@ -3525,7 +3524,7 @@ void PdfParser::doForm(Object *str) { |
746 |
// draw it |
747 |
++formDepth; |
748 |
doForm1(str, resDict, m, bbox, |
749 |
- transpGroup, gFalse, blendingColorSpace, isolated, knockout); |
750 |
+ transpGroup, false, blendingColorSpace, isolated, knockout); |
751 |
--formDepth; |
752 |
|
753 |
if (blendingColorSpace) { |
754 |
@@ -3537,10 +3536,10 @@ void PdfParser::doForm(Object *str) { |
755 |
} |
756 |
|
757 |
void PdfParser::doForm1(Object *str, Dict *resDict, double *matrix, double *bbox, |
758 |
- GBool transpGroup, GBool softMask, |
759 |
+ bool transpGroup, bool softMask, |
760 |
GfxColorSpace *blendingColorSpace, |
761 |
- GBool isolated, GBool knockout, |
762 |
- GBool alpha, Function *transferFunc, |
763 |
+ bool isolated, bool knockout, |
764 |
+ bool alpha, Function *transferFunc, |
765 |
GfxColor *backdropColor) { |
766 |
Parser *oldParser; |
767 |
double oldBaseMatrix[6]; |
768 |
@@ -3601,7 +3600,7 @@ void PdfParser::doForm1(Object *str, Dict *resDict, do |
769 |
} |
770 |
|
771 |
// draw the form |
772 |
- parse(str, gFalse); |
773 |
+ parse(str, false); |
774 |
|
775 |
// restore base matrix |
776 |
for (i = 0; i < 6; ++i) { |
777 |
@@ -3641,7 +3640,7 @@ void PdfParser::opBeginImage(Object /*args*/[], int /* |
778 |
|
779 |
// display the image |
780 |
if (str) { |
781 |
- doImage(NULL, str, gTrue); |
782 |
+ doImage(NULL, str, true); |
783 |
|
784 |
// skip 'EI' tag |
785 |
int c1 = str->getUndecodedStream()->getChar(); |
786 |
@@ -3657,7 +3656,6 @@ void PdfParser::opBeginImage(Object /*args*/[], int /* |
787 |
Stream *PdfParser::buildImageStream() { |
788 |
Object dict; |
789 |
Object obj; |
790 |
- char *key; |
791 |
Stream *str; |
792 |
|
793 |
// build dictionary |
794 |
@@ -3675,26 +3673,17 @@ Stream *PdfParser::buildImageStream() { |
795 |
obj.free(); |
796 |
#endif |
797 |
} else { |
798 |
- key = copyString(obj.getName()); |
799 |
-#if defined(POPPLER_NEW_OBJECT_API) |
800 |
- obj = parser->getObj(); |
801 |
-#else |
802 |
- obj.free(); |
803 |
- parser->getObj(&obj); |
804 |
-#endif |
805 |
- if (obj.isEOF() || obj.isError()) { |
806 |
- gfree(key); |
807 |
+ Object obj2; |
808 |
+ _POPPLER_CALL(obj2, parser->getObj); |
809 |
+ if (obj2.isEOF() || obj2.isError()) { |
810 |
+ _POPPLER_FREE(obj); |
811 |
break; |
812 |
} |
813 |
-#if defined(POPPLER_NEW_OBJECT_API) |
814 |
- dict.dictAdd(key, std::move(obj)); |
815 |
+ _POPPLER_DICTADD(dict, obj.getName(), obj2); |
816 |
+ _POPPLER_FREE(obj); |
817 |
+ _POPPLER_FREE(obj2); |
818 |
} |
819 |
- obj = parser->getObj(); |
820 |
-#else |
821 |
- dict.dictAdd(key, &obj); |
822 |
- } |
823 |
- parser->getObj(&obj); |
824 |
-#endif |
825 |
+ _POPPLER_CALL(obj, parser->getObj); |
826 |
} |
827 |
if (obj.isEOF()) { |
828 |
error(errSyntaxError, getPos(), "End of file in inline image"); |
829 |
@@ -3710,10 +3699,10 @@ Stream *PdfParser::buildImageStream() { |
830 |
|
831 |
// make stream |
832 |
#if defined(POPPLER_NEW_OBJECT_API) |
833 |
- str = new EmbedStream(parser->getStream(), dict.copy(), gFalse, 0); |
834 |
+ str = new EmbedStream(parser->getStream(), dict.copy(), false, 0); |
835 |
str = str->addFilters(dict.getDict()); |
836 |
#else |
837 |
- str = new EmbedStream(parser->getStream(), &dict, gFalse, 0); |
838 |
+ str = new EmbedStream(parser->getStream(), &dict, false, 0); |
839 |
str = str->addFilters(&dict); |
840 |
#endif |
841 |
|
842 |
--- src/extension/internal/pdfinput/pdf-parser.h.orig 2018-03-11 20:38:09 UTC |
843 |
+++ src/extension/internal/pdfinput/pdf-parser.h |
844 |
@@ -9,6 +9,7 @@ |
845 |
#define PDF_PARSER_H |
846 |
|
847 |
#ifdef HAVE_POPPLER |
848 |
+#include "poppler-transition-api.h" |
849 |
|
850 |
#ifdef USE_GCC_PRAGMAS |
851 |
#pragma interface |
852 |
@@ -96,7 +97,7 @@ struct PdfOperator { |
853 |
struct OpHistoryEntry { |
854 |
const char *name; // operator's name |
855 |
GfxState *state; // saved state, NULL if none |
856 |
- GBool executed; // whether the operator has been executed |
857 |
+ bool executed; // whether the operator has been executed |
858 |
|
859 |
OpHistoryEntry *next; // next entry on stack |
860 |
unsigned depth; // total number of entries descending from this |
861 |
@@ -127,16 +128,19 @@ class PdfParser { (public) |
862 |
|
863 |
// Constructor for regular output. |
864 |
PdfParser(XRef *xrefA, SvgBuilder *builderA, int pageNum, int rotate, |
865 |
- Dict *resDict, PDFRectangle *box, PDFRectangle *cropBox); |
866 |
+ Dict *resDict, |
867 |
+ _POPPLER_CONST PDFRectangle *box, |
868 |
+ _POPPLER_CONST PDFRectangle *cropBox); |
869 |
|
870 |
// Constructor for a sub-page object. |
871 |
PdfParser(XRef *xrefA, Inkscape::Extension::Internal::SvgBuilder *builderA, |
872 |
- Dict *resDict, PDFRectangle *box); |
873 |
+ Dict *resDict, |
874 |
+ _POPPLER_CONST PDFRectangle *box); |
875 |
|
876 |
virtual ~PdfParser(); |
877 |
|
878 |
// Interpret a stream or array of streams. |
879 |
- void parse(Object *obj, GBool topLevel = gTrue); |
880 |
+ void parse(Object *obj, bool topLevel = true); |
881 |
|
882 |
// Save graphics state. |
883 |
void saveState(); |
884 |
@@ -154,12 +158,12 @@ class PdfParser { (public) |
885 |
|
886 |
XRef *xref; // the xref table for this PDF file |
887 |
SvgBuilder *builder; // SVG generator |
888 |
- GBool subPage; // is this a sub-page object? |
889 |
- GBool printCommands; // print the drawing commands (for debugging) |
890 |
+ bool subPage; // is this a sub-page object? |
891 |
+ bool printCommands; // print the drawing commands (for debugging) |
892 |
GfxResources *res; // resource stack |
893 |
|
894 |
GfxState *state; // current graphics state |
895 |
- GBool fontChanged; // set if font or text matrix has changed |
896 |
+ bool fontChanged; // set if font or text matrix has changed |
897 |
GfxClipType clip; // do a clip? |
898 |
int ignoreUndef; // current BX/EX nesting level |
899 |
double baseMatrix[6]; // default matrix for most recent |
900 |
@@ -183,10 +187,10 @@ class PdfParser { (public) |
901 |
OpHistoryEntry *popOperator(); |
902 |
const char *getPreviousOperator(unsigned int look_back=1); // returns the nth previous operator's name |
903 |
|
904 |
- void go(GBool topLevel); |
905 |
+ void go(bool topLevel); |
906 |
void execOp(Object *cmd, Object args[], int numArgs); |
907 |
- PdfOperator *findOp(char *name); |
908 |
- GBool checkArg(Object *arg, TchkType type); |
909 |
+ PdfOperator *findOp(const char *name); |
910 |
+ bool checkArg(Object *arg, TchkType type); |
911 |
int getPos(); |
912 |
|
913 |
// graphics state operators |
914 |
@@ -200,9 +204,9 @@ class PdfParser { (public) |
915 |
void opSetMiterLimit(Object args[], int numArgs); |
916 |
void opSetLineWidth(Object args[], int numArgs); |
917 |
void opSetExtGState(Object args[], int numArgs); |
918 |
- void doSoftMask(Object *str, GBool alpha, |
919 |
+ void doSoftMask(Object *str, bool alpha, |
920 |
GfxColorSpace *blendingColorSpace, |
921 |
- GBool isolated, GBool knockout, |
922 |
+ bool isolated, bool knockout, |
923 |
Function *transferFunc, GfxColor *backdropColor); |
924 |
void opSetRenderingIntent(Object args[], int numArgs); |
925 |
|
926 |
@@ -239,11 +243,11 @@ class PdfParser { (public) |
927 |
void opCloseFillStroke(Object args[], int numArgs); |
928 |
void opEOFillStroke(Object args[], int numArgs); |
929 |
void opCloseEOFillStroke(Object args[], int numArgs); |
930 |
- void doFillAndStroke(GBool eoFill); |
931 |
- void doPatternFillFallback(GBool eoFill); |
932 |
+ void doFillAndStroke(bool eoFill); |
933 |
+ void doPatternFillFallback(bool eoFill); |
934 |
void doPatternStrokeFallback(); |
935 |
void doShadingPatternFillFallback(GfxShadingPattern *sPat, |
936 |
- GBool stroke, GBool eoFill); |
937 |
+ bool stroke, bool eoFill); |
938 |
void opShFill(Object args[], int numArgs); |
939 |
void doFunctionShFill(GfxFunctionShading *shading); |
940 |
void doFunctionShFill1(GfxFunctionShading *shading, |
941 |
@@ -256,7 +260,7 @@ class PdfParser { (public) |
942 |
double x2, double y2, GfxColor *color2, |
943 |
int nComps, int depth); |
944 |
void doPatchMeshShFill(GfxPatchMeshShading *shading); |
945 |
- void fillPatch(GfxPatch *patch, int nComps, int depth); |
946 |
+ void fillPatch(_POPPLER_CONST GfxPatch *patch, int nComps, int depth); |
947 |
void doEndPath(); |
948 |
|
949 |
// path clipping operators |
950 |
@@ -287,17 +291,17 @@ class PdfParser { (public) |
951 |
void opMoveShowText(Object args[], int numArgs); |
952 |
void opMoveSetShowText(Object args[], int numArgs); |
953 |
void opShowSpaceText(Object args[], int numArgs); |
954 |
- void doShowText(GooString *s); |
955 |
+ void doShowText(const GooString *s); |
956 |
|
957 |
// XObject operators |
958 |
void opXObject(Object args[], int numArgs); |
959 |
- void doImage(Object *ref, Stream *str, GBool inlineImg); |
960 |
+ void doImage(Object *ref, Stream *str, bool inlineImg); |
961 |
void doForm(Object *str); |
962 |
void doForm1(Object *str, Dict *resDict, double *matrix, double *bbox, |
963 |
- GBool transpGroup = gFalse, GBool softMask = gFalse, |
964 |
+ bool transpGroup = false, bool softMask = false, |
965 |
GfxColorSpace *blendingColorSpace = NULL, |
966 |
- GBool isolated = gFalse, GBool knockout = gFalse, |
967 |
- GBool alpha = gFalse, Function *transferFunc = NULL, |
968 |
+ bool isolated = false, bool knockout = false, |
969 |
+ bool alpha = false, Function *transferFunc = NULL, |
970 |
GfxColor *backdropColor = NULL); |
971 |
|
972 |
// in-line image operators |
973 |
--- src/extension/internal/pdfinput/poppler-transition-api.h.orig 2018-12-09 09:09:13 UTC |
974 |
+++ src/extension/internal/pdfinput/poppler-transition-api.h |
975 |
@@ -0,0 +1,39 @@ |
976 |
+#ifndef SEEN_POPPLER_TRANSITION_API_H |
977 |
+#define SEEN_POPPLER_TRANSITION_API_H |
978 |
+ |
979 |
+#include <glib/poppler-features.h> |
980 |
+ |
981 |
+#if POPPLER_CHECK_VERSION(0,70,0) |
982 |
+#define _POPPLER_CONST const |
983 |
+#else |
984 |
+#define _POPPLER_CONST |
985 |
+#endif |
986 |
+ |
987 |
+#if POPPLER_CHECK_VERSION(0,69,0) |
988 |
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(key, std::move(obj)) |
989 |
+#elif POPPLER_CHECK_VERSION(0,58,0) |
990 |
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), std::move(obj)) |
991 |
+#else |
992 |
+#define _POPPLER_DICTADD(dict, key, obj) (dict).dictAdd(copyString(key), &obj) |
993 |
+#endif |
994 |
+ |
995 |
+#if POPPLER_CHECK_VERSION(0,58,0) |
996 |
+#define POPPLER_NEW_OBJECT_API |
997 |
+#define _POPPLER_FREE(obj) |
998 |
+#define _POPPLER_CALL(ret, func) (ret = func()) |
999 |
+#define _POPPLER_CALL_ARGS(ret, func, ...) (ret = func(__VA_ARGS__)) |
1000 |
+#else |
1001 |
+#define _POPPLER_FREE(obj) (obj).free() |
1002 |
+#define _POPPLER_CALL(ret, func) (*func(&ret)) |
1003 |
+#define _POPPLER_CALL_ARGS(ret, func, ...) (*func(__VA_ARGS__, &ret)) |
1004 |
+#endif |
1005 |
+ |
1006 |
+#if POPPLER_CHECK_VERSION(0, 29, 0) |
1007 |
+#define POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API |
1008 |
+#endif |
1009 |
+ |
1010 |
+#if POPPLER_CHECK_VERSION(0, 25, 0) |
1011 |
+#define POPPLER_EVEN_NEWER_COLOR_SPACE_API |
1012 |
+#endif |
1013 |
+ |
1014 |
+#endif |
1015 |
--- src/extension/internal/pdfinput/svg-builder.cpp.orig 2018-03-11 20:38:09 UTC |
1016 |
+++ src/extension/internal/pdfinput/svg-builder.cpp |
1017 |
@@ -625,7 +625,7 @@ gchar *SvgBuilder::_createPattern(GfxPattern *pattern, |
1018 |
if ( pattern != NULL ) { |
1019 |
if ( pattern->getType() == 2 ) { // Shading pattern |
1020 |
GfxShadingPattern *shading_pattern = static_cast<GfxShadingPattern *>(pattern); |
1021 |
- double *ptm; |
1022 |
+ const double *ptm; |
1023 |
double m[6] = {1, 0, 0, 1, 0, 0}; |
1024 |
double det; |
1025 |
|
1026 |
@@ -672,7 +672,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPatte |
1027 |
|
1028 |
Inkscape::XML::Node *pattern_node = _xml_doc->createElement("svg:pattern"); |
1029 |
// Set pattern transform matrix |
1030 |
- double *p2u = tiling_pattern->getMatrix(); |
1031 |
+ const double *p2u = tiling_pattern->getMatrix(); |
1032 |
double m[6] = {1, 0, 0, 1, 0, 0}; |
1033 |
double det; |
1034 |
det = _ttm[0] * _ttm[3] - _ttm[1] * _ttm[2]; // see LP Bug 1168908 |
1035 |
@@ -698,7 +698,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPatte |
1036 |
pattern_node->setAttribute("patternUnits", "userSpaceOnUse"); |
1037 |
// Set pattern tiling |
1038 |
// FIXME: don't ignore XStep and YStep |
1039 |
- double *bbox = tiling_pattern->getBBox(); |
1040 |
+ const double *bbox = tiling_pattern->getBBox(); |
1041 |
sp_repr_set_svg_double(pattern_node, "x", 0.0); |
1042 |
sp_repr_set_svg_double(pattern_node, "y", 0.0); |
1043 |
sp_repr_set_svg_double(pattern_node, "width", bbox[2] - bbox[0]); |
1044 |
@@ -751,7 +751,7 @@ gchar *SvgBuilder::_createTilingPattern(GfxTilingPatte |
1045 |
*/ |
1046 |
gchar *SvgBuilder::_createGradient(GfxShading *shading, double *matrix, bool for_shading) { |
1047 |
Inkscape::XML::Node *gradient; |
1048 |
- Function *func; |
1049 |
+ _POPPLER_CONST Function *func; |
1050 |
int num_funcs; |
1051 |
bool extend0, extend1; |
1052 |
|
1053 |
@@ -865,7 +865,7 @@ static bool svgGetShadingColorRGB(GfxShading *shading, |
1054 |
|
1055 |
#define INT_EPSILON 8 |
1056 |
bool SvgBuilder::_addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading, |
1057 |
- Function *func) { |
1058 |
+ _POPPLER_CONST Function *func) { |
1059 |
int type = func->getType(); |
1060 |
if ( type == 0 || type == 2 ) { // Sampled or exponential function |
1061 |
GfxRGB stop1, stop2; |
1062 |
@@ -877,9 +877,9 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node |
1063 |
_addStopToGradient(gradient, 1.0, &stop2, 1.0); |
1064 |
} |
1065 |
} else if ( type == 3 ) { // Stitching |
1066 |
- StitchingFunction *stitchingFunc = static_cast<StitchingFunction*>(func); |
1067 |
- double *bounds = stitchingFunc->getBounds(); |
1068 |
- double *encode = stitchingFunc->getEncode(); |
1069 |
+ auto stitchingFunc = static_cast<_POPPLER_CONST StitchingFunction*>(func); |
1070 |
+ const double *bounds = stitchingFunc->getBounds(); |
1071 |
+ const double *encode = stitchingFunc->getEncode(); |
1072 |
int num_funcs = stitchingFunc->getNumFuncs(); |
1073 |
|
1074 |
// Add stops from all the stitched functions |
1075 |
@@ -890,7 +890,7 @@ bool SvgBuilder::_addGradientStops(Inkscape::XML::Node |
1076 |
svgGetShadingColorRGB(shading, bounds[i + 1], &color); |
1077 |
// Add stops |
1078 |
if (stitchingFunc->getFunc(i)->getType() == 2) { // process exponential fxn |
1079 |
- double expE = (static_cast<ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE(); |
1080 |
+ double expE = (static_cast<_POPPLER_CONST ExponentialFunction*>(stitchingFunc->getFunc(i)))->getE(); |
1081 |
if (expE > 1.0) { |
1082 |
expE = (bounds[i + 1] - bounds[i])/expE; // approximate exponential as a single straight line at x=1 |
1083 |
if (encode[2*i] == 0) { // normal sequence |
1084 |
@@ -1020,7 +1020,7 @@ void SvgBuilder::updateFont(GfxState *state) { |
1085 |
GfxFont *font = state->getFont(); |
1086 |
// Store original name |
1087 |
if (font->getName()) { |
1088 |
- _font_specification = font->getName()->getCString(); |
1089 |
+ _font_specification = g_strdup(font->getName()->c_str()); |
1090 |
} else { |
1091 |
_font_specification = (char*) "Arial"; |
1092 |
} |
1093 |
@@ -1047,7 +1047,7 @@ void SvgBuilder::updateFont(GfxState *state) { |
1094 |
|
1095 |
// Font family |
1096 |
if (font->getFamily()) { // if font family is explicitly given use it. |
1097 |
- sp_repr_css_set_property(_font_style, "font-family", font->getFamily()->getCString()); |
1098 |
+ sp_repr_css_set_property(_font_style, "font-family", font->getFamily()->c_str()); |
1099 |
} else { |
1100 |
int attr_value = 1; |
1101 |
sp_repr_get_int(_preferences, "localFonts", &attr_value); |
1102 |
@@ -1148,7 +1148,7 @@ void SvgBuilder::updateFont(GfxState *state) { |
1103 |
Inkscape::CSSOStringStream os_font_size; |
1104 |
double css_font_size = _font_scaling * state->getFontSize(); |
1105 |
if ( font->getType() == fontType3 ) { |
1106 |
- double *font_matrix = font->getFontMatrix(); |
1107 |
+ const double *font_matrix = font->getFontMatrix(); |
1108 |
if ( font_matrix[0] != 0.0 ) { |
1109 |
css_font_size *= font_matrix[3] / font_matrix[0]; |
1110 |
} |
1111 |
@@ -1193,7 +1193,7 @@ void SvgBuilder::updateTextPosition(double tx, double |
1112 |
void SvgBuilder::updateTextMatrix(GfxState *state) { |
1113 |
_flushText(); |
1114 |
// Update text matrix |
1115 |
- double *text_matrix = state->getTextMat(); |
1116 |
+ const double *text_matrix = state->getTextMat(); |
1117 |
double w_scale = sqrt( text_matrix[0] * text_matrix[0] + text_matrix[2] * text_matrix[2] ); |
1118 |
double h_scale = sqrt( text_matrix[1] * text_matrix[1] + text_matrix[3] * text_matrix[3] ); |
1119 |
double max_scale; |
1120 |
@@ -1361,7 +1361,7 @@ void SvgBuilder::_flushText() { |
1121 |
_glyphs.clear(); |
1122 |
} |
1123 |
|
1124 |
-void SvgBuilder::beginString(GfxState *state, GooString * /*s*/) { |
1125 |
+void SvgBuilder::beginString(GfxState *state, const GooString * /*s*/) { |
1126 |
if (_need_font_update) { |
1127 |
updateFont(state); |
1128 |
} |
1129 |
--- src/extension/internal/pdfinput/svg-builder.h.orig 2018-03-11 20:38:09 UTC |
1130 |
+++ src/extension/internal/pdfinput/svg-builder.h |
1131 |
@@ -15,6 +15,7 @@ |
1132 |
#endif |
1133 |
|
1134 |
#ifdef HAVE_POPPLER |
1135 |
+#include "poppler-transition-api.h" |
1136 |
|
1137 |
class SPDocument; |
1138 |
namespace Inkscape { |
1139 |
@@ -136,7 +137,7 @@ class SvgBuilder { (public) |
1140 |
void clearSoftMask(GfxState *state); |
1141 |
|
1142 |
// Text handling |
1143 |
- void beginString(GfxState *state, GooString *s); |
1144 |
+ void beginString(GfxState *state, const GooString *s); |
1145 |
void endString(GfxState *state); |
1146 |
void addChar(GfxState *state, double x, double y, |
1147 |
double dx, double dy, |
1148 |
@@ -175,7 +176,7 @@ class SvgBuilder { (public) |
1149 |
void _addStopToGradient(Inkscape::XML::Node *gradient, double offset, |
1150 |
GfxRGB *color, double opacity); |
1151 |
bool _addGradientStops(Inkscape::XML::Node *gradient, GfxShading *shading, |
1152 |
- Function *func); |
1153 |
+ _POPPLER_CONST Function *func); |
1154 |
gchar *_createTilingPattern(GfxTilingPattern *tiling_pattern, GfxState *state, |
1155 |
bool is_stroke=false); |
1156 |
// Image/mask creation |