[poppler] poppler/CairoOutputDev.cc poppler/CairoOutputDev.h

Adrian Johnson ajohnson at kemper.freedesktop.org
Wed Nov 21 14:18:21 PST 2012


 poppler/CairoOutputDev.cc |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 poppler/CairoOutputDev.h  |    5 +++++
 2 files changed, 51 insertions(+)

New commits:
commit e0d0177562ff546b59b3bc8eb68a08dc740d6f6c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Nov 14 22:44:20 2012 +1030

    cairo: Fix crash in CairoImageOutputDev with setSoftMaskFromImageMask
    
    Bug 57067

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index d29cbbe..456f826 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -3005,6 +3005,52 @@ void CairoImageOutputDev::drawImageMask(GfxState *state, Object *ref, Stream *st
   }
 }
 
+void CairoImageOutputDev::setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str,
+                                                   int width, int height, GBool invert,
+                                                   GBool inlineImg, double *baseMatrix)
+{
+  cairo_t *cr;
+  cairo_surface_t *surface;
+  double x1, y1, x2, y2;
+  double *ctm;
+  double mat[6];
+  CairoImage *image;
+
+  ctm = state->getCTM();
+
+  mat[0] = ctm[0];
+  mat[1] = ctm[1];
+  mat[2] = -ctm[2];
+  mat[3] = -ctm[3];
+  mat[4] = ctm[2] + ctm[4];
+  mat[5] = ctm[3] + ctm[5];
+  x1 = mat[4];
+  y1 = mat[5];
+  x2 = x1 + width;
+  y2 = y1 + height;
+
+  image = new CairoImage (x1, y1, x2, y2);
+  saveImage (image);
+
+  if (imgDrawCbk && imgDrawCbk (numImages - 1, imgDrawCbkData)) {
+    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+    cr = cairo_create (surface);
+    setCairo (cr);
+    cairo_translate (cr, 0, height);
+    cairo_scale (cr, width, -height);
+
+    CairoOutputDev::drawImageMask(state, ref, str, width, height, invert, inlineImg, gFalse);
+    if (state->getFillColorSpace()->getMode() == csPattern) {
+      cairo_mask (cairo, mask);
+    }
+    image->setImage (surface);
+
+    setCairo (NULL);
+    cairo_surface_destroy (surface);
+    cairo_destroy (cr);
+  }
+}
+
 void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 				    int width, int height, GfxImageColorMap *colorMap,
 				    GBool interpolate, int *maskColors, GBool inlineImg)
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index df76975..a699a7b 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -465,6 +465,11 @@ public:
 			       Stream *maskStr,
 			       int maskWidth, int maskHeight,
 			       GBool maskInvert, GBool maskInterpolate);
+  virtual void setSoftMaskFromImageMask(GfxState *state, Object *ref, Stream *str,
+                                        int width, int height, GBool invert,
+                                        GBool inlineImg, double *baseMatrix);
+  virtual void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) {}
+
 
   //----- transparency groups and soft masks
   virtual void beginTransparencyGroup(GfxState * /*state*/, double * /*bbox*/,


More information about the poppler mailing list