summaryrefslogtreecommitdiff
path: root/src/cairo-win32-surface.c
diff options
context:
space:
mode:
authorM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2010-02-28 23:31:06 +0200
committerM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2010-03-01 01:21:31 +0200
commit5b7f4bb241f3191c1589cd714f373719efded56e (patch)
tree6eb5cf59bb1b3ac50304dc1a4465450e83e06517 /src/cairo-win32-surface.c
parent620cd9c2be4a6bef790e6818652470a5c53d578d (diff)
api: Introduce CAIRO_FORMAT_INVALID formally in the API.
We were exposing the actual value of CAIRO_FORMAT_INVALID through API functions already, so it makes sense to just go ahead and put it in the cairo_format_t enum.
Diffstat (limited to 'src/cairo-win32-surface.c')
-rw-r--r--src/cairo-win32-surface.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index ce872f74..a7786cbc 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -176,6 +176,9 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface,
surface->is_dib = FALSE;
switch (format) {
+ default:
+ case CAIRO_FORMAT_INVALID:
+ return _cairo_error (CAIRO_STATUS_INVALID_FORMAT);
case CAIRO_FORMAT_ARGB32:
case CAIRO_FORMAT_RGB24:
num_palette = 0;
@@ -337,6 +340,9 @@ _cairo_win32_surface_create_for_dc (HDC original_dc,
unsigned char *bits;
int rowstride;
+ if (! CAIRO_FORMAT_VALID (format))
+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
+
surface = malloc (sizeof (cairo_win32_surface_t));
if (surface == NULL)
return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));