From: Adrian Johnson <ajohnson@redneon.com>
authorAdrian Johnson <ajohnson@redneon.com>
Fri, 21 Sep 2012 15:18:42 +1200
changeset 108467 1b9a99a17afbd93f63df8c57918e813a1aa2e4c5
parent 108466 2fb8343e929fcb8bb9c58793e6933ddc2cfe44ff
child 108468 74493ca34d5ec9afe6680e9dbdc4c3d027857376
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
bugs691061
milestone18.0a1
From: Adrian Johnson <ajohnson@redneon.com> Bug 691061 - Check if EXTEND_PAD group can be painted with EXTEND_NONE. r=jmuizelaar
gfx/cairo/cairo/src/cairo-pdf-surface.c
--- a/gfx/cairo/cairo/src/cairo-pdf-surface.c
+++ b/gfx/cairo/cairo/src/cairo-pdf-surface.c
@@ -5309,20 +5309,38 @@ static cairo_int_status_t
     if (! _pattern_supported (pattern))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     if (_pdf_operator_supported (op)) {
 	if (pattern->type == CAIRO_PATTERN_TYPE_SURFACE) {
 	    cairo_surface_pattern_t *surface_pattern = (cairo_surface_pattern_t *) pattern;
 
 	    if (surface_pattern->surface->type == CAIRO_SURFACE_TYPE_RECORDING) {
-		if (pattern->extend == CAIRO_EXTEND_PAD)
-		    return CAIRO_INT_STATUS_UNSUPPORTED;
-		else
-		    return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
+		if (pattern->extend == CAIRO_EXTEND_PAD) {
+		    cairo_box_t box;
+		    cairo_rectangle_int_t rect;
+		    cairo_rectangle_int_t rec_extents;
+
+		    /* get the operation extents in pattern space */
+		    _cairo_box_from_rectangle (&box, extents);
+		    _cairo_matrix_transform_bounding_box_fixed (&pattern->matrix, &box, NULL);
+		    _cairo_box_round_to_rectangle (&box, &rect);
+
+		    /* Check if surface needs padding to fill extents */
+		    if (_cairo_surface_get_extents (surface_pattern->surface, &rec_extents)) {
+			if (_cairo_fixed_integer_ceil(box.p1.x) < rec_extents.x ||
+			    _cairo_fixed_integer_ceil(box.p1.y) < rec_extents.y ||
+			    _cairo_fixed_integer_floor(box.p2.y) > rec_extents.x + rec_extents.width ||
+			    _cairo_fixed_integer_floor(box.p2.y) > rec_extents.y + rec_extents.height)
+			{
+			    return CAIRO_INT_STATUS_UNSUPPORTED;
+			}
+		    }
+		}
+		return CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN;
 	    }
 	}
 
 	return CAIRO_STATUS_SUCCESS;
     }
 
 
     /* The SOURCE operator is supported if the pattern is opaque or if