[poppler] poppler/CairoOutputDev.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Wed Apr 21 03:43:32 PDT 2010


 poppler/CairoOutputDev.cc |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 4f71d64c69500ed78daf4d797c8af6cfbd3d970e
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Wed Apr 21 11:44:49 2010 +0200

    [cairo] Fix pattern size when bbox is not at 0,0

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 845bf9d..768fbba 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -716,14 +716,18 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Object *str,
   cairo_matrix_t matrix;
   cairo_t *old_cairo;
   double xMin, yMin, xMax, yMax;
+  double width, height;
 
-  if (xStep != bbox[2] || yStep != bbox[3])
+  width = bbox[2] - bbox[0];
+  height = bbox[3] - bbox[1];
+
+  if (xStep != width || yStep != height)
     return gFalse;
   /* TODO: implement the other cases here too */
 
   surface = cairo_surface_create_similar (cairo_get_target (cairo),
 					  CAIRO_CONTENT_COLOR_ALPHA,
-					  bbox[2], bbox[3]);
+					  width, height);
   if (cairo_surface_status (surface))
     return gFalse;
 
@@ -746,6 +750,9 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Object *str,
   state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax);
   cairo_rectangle (cairo, xMin, yMin, xMax - xMin, yMax - yMin);
 
+  cairo_matrix_init_scale (&matrix, (int)width / width, (int)height / height);
+  cairo_pattern_set_matrix (pattern, &matrix);
+
   cairo_matrix_init (&matrix, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);
   cairo_transform (cairo, &matrix);
   cairo_set_source (cairo, pattern);


More information about the poppler mailing list