diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-01-16 16:23:23 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-01-16 16:51:32 +0000 |
commit | 7111b18c27d7ee0439339a6aa72f0e4244f883f9 (patch) | |
tree | 162d5cf10b629ded2a44f8bb1cc64e4671a58cc7 /src/cairo-glitz-surface.c | |
parent | 5cbc45488e276cb6e6ecfa7bc7dd4fae342de85e (diff) |
[cairo-surface] Introduce _cairo_surface_create_in_error().
Unexport all the static error surfaces and use a function to select
the appropriate error surface for the status.
Diffstat (limited to 'src/cairo-glitz-surface.c')
-rw-r--r-- | src/cairo-glitz-surface.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index 05e80dbf..04084e14 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -88,20 +88,16 @@ _cairo_glitz_surface_create_similar (void *abstract_src, gformat = glitz_find_standard_format (drawable, _glitz_format_from_content (content)); - if (!gformat) { - _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); - return (cairo_surface_t*) &_cairo_surface_nil; - } + if (!gformat) + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); surface = glitz_surface_create (drawable, gformat, width <= 0 ? 1 : width, height <= 0 ? 1 : height, 0, NULL); - if (surface == NULL) { - _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); - return (cairo_surface_t*) &_cairo_surface_nil; - } + if (surface == NULL) + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); crsurface = cairo_glitz_surface_create (surface); @@ -2456,13 +2452,11 @@ cairo_glitz_surface_create (glitz_surface_t *surface) glitz_format_t *format; if (surface == NULL) - return (cairo_surface_t*) &_cairo_surface_nil; + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NULL_POINTER)); crsurface = malloc (sizeof (cairo_glitz_surface_t)); - if (crsurface == NULL) { - _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); - return (cairo_surface_t*) &_cairo_surface_nil; - } + if (crsurface == NULL) + return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY)); format = glitz_surface_get_format (surface); _cairo_surface_init (&crsurface->base, &cairo_glitz_surface_backend, |