[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.
This commit is contained in:
Chris Wilson 2007-10-16 10:29:45 +01:00
parent 7ff80234e3
commit a55f1abf7c

View file

@ -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,