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

Chris Wilson ickle at kemper.freedesktop.org
Sun Feb 28 01:11:04 PST 2010


 src/cairo-image-surface.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit 620cd9c2be4a6bef790e6818652470a5c53d578d
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Feb 28 09:09:20 2010 +0000

    image: Allow reduction of repeat modes for unity scaled patterns.

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 9b86419..9d74350 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1196,6 +1196,7 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
 			   int *ix, int *iy)
 {
     pixman_image_t *pixman_image;
+    cairo_bool_t is_pixel_exact;
     cairo_extend_t extend;
     double tx, ty;
 
@@ -1203,13 +1204,12 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
     ty = pattern->base.matrix.y0;
 
     extend = pattern->base.extend;
+    is_pixel_exact = _cairo_matrix_is_pixel_exact (&pattern->base.matrix);
 
     pixman_image = NULL;
     if (pattern->surface->type == CAIRO_SURFACE_TYPE_IMAGE) {
 	cairo_image_surface_t *source = (cairo_image_surface_t *) pattern->surface;
 	cairo_surface_type_t type;
-	cairo_bool_t has_identity_transform =
-	    _cairo_matrix_is_identity (&pattern->base.matrix);
 
 	if (source->base.backend->type == CAIRO_INTERNAL_SURFACE_TYPE_SNAPSHOT)
 	    source = (cairo_image_surface_t *) ((cairo_surface_snapshot_t *) pattern->surface)->target;
@@ -1217,7 +1217,7 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
 	type = source->base.backend->type;
 	if (type == CAIRO_SURFACE_TYPE_IMAGE) {
 	    if (extend != CAIRO_EXTEND_NONE &&
-		has_identity_transform &&
+		is_pixel_exact &&
 		extents->x >= 0 && extents->y >= 0 &&
 		extents->x + extents->width  <= source->width &&
 		extents->y + extents->height <= source->height)
@@ -1250,7 +1250,7 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
 	    source = (cairo_image_surface_t *) sub->target;
 
 	    if (extend != CAIRO_EXTEND_NONE &&
-		has_identity_transform &&
+		is_pixel_exact &&
 		extents->x >= 0 && extents->y >= 0 &&
 		extents->x + extents->width  <= sub->extents.width &&
 		extents->y + extents->height <= sub->extents.height)
@@ -1301,6 +1301,7 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
 
 	source = cleanup->image;
 	if (extend != CAIRO_EXTEND_NONE &&
+	    is_pixel_exact &&
 	    extents->x >= 0 && extents->y >= 0 &&
 	    extents->x + extents->width <= source->width &&
 	    extents->y + extents->height <= source->height)


More information about the cairo-commit mailing list