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