[poppler] poppler/CairoOutputDev.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Mon Nov 9 09:37:24 PST 2009


 poppler/CairoOutputDev.cc |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit c59d93061cf71d13916872a20aed37ecfbb3bfa4
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Mon Nov 9 18:32:55 2009 +0100

    [cairo] Do nothing when image mask is 1x1 and the pixel is 0

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index ec9aaa5..5f283c3 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1328,6 +1328,20 @@ void CairoOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *str,
 
   /* work around a cairo bug when scaling 1x1 surfaces */
   if (width == 1 && height == 1) {
+    ImageStream *imgStr;
+    Guchar pix;
+    int invert_bit;
+
+    imgStr = new ImageStream(str, width, 1, 1);
+    imgStr->reset();
+    imgStr->getPixel(&pix);
+    imgStr->close();
+    delete imgStr;
+
+    invert_bit = invert ? 1 : 0;
+    if (pix ^ invert_bit)
+      return;
+
     cairo_save (cairo);
     cairo_rectangle (cairo, 0., 0., width, height);
     cairo_fill (cairo);


More information about the poppler mailing list