Annotation of /trunk/epdfview/patches/epdfview-0.1.8-swap-colors-with-poppler-0.18.patch
Parent Directory | Revision Log
Revision 1587 -
(hide annotations)
(download)
Tue Nov 29 19:50:00 2011 UTC (12 years, 10 months ago) by niro
File size: 1430 byte(s)
Tue Nov 29 19:50:00 2011 UTC (12 years, 10 months ago) by niro
File size: 1430 byte(s)
-added epdfview patches
1 | niro | 1587 | Swap color channels to fix pictures with poppler 0.18 |
2 | |||
3 | Upstream: http://trac.emma-soft.com/epdfview/changeset/367/trunk | ||
4 | Fixes bug: https://bugzilla.redhat.com/show_bug.cgi?id=745483 | ||
5 | |||
6 | Index: src/PDFDocument.cxx | ||
7 | =================================================================== | ||
8 | --- src/PDFDocument.cxx (revision 366) | ||
9 | +++ src/PDFDocument.cxx (revision 367) | ||
10 | @@ -20,6 +20,7 @@ | ||
11 | #include <time.h> | ||
12 | #include <poppler.h> | ||
13 | #include <unistd.h> | ||
14 | +#include <algorithm> | ||
15 | #include "epdfview.h" | ||
16 | |||
17 | using namespace ePDFView; | ||
18 | @@ -33,6 +34,24 @@ | ||
19 | static PageMode convertPageMode (gint pageMode); | ||
20 | static gchar *getAbsoluteFileName (const gchar *fileName); | ||
21 | |||
22 | +namespace | ||
23 | +{ | ||
24 | + void | ||
25 | + convert_bgra_to_rgba (guint8 *data, int width, int height) | ||
26 | + { | ||
27 | + using std::swap; | ||
28 | + | ||
29 | + for (int y = 0; y < height; y++) | ||
30 | + { | ||
31 | + for (int x = 0; x < width; x++) | ||
32 | + { | ||
33 | + swap(data[0], data[2]); | ||
34 | + data += 4; | ||
35 | + } | ||
36 | + } | ||
37 | + } | ||
38 | +} | ||
39 | + | ||
40 | /// | ||
41 | /// @brief Constructs a new PDFDocument object. | ||
42 | /// | ||
43 | @@ -650,6 +669,7 @@ | ||
44 | poppler_page_render (page, context); | ||
45 | cairo_destroy(context); | ||
46 | cairo_surface_destroy (surface); | ||
47 | + convert_bgra_to_rgba(renderedPage->getData (), width, height); | ||
48 | #else // !HAVE_POPPLER_0_17_0 | ||
49 | // Create the pixbuf from the data and render to it. | ||
50 | GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (renderedPage->getData (), |