1
From: "Matteo F. Vescovi" <mfvescovi@gmail.com>
2
Date: Wed, 4 Jun 2014 17:14:51 +0200
3
Subject: Fix_FTBFS_on_poppler-0.26
6
Bug: https://bugs.launchpad.net/inkscape/+bug/1315142
8
Thanks: Matthias Kilian for the patch.
11
src/extension/internal/pdfinput/pdf-parser.cpp | 54 +++++++++++++++++++++-----
12
2 files changed, 50 insertions(+), 9 deletions(-)
14
diff --git a/configure.ac b/configure.ac
15
index 0a19e48..9446d11 100644
18
@@ -610,6 +610,11 @@ else
22
+PKG_CHECK_MODULES(POPPLER_EVEN_NEWER_COLOR_SPACE_API, poppler >= 0.26.0, popplernewercolorspaceapi=yes, popplernewercolorspaceapi=no)
23
+if test "x$popplernewercolorspaceapi" = "xyes"; then
24
+ AC_DEFINE(POPPLER_EVEN_NEWER_COLOR_SPACE_API, 1, [Use even newer color space API from Poppler >= 0.26.0])
27
# Poppler's b604a008 commit changes this
28
AC_MSG_CHECKING([whether Poppler's GfxPatch no longer uses GfxColor])
30
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
31
index 045e214..b6edbfb 100644
32
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
33
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
34
@@ -860,7 +860,9 @@ void PdfParser::opSetExtGState(Object args[], int numArgs) {
35
blendingColorSpace = NULL;
36
isolated = knockout = gFalse;
37
if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) {
38
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
39
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
40
+ blendingColorSpace = GfxColorSpace::parse(&obj5, NULL, NULL);
41
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
42
blendingColorSpace = GfxColorSpace::parse(&obj5, NULL);
44
blendingColorSpace = GfxColorSpace::parse(&obj5);
45
@@ -1083,7 +1085,13 @@ void PdfParser::opSetFillColorSpace(Object args[], int numArgs) {
47
state->setFillPattern(NULL);
48
res->lookupColorSpace(args[0].getName(), &obj);
49
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
50
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
52
+ colorSpace = GfxColorSpace::parse(&args[0], NULL, NULL);
54
+ colorSpace = GfxColorSpace::parse(&obj, NULL, NULL);
56
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
58
colorSpace = GfxColorSpace::parse(&args[0], NULL);
60
@@ -1118,7 +1126,13 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int numArgs) {
62
state->setStrokePattern(NULL);
63
res->lookupColorSpace(args[0].getName(), &obj);
64
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
65
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
67
+ colorSpace = GfxColorSpace::parse(&args[0], NULL, NULL);
69
+ colorSpace = GfxColorSpace::parse(&obj, NULL, NULL);
71
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
73
colorSpace = GfxColorSpace::parse(&args[0], NULL);
75
@@ -1211,7 +1225,13 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) {
76
state->setFillColor(&color);
77
builder->updateStyle(state);
79
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
80
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
81
+ if (args[numArgs-1].isName() &&
82
+ (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) {
83
+ state->setFillPattern(pattern);
84
+ builder->updateStyle(state);
86
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
87
if (args[numArgs-1].isName() &&
88
(pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
89
state->setFillPattern(pattern);
90
@@ -1271,7 +1291,13 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) {
91
state->setStrokeColor(&color);
92
builder->updateStyle(state);
94
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
95
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
96
+ if (args[numArgs-1].isName() &&
97
+ (pattern = res->lookupPattern(args[numArgs-1].getName(), NULL, NULL))) {
98
+ state->setStrokePattern(pattern);
99
+ builder->updateStyle(state);
101
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
102
if (args[numArgs-1].isName() &&
103
(pattern = res->lookupPattern(args[numArgs-1].getName(), NULL))) {
104
state->setStrokePattern(pattern);
105
@@ -1710,7 +1736,11 @@ void PdfParser::opShFill(Object args[], int numArgs) {
106
double *matrix = NULL;
107
GBool savedState = gFalse;
109
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
110
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
111
+ if (!(shading = res->lookupShading(args[0].getName(), NULL, NULL))) {
114
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
115
if (!(shading = res->lookupShading(args[0].getName(), NULL))) {
118
@@ -2726,7 +2756,9 @@ void PdfParser::doImage(Object *ref, Stream *str, GBool inlineImg) {
121
if (!obj1.isNull()) {
122
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
123
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
124
+ colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL);
125
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
126
colorSpace = GfxColorSpace::parse(&obj1, NULL);
128
colorSpace = GfxColorSpace::parse(&obj1);
129
@@ -2815,7 +2847,9 @@ void PdfParser::doImage(Object *ref, Stream *str, GBool inlineImg) {
133
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
134
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
135
+ GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL, NULL);
136
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
137
maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
139
maskColorSpace = GfxColorSpace::parse(&obj1);
140
@@ -3006,7 +3040,9 @@ void PdfParser::doForm(Object *str) {
141
if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) {
143
if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) {
144
-#if defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
145
+#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
146
+ blendingColorSpace = GfxColorSpace::parse(&obj3, NULL, NULL);
147
+#elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
148
blendingColorSpace = GfxColorSpace::parse(&obj3, NULL);
150
blendingColorSpace = GfxColorSpace::parse(&obj3);