From 7cbfb9556d869310c48c106a9929c292110685ce Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 22 Feb 2007 12:56:05 -0500 Subject: [PATCH] [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. --- src/cairo-pattern.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index c69528369..3d3d587e9 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -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;