Lines 1-66
Link Here
|
1 |
--- pdf-backend.cc.orig 2019-06-10 17:06:44 UTC |
|
|
2 |
+++ pdf-backend.cc |
3 |
@@ -48,7 +48,7 @@ |
4 |
* ====================== |
5 |
*/ |
6 |
|
7 |
-static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, const char *message) |
8 |
+static void poppler_error_handler_new(ErrorCategory category, pdf::Offset pos, const char *message) |
9 |
{ |
10 |
std::string format; |
11 |
const char *category_name = _("PDF error"); |
12 |
@@ -94,6 +94,11 @@ static void poppler_error_handler(void *data, ErrorCat |
13 |
error_log << std::endl; |
14 |
} |
15 |
|
16 |
+static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, const char *message) |
17 |
+{ |
18 |
+ poppler_error_handler_new(category, pos, message); |
19 |
+} |
20 |
+ |
21 |
#if POPPLER_VERSION < 7000 |
22 |
static void poppler_error_handler(void *data, ErrorCategory category, pdf::Offset pos, char *message) |
23 |
{ |
24 |
@@ -101,10 +106,26 @@ static void poppler_error_handler(void *data, ErrorCat |
25 |
} |
26 |
#endif |
27 |
|
28 |
+// for POPPLER_VERSION >= 8500: |
29 |
+template <typename T1, typename T2> static auto set_error_callback(T1 callback1, T2 callback2) -> decltype(setErrorCallback(callback2)) |
30 |
+{ |
31 |
+ setErrorCallback(callback2); |
32 |
+} |
33 |
+ |
34 |
+// for POPPLER_VERSION < 8500: |
35 |
+template <typename T1, typename T2> static auto set_error_callback(T1 callback1, T2 callback2) -> decltype(setErrorCallback(callback1, nullptr)) |
36 |
+{ |
37 |
+ setErrorCallback(callback1, nullptr); |
38 |
+} |
39 |
+ |
40 |
pdf::Environment::Environment() |
41 |
{ |
42 |
- globalParams = new GlobalParams(); |
43 |
+ globalParams = std::unique_ptr<GlobalParams>(new GlobalParams); |
44 |
+#if POPPLER_VERSION >= 7000 |
45 |
+ set_error_callback(poppler_error_handler, poppler_error_handler_new); |
46 |
+#else |
47 |
setErrorCallback(poppler_error_handler, nullptr); |
48 |
+#endif |
49 |
} |
50 |
|
51 |
void pdf::Environment::set_antialias(bool value) |
52 |
@@ -499,12 +520,11 @@ bool pdf::get_glyph(splash::Splash *splash, splash::Fo |
53 |
void pdf::Renderer::convert_path(pdf::gfx::State *state, splash::Path &splash_path) |
54 |
{ |
55 |
/* Source was copied from <poppler/SplashOutputDev.c>. */ |
56 |
- pdf::gfx::Subpath *subpath; |
57 |
- pdf::gfx::Path *path = state->getPath(); |
58 |
+ auto path = state->getPath(); |
59 |
int n_subpaths = path->getNumSubpaths(); |
60 |
for (int i = 0; i < n_subpaths; i++) |
61 |
{ |
62 |
- subpath = path->getSubpath(i); |
63 |
+ auto subpath = path->getSubpath(i); |
64 |
if (subpath->getNumPoints() > 0) |
65 |
{ |
66 |
double x1, y1, x2, y2, x3, y3; |