diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-29 22:00:10 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-29 22:00:10 +0100 |
commit | 0ae32437af5e73ad61eba1447dd32dd525c39808 (patch) | |
tree | 9baa3fa161155be8d8db09e468b5ba0365df11ee | |
parent | 2342e4da4fdbeed5672d586742fa19cf1018264c (diff) |
image: Free clip_surface after use
The clip surface is no longer cached on the clip and the caller is
responsible for destroying it after use.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/cairo-image-surface.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 7a0ddc6d5..dc0320aba 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -1681,12 +1681,13 @@ _cairo_image_surface_fixup_unbounded (cairo_image_surface_t *dst, const cairo_composite_rectangles_t *rects, cairo_clip_t *clip) { + cairo_surface_t *clip_surface = NULL; pixman_image_t *mask = NULL; pixman_box32_t boxes[4]; int i, mask_x = 0, mask_y = 0, n_boxes = 0; + cairo_status_t status = CAIRO_STATUS_SUCCESS; if (clip != NULL) { - cairo_surface_t *clip_surface; int clip_x, clip_y; clip_surface = _cairo_clip_get_surface (clip, &dst->base, &clip_x, &clip_y); @@ -1726,10 +1727,11 @@ _cairo_image_surface_fixup_unbounded (cairo_image_surface_t *dst, dst->pixman_image, &color, 1, &box)) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); + status = _cairo_error (CAIRO_STATUS_NO_MEMORY); } - return CAIRO_STATUS_SUCCESS; + cairo_surface_destroy (clip_surface); + return status; } /* top */ @@ -1786,11 +1788,12 @@ _cairo_image_surface_fixup_unbounded (cairo_image_surface_t *dst, n_boxes, boxes)) { - return _cairo_error (CAIRO_STATUS_NO_MEMORY); + status = _cairo_error (CAIRO_STATUS_NO_MEMORY); } } - return CAIRO_STATUS_SUCCESS; + cairo_surface_destroy (clip_surface); + return status; } static cairo_status_t @@ -2155,6 +2158,7 @@ _clip_and_composite_combine (cairo_composite_rectangles_t *extents, extents->bounded.width, extents->bounded.height); } + cairo_surface_destroy (clip_surface); CLEANUP_SURFACE: pixman_image_unref (tmp); @@ -3083,12 +3087,12 @@ _composite_boxes (cairo_image_surface_t *dst, } else { + cairo_surface_t *clip_surface = NULL; pixman_image_t *src = NULL, *mask = NULL; int src_x, src_y, mask_x = 0, mask_y = 0; pixman_op_t pixman_op = _pixman_operator (op); if (need_clip_mask) { - cairo_surface_t *clip_surface; int clip_x, clip_y; clip_surface = _cairo_clip_get_surface (extents->clip, @@ -3106,16 +3110,16 @@ _composite_boxes (cairo_image_surface_t *dst, } mask = ((cairo_image_surface_t *) clip_surface)->pixman_image; - pixman_image_ref (mask); - cairo_surface_destroy (clip_surface); } if (pattern != NULL) { src = _pixman_image_for_pattern (pattern, FALSE, &extents->bounded, &dst->base.device_transform, &src_x, &src_y); - if (unlikely (src == NULL)) + if (unlikely (src == NULL)) { + cairo_surface_destroy (clip_surface); return _cairo_error (CAIRO_STATUS_NO_MEMORY); + } } else { src = mask; src_x = mask_x; @@ -3144,6 +3148,7 @@ _composite_boxes (cairo_image_surface_t *dst, } } + cairo_surface_destroy (clip_surface); if (pattern != NULL) pixman_image_unref (src); |