summaryrefslogtreecommitdiff
blob: bcfea9b77adb20035929b53c600914b4707595aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
 configure.ac                                   |  5 ++++
 src/extension/internal/pdfinput/pdf-parser.cpp | 32 +++++++++++++++++++++-----
 2 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index c8e1ae2..d62c989 100644
--- a/configure.ac
+++ b/configure.ac
@@ -593,6 +593,11 @@ if test "x$popplernewercolorspaceapi" = "xyes"; then
 	AC_DEFINE(POPPLER_EVEN_NEWER_COLOR_SPACE_API, 1, [Use even newer color space API from Poppler >= 0.26.0])
 fi
 
+PKG_CHECK_MODULES(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API, poppler >= 0.29.0, popplernewernewcolorspaceapi=yes, popplernewernewcolorspaceapi=no)
+if test "x$popplernewernewcolorspaceapi" = "xyes"; then
+	AC_DEFINE(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API, 1, [Use even newer new color space API from Poppler >= 0.29.0])
+fi
+
 # Poppler's b604a008 commit changes this
 AC_MSG_CHECKING([whether Poppler's GfxPatch no longer uses GfxColor])
 popplergfxcolor="no"
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index b6edbfb..3fbf237 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -860,7 +860,9 @@ void PdfParser::opSetExtGState(Object args[], int numArgs) {
 	  blendingColorSpace = NULL;
 	  isolated = knockout = gFalse;
 	  if (!obj4.dictLookup(const_cast<char*>("CS"), &obj5)->isNull()) {
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+	    blendingColorSpace = GfxColorSpace::parse(NULL, &obj5, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
 	    blendingColorSpace = GfxColorSpace::parse(&obj5, NULL, NULL);
 #elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
 	    blendingColorSpace = GfxColorSpace::parse(&obj5, NULL);
@@ -1085,7 +1087,13 @@ void PdfParser::opSetFillColorSpace(Object args[], int numArgs) {
 
   state->setFillPattern(NULL);
   res->lookupColorSpace(args[0].getName(), &obj);
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+  if (obj.isNull()) {
+    colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL);
+  } else {
+    colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL);
+  }
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
   if (obj.isNull()) {
     colorSpace = GfxColorSpace::parse(&args[0], NULL, NULL);
   } else {
@@ -1126,7 +1134,13 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int numArgs) {
 
   state->setStrokePattern(NULL);
   res->lookupColorSpace(args[0].getName(), &obj);
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+  if (obj.isNull()) {
+    colorSpace = GfxColorSpace::parse(NULL, &args[0], NULL, NULL);
+  } else {
+    colorSpace = GfxColorSpace::parse(NULL, &obj, NULL, NULL);
+  }
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
   if (obj.isNull()) {
     colorSpace = GfxColorSpace::parse(&args[0], NULL, NULL);
   } else {
@@ -2756,7 +2770,9 @@ void PdfParser::doImage(Object *ref, Stream *str, GBool inlineImg) {
       }
     }
     if (!obj1.isNull()) {
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+            colorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
             colorSpace = GfxColorSpace::parse(&obj1, NULL, NULL);
 #elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
       colorSpace = GfxColorSpace::parse(&obj1, NULL);
@@ -2847,7 +2863,9 @@ void PdfParser::doImage(Object *ref, Stream *str, GBool inlineImg) {
 	  obj2.free();
 	}
       }
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+            GfxColorSpace *maskColorSpace = GfxColorSpace::parse(NULL, &obj1, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
             GfxColorSpace *maskColorSpace = GfxColorSpace::parse(&obj1, NULL, NULL);
 #elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
       maskColorSpace = GfxColorSpace::parse(&obj1, NULL);
@@ -3040,7 +3058,9 @@ void PdfParser::doForm(Object *str) {
     if (obj1.dictLookup(const_cast<char*>("S"), &obj2)->isName(const_cast<char*>("Transparency"))) {
       transpGroup = gTrue;
       if (!obj1.dictLookup(const_cast<char*>("CS"), &obj3)->isNull()) {
-#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
+#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
+	blendingColorSpace = GfxColorSpace::parse(NULL, &obj3, NULL, NULL);
+#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
 	blendingColorSpace = GfxColorSpace::parse(&obj3, NULL, NULL);
 #elif defined(POPPLER_NEW_COLOR_SPACE_API) || defined(POPPLER_NEW_ERRORAPI)
 	blendingColorSpace = GfxColorSpace::parse(&obj3, NULL);