[cairo-pattern] Fall back on cairo_surface_create_similar in _cairo_pattern_acquire_surface_for_surface

This was needed for SVG backend because it does not implement clone_similar.
However, I'm worried about possible infinite recursion here.  Not sure what
to do.
This commit is contained in:
Behdad Esfahbod 2007-02-22 12:56:05 -05:00
parent 5562050bcf
commit 7cbfb9556d

View file

@ -1414,6 +1414,24 @@ _cairo_pattern_acquire_surface_for_surface (cairo_surface_pattern_t *pattern,
status = _cairo_surface_clone_similar (dst, pattern->surface,
x, y, width, height, out);
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
cairo_t *cr;
*out = cairo_surface_create_similar (dst, dst->content,
width, height);
if (!*out)
return CAIRO_STATUS_NO_MEMORY;
cr = cairo_create (*out);
cairo_set_source_surface (cr, pattern->surface, -x, -y);
cairo_paint (cr);
status = cairo_status (cr);
cairo_destroy (cr);
}
}
return status;