From c2c637cf1d89fc8fdcced4467d602a55ef0b14e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Sat, 28 Mar 2009 04:26:10 -0400 Subject: [PATCH] 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. --- src/cairo-clip.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/cairo-clip.c b/src/cairo-clip.c index 9aac11543..9455c2889 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, + ®ion); + } else { status = _cairo_region_copy (&clip->region, ®ion); 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, - ®ion); - - if (status == CAIRO_STATUS_SUCCESS) - status = _cairo_region_copy (&clip->region, &intersection); - - _cairo_region_fini (&intersection); } clip->serial = _cairo_surface_allocate_clip_serial (target);