Package: calligra / 1:3.1.0+dfsg-5

poppler-0.71.patch Patch series | download
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
Description: Fix build with poppler 0.71
Author: Rik Mills <rikmills@kubuntu.org>
Origin: https://cgit.kde.org/calligra.git/log/?h=calligra/3.1
Last-Update: 2018-11-15

--- a/filters/karbon/pdf/CMakeLists.txt
+++ b/filters/karbon/pdf/CMakeLists.txt
@@ -1,3 +1,6 @@
+if(Poppler_VERSION VERSION_LESS "0.64.0")
+    add_definitions("-DHAVE_POPPLER_PRE_0_64")
+endif()
 
 set(pdf2svg_PART_SRCS PdfImportDebug.cpp PdfImport.cpp SvgOutputDev.cpp )
 
--- a/filters/karbon/pdf/PdfImport.cpp
+++ b/filters/karbon/pdf/PdfImport.cpp
@@ -88,9 +88,9 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt
     SvgOutputDev * dev = new SvgOutputDev(m_chain->outputFile());
     if (dev->isOk()) {
         int rotate = 0;
-        GBool useMediaBox = gTrue;
-        GBool crop = gFalse;
-        GBool printing = gFalse;
+        bool useMediaBox = true;
+        bool crop = false;
+        bool printing = false;
         pdfDoc->displayPages(dev, firstPage, lastPage, hDPI, vDPI, rotate, useMediaBox, crop, printing);
         dev->dumpContent();
     }
@@ -102,9 +102,6 @@ KoFilter::ConversionStatus PdfImport::convert(const QByteArray& from, const QByt
     delete globalParams;
     globalParams = 0;
 
-    // check for memory leaks
-    Object::memCheck(stderr);
-
     return KoFilter::OK;
 }
 
--- a/filters/karbon/pdf/SvgOutputDev.cpp
+++ b/filters/karbon/pdf/SvgOutputDev.cpp
@@ -39,7 +39,7 @@ class SvgOutputDev::Private
 {
 public:
     Private(const QString &fname)
-            : svgFile(fname), defs(0), body(0), state(gTrue)
+            : svgFile(fname), defs(0), body(0), state(true)
             , brush(Qt::SolidPattern) {}
 
     ~Private() {
@@ -52,7 +52,7 @@ public:
     QString defsData;
     QTextStream * defs;
     QTextStream * body;
-    GBool state;
+    bool state;
     QSizeF pageSize;
     QPen pen;
     QBrush brush;
@@ -62,7 +62,7 @@ SvgOutputDev::SvgOutputDev(const QString &fileName)
         : d(new Private(fileName))
 {
     if (! d->svgFile.open(QIODevice::WriteOnly)) {
-        d->state = gFalse;
+        d->state = false;
         return;
     }
 
@@ -75,24 +75,24 @@ SvgOutputDev::~SvgOutputDev()
     delete d;
 }
 
-GBool SvgOutputDev::isOk()
+bool SvgOutputDev::isOk()
 {
     return d->state;
 }
 
-GBool SvgOutputDev::upsideDown()
+bool SvgOutputDev::upsideDown()
 {
-    return gTrue;
+    return true;
 }
 
-GBool SvgOutputDev::useDrawChar()
+bool SvgOutputDev::useDrawChar()
 {
-    return gFalse;
+    return false;
 }
 
-GBool SvgOutputDev::interpretType3Chars()
+bool SvgOutputDev::interpretType3Chars()
 {
-    return gFalse;
+    return false;
 }
 
 void SvgOutputDev::startPage(int pageNum, GfxState *state, XRef */*xref*/)
@@ -212,7 +212,7 @@ QString SvgOutputDev::convertMatrix(const QMatrix &matrix)
            .arg(matrix.dx()) .arg(matrix.dy());
 }
 
-QString SvgOutputDev::convertMatrix(double * matrix)
+QString SvgOutputDev::convertMatrix(const double * matrix)
 {
     return QString("matrix(%1 %2 %3 %4 %5 %6)")
            .arg(matrix[0]).arg(matrix[1])
@@ -387,7 +387,11 @@ QString SvgOutputDev::printStroke()
     return stroke;
 }
 
+#ifdef HAVE_POPPLER_PRE_0_64
 void SvgOutputDev::drawString(GfxState * state, GooString * s)
+#else
+void SvgOutputDev::drawString(GfxState * state, const GooString * s)
+#endif
 {
     int render = state->getRender();
     // check for invisible text -- this is used by Acrobat Capture
@@ -402,7 +406,11 @@ void SvgOutputDev::drawString(GfxState * state, GooString * s)
 
     QString str;
 
+#ifdef HAVE_POPPLER_PRE_0_64
     char * p = s->getCString();
+#else
+    const char * p = s->getCString();
+#endif
     int len = s->getLength();
     CharCode code;
     Unicode *u = nullptr;
@@ -429,7 +437,7 @@ void SvgOutputDev::drawString(GfxState * state, GooString * s)
     double x = state->getCurX();
     double y = state->getCurY();
 
-    double * ctm = state->getCTM();
+    const double * ctm = state->getCTM();
     QMatrix transform(ctm[0], ctm[1], ctm[2], ctm[3], ctm[4], ctm[5]);
 
     QMatrix mirror;
@@ -474,9 +482,9 @@ void SvgOutputDev::drawString(GfxState * state, GooString * s)
     *d->body << "</text>" << endl;
 }
 
-void SvgOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str,
+void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
                              int width, int height, GfxImageColorMap *colorMap,
-                             int *maskColors, GBool /*inlineImg*/)
+                             bool /*interpolate*/, int *maskColors, bool inlineImg)
 {
     ImageStream * imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
     imgStr->reset();
@@ -522,7 +530,7 @@ void SvgOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str,
         return;
     }
 
-    double * ctm = state->getCTM();
+    const double * ctm = state->getCTM();
     QMatrix m;
     m.setMatrix(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, ctm[2] + ctm[4], ctm[3] + ctm[5]);
 
@@ -543,10 +551,3 @@ void SvgOutputDev::drawImage(GfxState *state, Object */*ref*/, Stream *str,
     delete imgStr;
 }
 
-void SvgOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
-                             int width, int height, GfxImageColorMap *colorMap,
-                             GBool /*interpolate*/, int *maskColors, GBool inlineImg)
-{
-    drawImage(state, ref, str, width, height, colorMap, maskColors, inlineImg);
-}
-

--- a/filters/karbon/pdf/SvgOutputDev.h
+++ b/filters/karbon/pdf/SvgOutputDev.h
@@ -44,47 +44,48 @@ public:
     explicit SvgOutputDev(const QString &fileName);
     virtual ~SvgOutputDev();
 
-    GBool isOk();
+    bool isOk();
 
-    virtual GBool upsideDown();
-    virtual GBool useDrawChar();
-    virtual GBool interpretType3Chars();
-    virtual void startPage(int pageNum, GfxState *state, XRef *xref);
-    virtual void endPage();
+    bool upsideDown() override;
+    bool useDrawChar() override;
+    bool interpretType3Chars() override;
+    void startPage(int pageNum, GfxState *state, XRef *xref) override;
+    void endPage() override;
 
     // path painting
-    virtual void stroke(GfxState * state);
-    virtual void fill(GfxState * state);
-    virtual void eoFill(GfxState *state);
+    void stroke(GfxState * state) override;
+    void fill(GfxState * state) override;
+    void eoFill(GfxState *state) override;
 
     // text
-    virtual void drawString(GfxState * state, GooString * s);
+#ifdef HAVE_POPPLER_PRE_0_64
+    void drawString(GfxState * state, GooString * s) override;
+#else
+    void drawString(GfxState * state, const GooString * s) override;
+#endif
 
     // images
-    virtual void drawImage(GfxState *state, Object *ref, Stream *str,
-                           int width, int height, GfxImageColorMap *colorMap,
-                           int *maskColors, GBool inlineImg);
-    virtual void drawImage(GfxState *state, Object *ref, Stream *str,
+    void drawImage(GfxState *state, Object *ref, Stream *str,
                            int width, int height, GfxImageColorMap *colorMap,
-                           GBool interpolate, int *maskColors, GBool inlineImg);
+                           bool interpolate, int *maskColors, bool inlineImg) override;
 
     // styles
-    virtual void updateAll(GfxState *state);
-    virtual void updateFillColor(GfxState *state);
-    virtual void updateStrokeColor(GfxState *state);
-    virtual void updateFillOpacity(GfxState *state);
-    virtual void updateStrokeOpacity(GfxState *state);
-    virtual void updateLineJoin(GfxState *state);
-    virtual void updateLineCap(GfxState *state);
-    virtual void updateMiterLimit(GfxState *state);
-    virtual void updateLineWidth(GfxState *state);
+    void updateAll(GfxState *state) override;
+    void updateFillColor(GfxState *state) override;
+    void updateStrokeColor(GfxState *state) override;
+    void updateFillOpacity(GfxState *state) override;
+    void updateStrokeOpacity(GfxState *state) override;
+    void updateLineJoin(GfxState *state) override;
+    void updateLineCap(GfxState *state) override;
+    void updateMiterLimit(GfxState *state) override;
+    void updateLineWidth(GfxState *state) override;
 
     /// Dumps content to svg file
     void dumpContent();
 private:
     QString convertPath(GfxPath *path);
     QString convertMatrix(const QMatrix &matrix);
-    QString convertMatrix(double * matrix);
+    QString convertMatrix(const double * matrix);
     QString printFill();
     QString printStroke();