Changeset 367


Ignore:
Timestamp:
07/05/11 05:23:38 (11 months ago)
Author:
jordi
Message:

When using Poppler 0.17.0, I needed to swap the blue and red channels, otherwise the colors (other than black and white) looked wierd.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/PDFDocument.cxx

    r361 r367  
    2121#include <poppler.h> 
    2222#include <unistd.h> 
     23#include <algorithm> 
    2324#include "epdfview.h" 
    2425 
     
    3334static PageMode convertPageMode (gint pageMode); 
    3435static gchar *getAbsoluteFileName (const gchar *fileName); 
     36 
     37namespace 
     38{ 
     39    void 
     40    convert_bgra_to_rgba (guint8 *data, int width, int height) 
     41    { 
     42        using std::swap; 
     43 
     44        for (int y = 0; y < height; y++) 
     45        { 
     46            for (int x = 0; x < width; x++) 
     47            { 
     48                swap(data[0], data[2]); 
     49                data += 4; 
     50            } 
     51        } 
     52    } 
     53} 
    3554 
    3655/// 
     
    651670        cairo_destroy(context); 
    652671        cairo_surface_destroy (surface); 
     672        convert_bgra_to_rgba(renderedPage->getData (), width, height); 
    653673#else // !HAVE_POPPLER_0_17_0 
    654674        // Create the pixbuf from the data and render to it. 
Note: See TracChangeset for help on using the changeset viewer.