wok-6.x view epdfview/stuff/0001-When-using-Poppler-0.17.0-I-needed-to-swap-the-blue-.patch @ rev 14853

x11vnc: fix genpkg_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 18 10:50:13 2013 +0000 (2013-07-18)
parents
children
line source
1 From d30496f52b85f82947bd07b9bd60f8482843ece8 Mon Sep 17 00:00:00 2001
2 From: jordi <jordi@cb4bfb15-1111-0410-82e2-95233c8f1c7e>
3 Date: Tue, 5 Jul 2011 09:23:38 +0000
4 Subject: [PATCH 1/2] When using Poppler 0.17.0, I needed to swap the blue and
5 red channels, otherwise the colors (other than black
6 and white) looked wierd.
8 git-svn-id: svn://svn.emma-soft.com/epdfview/trunk@367 cb4bfb15-1111-0410-82e2-95233c8f1c7e
9 ---
10 src/PDFDocument.cxx | 20 ++++++++++++++++++++
11 1 files changed, 20 insertions(+), 0 deletions(-)
13 diff --git a/src/PDFDocument.cxx b/src/PDFDocument.cxx
14 index df5d75f..63b3513 100644
15 --- a/src/PDFDocument.cxx
16 +++ b/src/PDFDocument.cxx
17 @@ -20,6 +20,7 @@
18 #include <time.h>
19 #include <poppler.h>
20 #include <unistd.h>
21 +#include <algorithm>
22 #include "epdfview.h"
24 using namespace ePDFView;
25 @@ -33,6 +34,24 @@ static PageLayout convertPageLayout (gint pageLayout);
26 static PageMode convertPageMode (gint pageMode);
27 static gchar *getAbsoluteFileName (const gchar *fileName);
29 +namespace
30 +{
31 + void
32 + convert_bgra_to_rgba (guint8 *data, int width, int height)
33 + {
34 + using std::swap;
35 +
36 + for (int y = 0; y < height; y++)
37 + {
38 + for (int x = 0; x < width; x++)
39 + {
40 + swap(data[0], data[2]);
41 + data += 4;
42 + }
43 + }
44 + }
45 +}
46 +
47 ///
48 /// @brief Constructs a new PDFDocument object.
49 ///
50 @@ -650,6 +669,7 @@ PDFDocument::renderPage (gint pageNum)
51 poppler_page_render (page, context);
52 cairo_destroy(context);
53 cairo_surface_destroy (surface);
54 + convert_bgra_to_rgba(renderedPage->getData (), width, height);
55 #else // !HAVE_POPPLER_0_17_0
56 // Create the pixbuf from the data and render to it.
57 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (renderedPage->getData (),
58 --
59 1.7.7