From 643834e7aa3e90678276453439017359ef942c9e Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 20 Dec 2007 17:51:48 +0000 Subject: [PATCH] [cairo-surface] Return UNSUPPORTED for acquire_(dest|source)_image. If the backend does not support fallbacks ie backend->acquire_dest_image or backend->acquire_source_image is NULL, then return CAIRO_INT_STATUS_UNSUPPORTED rather than attempt to jump to the NULL hooks. --- src/cairo-surface.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cairo-surface.c b/src/cairo-surface.c index fe03b8c5a..e68880a88 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -931,7 +931,7 @@ _cairo_surface_has_device_transform (cairo_surface_t *surface) * @surface as a source. _cairo_surface_release_source_image() must be called * when finished. * - * Return value: %CAIRO_STATUS_SUCCESS if a an image was stored in @image_out. + * Return value: %CAIRO_STATUS_SUCCESS if an image was stored in @image_out. * %CAIRO_INT_STATUS_UNSUPPORTED if an image cannot be retrieved for the specified * surface. Or %CAIRO_STATUS_NO_MEMORY. **/ @@ -942,6 +942,9 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface, { assert (!surface->finished); + if (surface->backend->acquire_source_image == NULL) + return CAIRO_INT_STATUS_UNSUPPORTED; + return _cairo_surface_set_error (surface, surface->backend->acquire_source_image (surface, image_out, image_extra)); @@ -1005,6 +1008,9 @@ _cairo_surface_acquire_dest_image (cairo_surface_t *surface, { assert (!surface->finished); + if (surface->backend->acquire_dest_image == NULL) + return CAIRO_INT_STATUS_UNSUPPORTED; + return _cairo_surface_set_error (surface, surface->backend->acquire_dest_image (surface, interest_rect,