[cairo-commit] src/cairo-pdf-surface.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Wed May 16 04:29:37 PDT 2012


 src/cairo-pdf-surface.c |   26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

New commits:
commit 50f08352f463d86022a0d7544d461fe2e5ac9076
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed May 16 20:55:17 2012 +0930

    pdf: check if EXTEND_PAD group can be painted with EXTEND_NONE
    
    to avoid the fallback

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index a017601..8726d7c 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -6270,10 +6270,28 @@ _cairo_pdf_surface_analyze_operation (cairo_pdf_surface_t  *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;
 	    }
 	}
 


More information about the cairo-commit mailing list