From a55f1abf7cdc0276fe1eb85db969f33d0df4fe75 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Tue, 16 Oct 2007 10:29:45 +0100 Subject: [PATCH] [cairo-clip] Pass the local pattern to create_similar_solid(). Avoid the short-lived pattern allocation within _cairo_surface_create_similar_solid() by providing the local solid pattern to use as the source. --- src/cairo-clip.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/cairo-clip.c b/src/cairo-clip.c index a48f4c475..387e26ea3 100644 --- a/src/cairo-clip.c +++ b/src/cairo-clip.c @@ -395,20 +395,22 @@ _cairo_clip_intersect_mask (cairo_clip_t *clip, if (!status) _cairo_rectangle_intersect (&surface_rect, &target_rect); + _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE, + CAIRO_CONTENT_COLOR); surface = _cairo_surface_create_similar_solid (target, CAIRO_CONTENT_ALPHA, surface_rect.width, surface_rect.height, CAIRO_COLOR_WHITE, - NULL); - if (surface->status) - return _cairo_error (CAIRO_STATUS_NO_MEMORY); + &pattern.base); + if (surface->status) { + _cairo_pattern_fini (&pattern.base); + return surface->status; + } /* Render the new clipping path into the new mask surface. */ _cairo_traps_translate (traps, -surface_rect.x, -surface_rect.y); - _cairo_pattern_init_solid (&pattern.solid, CAIRO_COLOR_WHITE, - CAIRO_CONTENT_COLOR); status = _cairo_surface_composite_trapezoids (CAIRO_OPERATOR_IN, &pattern.base,