Patrick Williams | b48b7b4 | 2016-08-17 15:04:38 -0500 | [diff] [blame^] | 1 | Imported from Debian 0.1.8-3 |
| 2 | |
| 3 | Upstream-Status: Pending |
| 4 | |
| 5 | Index: 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. |