On Fri, Jan 13, 2012 at 12:51:24AM -0500, Brynet wrote:
> On Thu, Jan 12, 2012 at 10:14:31PM -0500, James Turner wrote:
> > Attached is a update to epdfview to fix an issue where blues and reds
> > are switched. Patch taken from [0]. Even though we are running a newer
> > version of poppler the issue still seems to exist.
> 
> Yeah, the author of epdfview doesn't do releases often, so any bugs fixes 
> from 
> upstream should be fine.
> 
> You should add a comment here with a link to the commit, like the others we 
> had 
> for 1.7 (..check the Attic).
> 
> I haven't tested, but assuming it doesn't break anything...
> 
> -Bryan.
> 

New diff attached with a comment in the new patch.

-- 
James Turner
ja...@calminferno.net
Index: Makefile
===================================================================
RCS file: /cvs/ports/print/epdfview/Makefile,v
retrieving revision 1.25
diff -N -u -p Makefile
--- Makefile    3 Dec 2011 23:04:37 -0000       1.25
+++ Makefile    13 Jan 2012 15:34:01 -0000
@@ -3,7 +3,7 @@
 COMMENT=       lightweight PDF document viewer
 
 DISTNAME=      epdfview-0.1.8
-REVISION=      1
+REVISION=      2
 CATEGORIES=    print
 HOMEPAGE=      http://trac.emma-soft.com/epdfview/
 
Index: patches/patch-src_PDFDocument_cxx
===================================================================
RCS file: /cvs/ports/print/epdfview/patches/Attic/patch-src_PDFDocument_cxx,v
diff -N -u -p patches/patch-src_PDFDocument_cxx
--- /dev/null   13 Jan 2012 08:34:02 -0000
+++ patches/patch-src_PDFDocument_cxx   13 Jan 2012 15:34:01 -0000
@@ -0,0 +1,48 @@
+$OpenBSD$
+
+Fixes a bug with poppler swapping the blue and red channels.
+http://trac.emma-soft.com/epdfview/changeset/367 
+
+--- src/PDFDocument.cxx.orig   Sat May 28 06:25:01 2011
++++ src/PDFDocument.cxx        Thu Jan 12 22:08:15 2012
+@@ -20,6 +20,7 @@
+ #include <time.h>
+ #include <poppler.h>
+ #include <unistd.h>
++#include <algorithm>
+ #include "epdfview.h"
+ 
+ using namespace ePDFView;
+@@ -33,6 +34,24 @@ static PageLayout convertPageLayout (gint pageLayout);
+ static PageMode convertPageMode (gint pageMode);
+ static gchar *getAbsoluteFileName (const gchar *fileName);
+ 
++namespace
++{
++      void
++      convert_bgra_to_rgba (guint8 *data, int width, int height)
++      {
++              using std::swap;
++
++              for (int y = 0; y < height; y++)
++              {
++                      for (int x = 0; x < width; x++)
++                      {
++                              swap(data[0], data[2]);
++                              data += 4;
++                      }
++              }
++      }
++}
++
+ ///
+ /// @brief Constructs a new PDFDocument object.
+ ///
+@@ -650,6 +669,7 @@ PDFDocument::renderPage (gint pageNum)
+         poppler_page_render (page, context);
+         cairo_destroy(context);
+         cairo_surface_destroy (surface);
++      convert_bgra_to_rgba(renderedPage->getData (), width, height);
+ #else // !HAVE_POPPLER_0_17_0
+         // Create the pixbuf from the data and render to it.
+         GdkPixbuf *pixbuf = gdk_pixbuf_new_from_data (renderedPage->getData 
(),

Reply via email to