[cairo-commit] src/cairo-clip.c

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Sat Mar 28 01:43:04 PDT 2009


 src/cairo-clip.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

New commits:
commit c2c637cf1d89fc8fdcced4467d602a55ef0b14e0
Author: Søren Sandmann Pedersen <sandmann at redhat.com>
Date:   Sat Mar 28 04:26:10 2009 -0400

    Simplify _cairo_clip_intersect_region()
    
    The intermediate intersection region is not necessary because if the
    operation fails, clip->region will end up as a pixman error region.

diff --git a/src/cairo-clip.c b/src/cairo-clip.c
index 9aac115..9455c28 100644
--- a/src/cairo-clip.c
+++ b/src/cairo-clip.c
@@ -357,23 +357,14 @@ _cairo_clip_intersect_region (cairo_clip_t    *clip,
     if (status)
 	return status;
 
-    if (!clip->has_region) {
+    if (clip->has_region) {
+	status = _cairo_region_intersect (&clip->region,
+					  &clip->region,
+					  &region);
+    } else {
         status = _cairo_region_copy (&clip->region, &region);
 	if (status == CAIRO_STATUS_SUCCESS)
 	    clip->has_region = TRUE;
-    } else {
-	cairo_region_t intersection;
-
-        _cairo_region_init (&intersection);
-
-	status = _cairo_region_intersect (&intersection,
-		                         &clip->region,
-		                         &region);
-
-	if (status == CAIRO_STATUS_SUCCESS)
-	    status = _cairo_region_copy (&clip->region, &intersection);
-
-        _cairo_region_fini (&intersection);
     }
 
     clip->serial = _cairo_surface_allocate_clip_serial (target);


More information about the cairo-commit mailing list