summaryrefslogtreecommitdiff
path: root/src/cairo-surface-subsurface.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-11 12:42:53 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-11 12:43:44 +0000
commitdc80e8328ce8be6414d6483a51bce074f6e740b0 (patch)
tree8d67c2347200f343f99612ff103e9cbe5cba161e /src/cairo-surface-subsurface.c
parent9e4fb906b8ab3ac3ddf5372257112bc2afa62df1 (diff)
downloadcairo-dc80e8328ce8be6414d6483a51bce074f6e740b0.tar.gz
subsurface: Add guards for creating similar surface
If the target backend doesn't provide the entry points, just return NULL (unsupported). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-surface-subsurface.c')
-rw-r--r--src/cairo-surface-subsurface.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c
index 09f49d08c..b2f7e0a10 100644
--- a/src/cairo-surface-subsurface.c
+++ b/src/cairo-surface-subsurface.c
@@ -61,6 +61,10 @@ _cairo_surface_subsurface_create_similar (void *other,
int width, int height)
{
cairo_surface_subsurface_t *surface = other;
+
+ if (surface->target->backend->create_similar == NULL)
+ return NULL;
+
return surface->target->backend->create_similar (surface->target, content, width, height);
}
@@ -70,6 +74,10 @@ _cairo_surface_subsurface_create_similar_image (void *other,
int width, int height)
{
cairo_surface_subsurface_t *surface = other;
+
+ if (surface->target->backend->create_similar_image == NULL)
+ return NULL;
+
return surface->target->backend->create_similar_image (surface->target,
format,
width, height);