blob: 282bfb184a81d9505d021c0c5866ce6d408400ba [file] [log] [blame]
Patrick Williamsb48b7b42016-08-17 15:04:38 -05001Imported from Debian 0.1.8-3
2
3Upstream-Status: Pending
4
5Index: trunk/src/PDFDocument.cxx
6===================================================================
7--- trunk/src/PDFDocument.cxx (revision 361)
8+++ trunk/src/PDFDocument.cxx (revision 367)
9@@ -21,4 +21,5 @@
10 #include <poppler.h>
11 #include <unistd.h>
12+#include <algorithm>
13 #include "epdfview.h"
14
15@@ -33,4 +34,22 @@
16 static PageMode convertPageMode (gint pageMode);
17 static gchar *getAbsoluteFileName (const gchar *fileName);
18+
19+namespace
20+{
21+ void
22+ convert_bgra_to_rgba (guint8 *data, int width, int height)
23+ {
24+ using std::swap;
25+
26+ for (int y = 0; y < height; y++)
27+ {
28+ for (int x = 0; x < width; x++)
29+ {
30+ swap(data[0], data[2]);
31+ data += 4;
32+ }
33+ }
34+ }
35+}
36
37 ///
38@@ -651,4 +670,5 @@
39 cairo_destroy(context);
40 cairo_surface_destroy (surface);
41+ convert_bgra_to_rgba(renderedPage->getData (), width, height);
42 #else // !HAVE_POPPLER_0_17_0
43 // Create the pixbuf from the data and render to it.