Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errors

This commit is contained in:
Adrian Johnson 2016-03-26 22:18:05 +10:30
parent cdd5c92ced
commit 747cab741c
12 changed files with 16 additions and 7 deletions

View file

@ -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;

View file

@ -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,

View file

@ -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>";

View file

@ -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;

View file

@ -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;
}
@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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
@ -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;

View file

@ -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

View file

@ -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);

View file

@ -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 */

View file

@ -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;
}