[cairo-commit] cairo/src cairo-clip.c,1.4,1.5

Tim Rowley commit at pdx.freedesktop.org
Wed Oct 12 15:05:12 PDT 2005


Committed by: tor

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv2385/src

Modified Files:
	cairo-clip.c 
Log Message:
	Reviewed by: cworth

	* src/cairo-clip.c (_cairo_clip_intersect_mask):  Intersect clip
	region with target surface so we don't waste time and memory.


Index: cairo-clip.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-clip.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cairo-clip.c	17 Aug 2005 01:22:16 -0000	1.4
+++ cairo-clip.c	12 Oct 2005 22:05:09 -0000	1.5
@@ -319,7 +319,7 @@
 {
     cairo_pattern_union_t pattern;
     cairo_box_t extents;
-    cairo_rectangle_t surface_rect;
+    cairo_rectangle_t surface_rect, target_rect;
     cairo_surface_t *surface;
     cairo_status_t status;
 
@@ -333,6 +333,13 @@
     if (clip->surface != NULL)
 	_cairo_rectangle_intersect (&surface_rect, &clip->surface_rect);
 
+    /* Intersect with the target surface rectangle so we don't use
+     * more memory and time than we need to. */
+
+    status = _cairo_surface_get_extents (target, &target_rect);
+    if (!status)
+	_cairo_rectangle_intersect (&surface_rect, &target_rect);
+
     surface = _cairo_surface_create_similar_solid (target,
 						   CAIRO_CONTENT_ALPHA,
 						   surface_rect.width,



More information about the cairo-commit mailing list