Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errors
  • Loading branch information
Adrian Johnson committed Mar 26, 2016
1 parent cdd5c92 commit 747cab7
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/cairo-device.c
Expand Up @@ -161,6 +161,7 @@ _cairo_device_create_in_error (cairo_status_t status)
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
case CAIRO_STATUS_WIN32_GDI_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_device_t *) &_nil_device;
Expand Down
1 change: 1 addition & 0 deletions src/cairo-error-private.h
Expand Up @@ -96,6 +96,7 @@ enum _cairo_int_status {
CAIRO_INT_STATUS_JBIG2_GLOBAL_MISSING,
CAIRO_INT_STATUS_PNG_ERROR,
CAIRO_INT_STATUS_FREETYPE_ERROR,
CAIRO_INT_STATUS_WIN32_GDI_ERROR,

CAIRO_INT_STATUS_LAST_STATUS,

Expand Down
2 changes: 2 additions & 0 deletions src/cairo-misc.c
Expand Up @@ -162,6 +162,8 @@ cairo_status_to_string (cairo_status_t status)
return "error occurred in libpng while reading from or writing to a PNG file";
case CAIRO_STATUS_FREETYPE_ERROR:
return "error occurred in libfreetype";
case CAIRO_STATUS_WIN32_GDI_ERROR:
return "error occurred in the Windows Graphics Device Interface";
default:
case CAIRO_STATUS_LAST_STATUS:
return "<unknown error status>";
Expand Down
1 change: 1 addition & 0 deletions src/cairo-region.c
Expand Up @@ -109,6 +109,7 @@ _cairo_region_create_in_error (cairo_status_t status)
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
case CAIRO_STATUS_WIN32_GDI_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_region_t *) &_cairo_region_nil;
Expand Down
2 changes: 2 additions & 0 deletions src/cairo-spans.c
Expand Up @@ -130,6 +130,7 @@ _cairo_scan_converter_create_in_error (cairo_status_t status)
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
case CAIRO_STATUS_WIN32_GDI_ERROR:
default:
break;
}
Expand Down Expand Up @@ -245,6 +246,7 @@ _cairo_span_renderer_create_in_error (cairo_status_t status)
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING: RETURN_NIL;
case CAIRO_STATUS_PNG_ERROR: RETURN_NIL;
case CAIRO_STATUS_FREETYPE_ERROR: RETURN_NIL;
case CAIRO_STATUS_WIN32_GDI_ERROR: RETURN_NIL;
default:
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/cairo-surface.c
Expand Up @@ -2727,6 +2727,7 @@ _cairo_surface_create_in_error (cairo_status_t status)
case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
case CAIRO_STATUS_PNG_ERROR:
case CAIRO_STATUS_FREETYPE_ERROR:
case CAIRO_STATUS_WIN32_GDI_ERROR:
default:
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t *) &_cairo_surface_nil;
Expand Down
3 changes: 2 additions & 1 deletion src/cairo.c
Expand Up @@ -155,7 +155,8 @@ static const cairo_t _cairo_nil[] = {
DEFINE_NIL_CONTEXT (CAIRO_STATUS_DEVICE_FINISHED),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_JBIG2_GLOBAL_MISSING),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_PNG_ERROR),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_FREETYPE_ERROR)
DEFINE_NIL_CONTEXT (CAIRO_STATUS_FREETYPE_ERROR),
DEFINE_NIL_CONTEXT (CAIRO_STATUS_WIN32_GDI_ERROR)

};
COMPILE_TIME_ASSERT (ARRAY_LENGTH (_cairo_nil) == CAIRO_STATUS_LAST_STATUS - 1);
Expand Down
2 changes: 2 additions & 0 deletions src/cairo.h
Expand Up @@ -294,6 +294,7 @@ typedef struct _cairo_user_data_key {
* but no image provided %CAIRO_MIME_TYPE_JBIG2_GLOBAL (Since 1.14)
* @CAIRO_STATUS_PNG_ERROR: error occurred in libpng while reading from or writing to a PNG file (Since 1.16)
* @CAIRO_STATUS_FREETYPE_ERROR: error occurred in libfreetype (Since 1.16)
* @CAIRO_STATUS_WIN32_GDI_ERROR: error occurred in the Windows Graphics Device Interface (Since 1.16)
* @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of
* status values defined in this enumeration. When using this value, note
* that the version of cairo at run-time may have additional status values
Expand Down Expand Up @@ -352,6 +353,7 @@ typedef enum _cairo_status {
CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
CAIRO_STATUS_PNG_ERROR,
CAIRO_STATUS_FREETYPE_ERROR,
CAIRO_STATUS_WIN32_GDI_ERROR,

CAIRO_STATUS_LAST_STATUS
} cairo_status_t;
Expand Down
6 changes: 1 addition & 5 deletions src/win32/cairo-win32-surface.c
Expand Up @@ -122,11 +122,7 @@ _cairo_win32_print_gdi_error (const char *context)

fflush (stderr);

/* We should switch off of last_status, but we'd either return
* CAIRO_STATUS_NO_MEMORY or CAIRO_STATUS_UNKNOWN_ERROR and there
* is no CAIRO_STATUS_UNKNOWN_ERROR.
*/
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
return _cairo_error (CAIRO_STATUS_WIN32_GDI_ERROR);
}

cairo_bool_t
Expand Down
1 change: 1 addition & 0 deletions util/cairo-gobject/cairo-gobject-enums.c
Expand Up @@ -55,6 +55,7 @@ cairo_gobject_status_get_type (void)
{ CAIRO_STATUS_PNG_ERROR, "CAIRO_STATUS_PNG_ERROR", "png-error" },
{ CAIRO_STATUS_FREETYPE_ERROR, "CAIRO_STATUS_FREETYPE_ERROR", "freetype-error" },
{ CAIRO_STATUS_LAST_STATUS, "CAIRO_STATUS_LAST_STATUS", "last-status" },
{ CAIRO_STATUS_WIN32_GDI_ERROR, "CAIRO_STATUS_WIN32_GDI_ERROR", "win32-gdi-error" },
{ 0, NULL, NULL }
};
GType type = g_enum_register_static (g_intern_static_string ("cairo_status_t"), values);
Expand Down
2 changes: 1 addition & 1 deletion util/cairo-script/cairo-script-private.h
Expand Up @@ -228,7 +228,7 @@ typedef enum _csi_status {
CSI_STATUS_JBIG2_GLOBAL_MISSING = CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
CSI_STATUS_PNG_ERROR = CAIRO_STATUS_PNG_ERROR,
CSI_STATUS_FREETYPE_ERROR = CAIRO_STATUS_FREETYPE_ERROR,

CSI_STATUS_WIN32_GDI_ERROR = CAIRO_STATUS_WIN32_GDI_ERROR,

/* cairo-script-interpreter specific errors */

Expand Down
1 change: 1 addition & 0 deletions util/cairo-trace/trace.c
Expand Up @@ -1584,6 +1584,7 @@ _status_to_string (cairo_status_t status)
f(JBIG2_GLOBAL_MISSING);
f(PNG_ERROR);
f(FREETYPE_ERROR);
f(WIN32_GDI_ERROR);
case CAIRO_STATUS_LAST_STATUS:
break;
}
Expand Down

0 comments on commit 747cab7

Please sign in to comment.