diff options
-rw-r--r-- | src/cairo-clip-private.h | 1 | ||||
-rw-r--r-- | src/cairo-clip.c | 36 | ||||
-rw-r--r-- | src/cairo-surface.c | 2 |
3 files changed, 16 insertions, 23 deletions
diff --git a/src/cairo-clip-private.h b/src/cairo-clip-private.h index 517c28cfd..b1a9d1af4 100644 --- a/src/cairo-clip-private.h +++ b/src/cairo-clip-private.h @@ -79,7 +79,6 @@ struct _cairo_clip { * A clip region that can be placed in the surface */ cairo_region_t *region; - cairo_bool_t has_region; /* * If the surface supports path clipping, we store the list of * clipping paths that has been set here as a linked list. diff --git a/src/cairo-clip.c b/src/cairo-clip.c index 095af10b8..75348810f 100644 --- a/src/cairo-clip.c +++ b/src/cairo-clip.c @@ -72,34 +72,30 @@ _cairo_clip_init (cairo_clip_t *clip, cairo_surface_t *target) cairo_status_t _cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other) { - cairo_status_t status; - clip->mode = other->mode; clip->all_clipped = other->all_clipped; - + clip->surface = cairo_surface_reference (other->surface); clip->surface_rect = other->surface_rect; clip->serial = other->serial; - if (other->has_region) { - clip->has_region = TRUE; + if (other->region) { + cairo_status_t status; clip->region = _cairo_region_copy (other->region); - } else { - clip->has_region = FALSE; - - clip->region = _cairo_region_create (); - } - status = _cairo_region_status (clip->region); - if (unlikely (status)) { - cairo_surface_destroy (clip->surface); - _cairo_region_destroy (clip->region); + status = _cairo_region_status (clip->region); + if (unlikely (status)) { + cairo_surface_destroy (clip->surface); + _cairo_region_destroy (clip->region); + clip->region = NULL; + + return status; + } + } else { clip->region = NULL; - - return status; } clip->path = _cairo_clip_path_reference (other->path); @@ -118,10 +114,10 @@ _cairo_clip_reset (cairo_clip_t *clip) clip->serial = 0; - if (clip->has_region) { - _cairo_region_clear (clip->region); + if (clip->region) { + _cairo_region_destroy (clip->region); - clip->has_region = FALSE; + clip->region = NULL; } _cairo_clip_path_destroy (clip->path); @@ -788,8 +784,6 @@ _cairo_clip_init_deep_copy (cairo_clip_t *clip, clip->region = _cairo_region_copy (other->region); if (unlikely ((status = _cairo_region_status (clip->region)))) goto BAIL; - - clip->has_region = TRUE; } if (other->surface) { diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 22e67f71e..635575ac8 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -2389,7 +2389,7 @@ _cairo_surface_set_clip (cairo_surface_t *surface, cairo_clip_t *clip) clip->path, clip->serial); - if (clip->has_region) + if (clip->region) return _cairo_surface_set_clip_region (surface, clip->region, clip->serial); |