summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2005-07-28 10:47:40 +0000
committerCarl Worth <cworth@cworth.org>2005-07-28 10:47:40 +0000
commit6efd4bf4d5f0f788db4020facb556d5b6aac1e6e (patch)
tree8c1a1b2c71d88e3569e640cf6c0028d24c934785 /src
parent1e66aee352d092cbd39cac196cdf1b3681ec4c17 (diff)
Fix to call _cairo_error and return 0 on surface-type mismatch.
Diffstat (limited to 'src')
-rw-r--r--src/cairo-image-surface.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 59734e4aa..b21cf1228 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -255,6 +255,11 @@ cairo_image_surface_get_width (cairo_surface_t *surface)
{
cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;
+ if (!_cairo_surface_is_image (surface)) {
+ _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
+ return 0;
+ }
+
return image_surface->width;
}
@@ -271,6 +276,11 @@ cairo_image_surface_get_height (cairo_surface_t *surface)
{
cairo_image_surface_t *image_surface = (cairo_image_surface_t *) surface;
+ if (!_cairo_surface_is_image (surface)) {
+ _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
+ return 0;
+ }
+
return image_surface->height;
}