1 Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
2 Date: 2012-08-22
3 Initial Package Version: 0.1.8
4 Upstream Status: Varies
5 Origin: Found at fedora.
6 Description: Three fixes found at fedora. For the first (only glib.h
7 can be included directly, with recent glib), we used to use a sed - but
8 the other two fixes need patches so I've put them all together.
9
10 Second part is from upstream and fixes trashed colours
11 Upstream: http://trac.emma-soft.com/epdfview/changeset/367/trunk
12 Fixes bug: https://bugzilla.redhat.com/show_bug.cgi?id=745483
13
14 Third part is the most critical - from Jiri Popelka, found at
15 https://bugzilla.redhat.com/show_bug.cgi?id=841880 - looks as if fedora
16 haven't applied it yet. It solves building with cups-1.6.
17
18 diff -Naur epdfview-0.1.8.orig/src/gtk/StockIcons.h epdfview-0.1.8/src/gtk/StockIcons.h
19 --- epdfview-0.1.8.orig/src/gtk/StockIcons.h 2011-05-28 11:24:57.000000000 +0100
20 +++ epdfview-0.1.8/src/gtk/StockIcons.h 2012-08-22 20:06:08.728195806 +0100
21 @@ -18,7 +18,7 @@
22 #if !defined (__STOCK_ICONS_H__)
23 #define __STOCK_ICONS_H__
24
25 -#include <glib/gmacros.h>
26 +#include <glib.h>
27
28 G_BEGIN_DECLS
29
30 diff -Naur epdfview-0.1.8.orig/src/PDFDocument.cxx epdfview-0.1.8/src/PDFDocument.cxx
31 --- epdfview-0.1.8.orig/src/PDFDocument.cxx 2011-05-28 11:25:01.000000000 +0100
32 +++ epdfview-0.1.8/src/PDFDocument.cxx 2012-08-22 20:07:03.627913886 +0100
33 @@ -20,6 +20,7 @@
34 #include <time.h>
35 #include <poppler.h>
36 #include <unistd.h>
37 +#include <algorithm>
38 #include "epdfview.h"
39
40 using namespace ePDFView;
41 @@ -33,6 +34,24 @@
42 static PageMode convertPageMode (gint pageMode);
43 static gchar *getAbsoluteFileName (const gchar *fileName);
44
45 +namespace
46 +{
47 + void
48 + convert_bgra_to_rgba (guint8 *data, int width, int height)
49 + {
50 + using std::swap;
51 +
52 + for (int y = 0; y < height; y++)
53 + {
54 + for (int x = 0; x < width; x++)
55 + {
56 + swap(data[0], data[2]);
57 + data += 4;
58 + }
59 + }
60 + }
61 +}
62 +
63 ///
64 /// @brief Constructs a new PDFDocument object.
65 ///
66 @@ -650,6 +669,7 @@
67 poppler_page_render (page, context);
68 cairo_destroy(context);
69 cairo_surface_destroy (surface);
70 + convert_bgra_to_rgba(renderedPage->getData (), width, height);
71 #else // !HAVE_POPPLER_0_17_0
72 // Create the pixbuf from the data and render to it.
73 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (renderedPage->getData (),
74 diff -Naur epdfview-0.1.8.orig/src/PrintPter.cxx epdfview-0.1.8/src/PrintPter.cxx
75 --- epdfview-0.1.8.orig/src/PrintPter.cxx 2011-05-28 11:25:01.000000000 +0100
76 +++ epdfview-0.1.8/src/PrintPter.cxx 2012-08-22 20:11:46.362436859 +0100
77 @@ -22,6 +22,40 @@
78 #include <locale.h>
79 #include "epdfview.h"
80
81 +#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5)
82 +#define HAVE_CUPS_1_6 1
83 +#endif
84 +
85 +#ifndef HAVE_CUPS_1_6
86 +inline int ippGetInteger (ipp_attribute_t *attr, int element)
87 +{
88 + return (attr->values[element].integer);
89 +}
90 +
91 +inline const char * ippGetString (ipp_attribute_t *attr,
92 + int element,
93 + const char **language /*UNUSED*/)
94 +{
95 + return (attr->values[element].string.text);
96 +}
97 +
98 +inline int ippSetOperation (ipp_t *ipp, ipp_op_t op)
99 +{
100 + if (!ipp)
101 + return (0);
102 + ipp->request.op.operation_id = op;
103 + return (1);
104 +}
105 +
106 +inline int ippSetRequestId (ipp_t *ipp, int request_id)
107 +{
108 + if (!ipp)
109 + return (0);
110 + ipp->request.any.request_id = request_id;
111 + return (1);
112 +}
113 +#endif
114 +
115 using namespace ePDFView;
116
117 // Structures
118 @@ -380,8 +414,8 @@
119
120 ipp_t *request = ippNew ();
121
122 - request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES;
123 - request->request.op.request_id = 1;
124 + ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES);
125 + ippSetRequestId(request, 1);
126
127 ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_CHARSET,
128 "attributes-charset", NULL, "utf-8");
129 @@ -403,7 +437,7 @@
130 ippFindAttribute (answer, "printer-state", IPP_TAG_ZERO);
131 if ( NULL != state )
132 {
133 - switch (state->values[0].integer)
134 + switch (ippGetInteger (state, 0))
135 {
136 case IPP_PRINTER_IDLE:
137 attributes->state = g_strdup (_("Idle"));
138 @@ -425,7 +459,7 @@
139 ippFindAttribute (answer, "printer-location", IPP_TAG_ZERO);
140 if ( NULL != location )
141 {
142 - attributes->location = g_strdup (location->values[0].string.text);
143 + attributes->location = g_strdup (ippGetString (location, 0, NULL));
144 }
145
146 ippDelete (answer);
|