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

罗晶华 Jinghua Luo jinghua at kemper.freedesktop.org
Tue Oct 24 22:29:18 PDT 2006


 src/cairo-glitz-surface.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

New commits:
diff-tree 804e5b58cd3a4032bfa1d0c8cccac92a70c3c635 (from 69f740913d6841708831668ef2a3bf124f373031)
Author: Jinghua Luo <sunmoon1997 at gmail.com>
Date:   Wed Oct 25 13:29:06 2006 +0800

    glitz: further fix for clone_similar.
    
    Don't try to get pixels outside image extent. The failure number of
    tests cut down to 19 with this fix, not too bad;).

diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index 49b2dae..940802c 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -391,6 +391,8 @@ _cairo_glitz_surface_clone_similar (void
     {
 	cairo_image_surface_t *image_src = (cairo_image_surface_t *) src;
 	cairo_content_t	      content;
+	cairo_rectangle_int16_t image_extent;
+	cairo_rectangle_int16_t extent;
 
 	content = _cairo_content_from_format (image_src->format);
 
@@ -401,8 +403,21 @@ _cairo_glitz_surface_clone_similar (void
 	if (clone->base.status)
 	    return CAIRO_STATUS_NO_MEMORY;
 
-	_cairo_glitz_surface_set_image (clone, image_src, src_x, src_y,
-					width, height, src_x, src_y);
+	image_extent.x = 0;
+	image_extent.y = 0;
+	image_extent.width = image_src->width;
+	image_extent.height = image_src->height;
+	extent.x = src_x;
+	extent.y = src_y;
+	extent.width = width;
+	extent.height = height;
+
+	_cairo_rectangle_intersect(&extent, &image_extent);
+
+	_cairo_glitz_surface_set_image (clone, image_src,
+					extent.x, extent.y,
+					extent.width, extent.height,
+					extent.x, extent.y);
 
 	*clone_out = &clone->base;
 


More information about the cairo-commit mailing list