wok diff epdfview/stuff/0001-When-using-Poppler-0.17.0-I-needed-to-swap-the-blue-.patch @ rev 14439
Add py-asterisk
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu Apr 25 12:56:19 2013 +0200 (2013-04-25) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/epdfview/stuff/0001-When-using-Poppler-0.17.0-I-needed-to-swap-the-blue-.patch Thu Apr 25 12:56:19 2013 +0200 1.3 @@ -0,0 +1,59 @@ 1.4 +From d30496f52b85f82947bd07b9bd60f8482843ece8 Mon Sep 17 00:00:00 2001 1.5 +From: jordi <jordi@cb4bfb15-1111-0410-82e2-95233c8f1c7e> 1.6 +Date: Tue, 5 Jul 2011 09:23:38 +0000 1.7 +Subject: [PATCH 1/2] When using Poppler 0.17.0, I needed to swap the blue and 1.8 + red channels, otherwise the colors (other than black 1.9 + and white) looked wierd. 1.10 + 1.11 +git-svn-id: svn://svn.emma-soft.com/epdfview/trunk@367 cb4bfb15-1111-0410-82e2-95233c8f1c7e 1.12 +--- 1.13 + src/PDFDocument.cxx | 20 ++++++++++++++++++++ 1.14 + 1 files changed, 20 insertions(+), 0 deletions(-) 1.15 + 1.16 +diff --git a/src/PDFDocument.cxx b/src/PDFDocument.cxx 1.17 +index df5d75f..63b3513 100644 1.18 +--- a/src/PDFDocument.cxx 1.19 ++++ b/src/PDFDocument.cxx 1.20 +@@ -20,6 +20,7 @@ 1.21 + #include <time.h> 1.22 + #include <poppler.h> 1.23 + #include <unistd.h> 1.24 ++#include <algorithm> 1.25 + #include "epdfview.h" 1.26 + 1.27 + using namespace ePDFView; 1.28 +@@ -33,6 +34,24 @@ static PageLayout convertPageLayout (gint pageLayout); 1.29 + static PageMode convertPageMode (gint pageMode); 1.30 + static gchar *getAbsoluteFileName (const gchar *fileName); 1.31 + 1.32 ++namespace 1.33 ++{ 1.34 ++ void 1.35 ++ convert_bgra_to_rgba (guint8 *data, int width, int height) 1.36 ++ { 1.37 ++ using std::swap; 1.38 ++ 1.39 ++ for (int y = 0; y < height; y++) 1.40 ++ { 1.41 ++ for (int x = 0; x < width; x++) 1.42 ++ { 1.43 ++ swap(data[0], data[2]); 1.44 ++ data += 4; 1.45 ++ } 1.46 ++ } 1.47 ++ } 1.48 ++} 1.49 ++ 1.50 + /// 1.51 + /// @brief Constructs a new PDFDocument object. 1.52 + /// 1.53 +@@ -650,6 +669,7 @@ PDFDocument::renderPage (gint pageNum) 1.54 + poppler_page_render (page, context); 1.55 + cairo_destroy(context); 1.56 + cairo_surface_destroy (surface); 1.57 ++ convert_bgra_to_rgba(renderedPage->getData (), width, height); 1.58 + #else // !HAVE_POPPLER_0_17_0 1.59 + // Create the pixbuf from the data and render to it. 1.60 + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (renderedPage->getData (), 1.61 +-- 1.62 +1.7.7