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,