[poppler] poppler/CairoOutputDev.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Fri Jul 9 03:31:35 PDT 2010


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

New commits:
commit 1e7f457ca1617fd8c958feef8dd7e694476dedd9
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date:   Fri Jul 9 12:29:14 2010 +0200

    [cairo] Use ceil to convert double to int in tilingPatternFill()
    
    Fixes rendering of page 2 of document attached to bug #28954.

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 01ff92c..65fac76 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -718,6 +718,7 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Object *str,
   cairo_t *old_cairo;
   double xMin, yMin, xMax, yMax;
   double width, height;
+  int surface_width, surface_height;
 
   width = bbox[2] - bbox[0];
   height = bbox[3] - bbox[1];
@@ -726,9 +727,12 @@ GBool CairoOutputDev::tilingPatternFill(GfxState *state, Object *str,
     return gFalse;
   /* TODO: implement the other cases here too */
 
+  surface_width = (int) ceil (width);
+  surface_height = (int) ceil (height);
+
   surface = cairo_surface_create_similar (cairo_get_target (cairo),
 					  CAIRO_CONTENT_COLOR_ALPHA,
-					  width, height);
+					  surface_width, surface_height);
   if (cairo_surface_status (surface))
     return gFalse;
 
@@ -751,7 +755,7 @@ 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_matrix_init_scale (&matrix, surface_width / width, surface_height / height);
   cairo_pattern_set_matrix (pattern, &matrix);
 
   cairo_matrix_init (&matrix, mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]);


More information about the poppler mailing list