[cairo-commit] 4 commits - src/cairo.c src/cairo-device.c src/cairo-error-private.h src/cairo-ft-font.c src/cairo.h src/cairo-misc.c src/cairo-png.c src/cairo-region.c src/cairo-spans.c src/cairo-surface.c src/win32 util/cairo-gobject util/cairo-script util/cairo-trace

Adrian Johnson ajohnson at kemper.freedesktop.org
Fri Apr 1 11:45:40 UTC 2016


 src/cairo-device.c                       |    3 +++
 src/cairo-error-private.h                |    3 +++
 src/cairo-ft-font.c                      |    5 ++++-
 src/cairo-misc.c                         |    6 ++++++
 src/cairo-png.c                          |   10 +++++++---
 src/cairo-region.c                       |    3 +++
 src/cairo-spans.c                        |    6 ++++++
 src/cairo-surface.c                      |    3 +++
 src/cairo.c                              |    5 ++++-
 src/cairo.h                              |    6 ++++++
 src/win32/cairo-win32-surface.c          |    6 +-----
 util/cairo-gobject/cairo-gobject-enums.c |    7 ++++++-
 util/cairo-script/cairo-script-private.h |   10 ++++++++++
 util/cairo-trace/trace.c                 |    3 +++
 14 files changed, 65 insertions(+), 11 deletions(-)

New commits:
commit 747cab741cf63f30aa6bc2b787fc13e7e7a2b859
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 26 22:18:05 2016 +1030

    Add CAIRO_STATUS_WIN32_GDI_ERROR for GDI errors

diff --git a/src/cairo-device.c b/src/cairo-device.c
index 23f654f..bacf93b 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -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;
diff --git a/src/cairo-error-private.h b/src/cairo-error-private.h
index f9dea70..25dac7d 100644
--- a/src/cairo-error-private.h
+++ b/src/cairo-error-private.h
@@ -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,
 
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index c1e0971..f4db372 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -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>";
diff --git a/src/cairo-region.c b/src/cairo-region.c
index daf1f96..b738c44 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -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;
diff --git a/src/cairo-spans.c b/src/cairo-spans.c
index d2f9407..d20cd5a 100644
--- a/src/cairo-spans.c
+++ b/src/cairo-spans.c
@@ -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;
     }
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 057e1de..ded146d 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -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;
diff --git a/src/cairo.c b/src/cairo.c
index 078c5e2..ec27fe7 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -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);
diff --git a/src/cairo.h b/src/cairo.h
index 1d2f418..a09d839 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -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;
diff --git a/src/win32/cairo-win32-surface.c b/src/win32/cairo-win32-surface.c
index e6862bd..f7285b9 100644
--- a/src/win32/cairo-win32-surface.c
+++ b/src/win32/cairo-win32-surface.c
@@ -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
diff --git a/util/cairo-gobject/cairo-gobject-enums.c b/util/cairo-gobject/cairo-gobject-enums.c
index cd4a4be..0c50694 100644
--- a/util/cairo-gobject/cairo-gobject-enums.c
+++ b/util/cairo-gobject/cairo-gobject-enums.c
@@ -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);
diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h
index a8e203b..da846dc 100644
--- a/util/cairo-script/cairo-script-private.h
+++ b/util/cairo-script/cairo-script-private.h
@@ -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 */
 
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 652e04a..e3c9933 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -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;
     }
commit cdd5c92cedb9abcedd6f261594b1ea7d94d4a4ad
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 26 21:45:33 2016 +1030

    Add CAIRO_STATUS_FREETYPE_ERROR for errors returned by libfreetype

diff --git a/src/cairo-device.c b/src/cairo-device.c
index e270666..23f654f 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -160,6 +160,7 @@ _cairo_device_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_DEVICE_FINISHED:
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
     case CAIRO_STATUS_PNG_ERROR:
+    case CAIRO_STATUS_FREETYPE_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_device_t *) &_nil_device;
diff --git a/src/cairo-error-private.h b/src/cairo-error-private.h
index f94a893..f9dea70 100644
--- a/src/cairo-error-private.h
+++ b/src/cairo-error-private.h
@@ -95,6 +95,7 @@ enum _cairo_int_status {
     CAIRO_INT_STATUS_DEVICE_FINISHED,
     CAIRO_INT_STATUS_JBIG2_GLOBAL_MISSING,
     CAIRO_INT_STATUS_PNG_ERROR,
+    CAIRO_INT_STATUS_FREETYPE_ERROR,
 
     CAIRO_INT_STATUS_LAST_STATUS,
 
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 3e485c5..a0c7beb 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -223,7 +223,10 @@ _ft_to_cairo_error (FT_Error error)
    * Populate as needed. */
   switch (error)
   {
-  default:		return CAIRO_STATUS_NO_MEMORY;
+  case FT_Err_Out_Of_Memory:
+      return CAIRO_STATUS_NO_MEMORY;
+  default:
+      return CAIRO_STATUS_FREETYPE_ERROR;
   }
 }
 
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index d1ab7b3..c1e0971 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -160,6 +160,8 @@ cairo_status_to_string (cairo_status_t status)
 	return "CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID used but no CAIRO_MIME_TYPE_JBIG2_GLOBAL data provided";
     case CAIRO_STATUS_PNG_ERROR:
 	return "error occurred in libpng while reading from or writing to a PNG file";
+    case CAIRO_STATUS_FREETYPE_ERROR:
+	return "error occurred in libfreetype";
     default:
     case CAIRO_STATUS_LAST_STATUS:
 	return "<unknown error status>";
diff --git a/src/cairo-region.c b/src/cairo-region.c
index 6def842..daf1f96 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -108,6 +108,7 @@ _cairo_region_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_DEVICE_FINISHED:
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
     case CAIRO_STATUS_PNG_ERROR:
+    case CAIRO_STATUS_FREETYPE_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_region_t *) &_cairo_region_nil;
diff --git a/src/cairo-spans.c b/src/cairo-spans.c
index f185b1c..d2f9407 100644
--- a/src/cairo-spans.c
+++ b/src/cairo-spans.c
@@ -129,6 +129,7 @@ _cairo_scan_converter_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_DEVICE_FINISHED: RETURN_NIL;
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
     case CAIRO_STATUS_PNG_ERROR:
+    case CAIRO_STATUS_FREETYPE_ERROR:
     default:
 	break;
     }
@@ -243,6 +244,7 @@ _cairo_span_renderer_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_DEVICE_FINISHED: RETURN_NIL;
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING: RETURN_NIL;
     case CAIRO_STATUS_PNG_ERROR: RETURN_NIL;
+    case CAIRO_STATUS_FREETYPE_ERROR: RETURN_NIL;
     default:
 	break;
     }
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 9cf3f09..057e1de 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -2726,6 +2726,7 @@ _cairo_surface_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_DEVICE_FINISHED:
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
     case CAIRO_STATUS_PNG_ERROR:
+    case CAIRO_STATUS_FREETYPE_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_surface_t *) &_cairo_surface_nil;
diff --git a/src/cairo.c b/src/cairo.c
index 05fd86b..078c5e2 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -154,7 +154,8 @@ static const cairo_t _cairo_nil[] = {
     DEFINE_NIL_CONTEXT (CAIRO_STATUS_INVALID_MESH_CONSTRUCTION),
     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_PNG_ERROR),
+    DEFINE_NIL_CONTEXT (CAIRO_STATUS_FREETYPE_ERROR)
 
 };
 COMPILE_TIME_ASSERT (ARRAY_LENGTH (_cairo_nil) == CAIRO_STATUS_LAST_STATUS - 1);
diff --git a/src/cairo.h b/src/cairo.h
index a1808bd..1d2f418 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -293,6 +293,7 @@ typedef struct _cairo_user_data_key {
  * @CAIRO_STATUS_JBIG2_GLOBAL_MISSING: %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID has been used on at least one image
  *   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_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
@@ -350,6 +351,7 @@ typedef enum _cairo_status {
     CAIRO_STATUS_DEVICE_FINISHED,
     CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
     CAIRO_STATUS_PNG_ERROR,
+    CAIRO_STATUS_FREETYPE_ERROR,
 
     CAIRO_STATUS_LAST_STATUS
 } cairo_status_t;
diff --git a/util/cairo-gobject/cairo-gobject-enums.c b/util/cairo-gobject/cairo-gobject-enums.c
index 344e46d..cd4a4be 100644
--- a/util/cairo-gobject/cairo-gobject-enums.c
+++ b/util/cairo-gobject/cairo-gobject-enums.c
@@ -53,6 +53,7 @@ cairo_gobject_status_get_type (void)
 	  { CAIRO_STATUS_DEVICE_FINISHED, "CAIRO_STATUS_DEVICE_FINISHED", "device-finished" },
 	  { CAIRO_STATUS_JBIG2_GLOBAL_MISSING, "CAIRO_STATUS_JBIG2_GLOBAL_MISSING", "jbig2-global_missing" },
 	  { 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" },
           { 0, NULL, NULL }
       };
diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h
index 608758c..a8e203b 100644
--- a/util/cairo-script/cairo-script-private.h
+++ b/util/cairo-script/cairo-script-private.h
@@ -227,6 +227,8 @@ typedef enum _csi_status {
     CSI_STATUS_DEVICE_FINISHED = CAIRO_STATUS_DEVICE_FINISHED,
     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,
+
 
     /* cairo-script-interpreter specific errors */
 
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index 47b3bb7..652e04a 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1583,6 +1583,7 @@ _status_to_string (cairo_status_t status)
 	f(DEVICE_FINISHED);
 	f(JBIG2_GLOBAL_MISSING);
 	f(PNG_ERROR);
+	f(FREETYPE_ERROR);
     case CAIRO_STATUS_LAST_STATUS:
 	break;
     }
commit 8f6790123e05c5c38ba09c541093b747aa12b681
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 26 19:05:01 2016 +1030

    Adding missing error status to utils

diff --git a/util/cairo-gobject/cairo-gobject-enums.c b/util/cairo-gobject/cairo-gobject-enums.c
index 0a7c95d..344e46d 100644
--- a/util/cairo-gobject/cairo-gobject-enums.c
+++ b/util/cairo-gobject/cairo-gobject-enums.c
@@ -50,7 +50,10 @@ cairo_gobject_status_get_type (void)
           { CAIRO_STATUS_DEVICE_TYPE_MISMATCH, "CAIRO_STATUS_DEVICE_TYPE_MISMATCH", "device-type-mismatch" },
           { CAIRO_STATUS_DEVICE_ERROR, "CAIRO_STATUS_DEVICE_ERROR", "device-error" },
           { CAIRO_STATUS_INVALID_MESH_CONSTRUCTION, "CAIRO_STATUS_INVALID_MESH_CONSTRUCTION", "invalid-mesh-construction" },
-          { CAIRO_STATUS_LAST_STATUS, "CAIRO_STATUS_LAST_STATUS", "last-status" },
+	  { CAIRO_STATUS_DEVICE_FINISHED, "CAIRO_STATUS_DEVICE_FINISHED", "device-finished" },
+	  { CAIRO_STATUS_JBIG2_GLOBAL_MISSING, "CAIRO_STATUS_JBIG2_GLOBAL_MISSING", "jbig2-global_missing" },
+	  { CAIRO_STATUS_PNG_ERROR, "CAIRO_STATUS_PNG_ERROR", "png-error" },
+	  { CAIRO_STATUS_LAST_STATUS, "CAIRO_STATUS_LAST_STATUS", "last-status" },
           { 0, NULL, NULL }
       };
       GType type = g_enum_register_static (g_intern_static_string ("cairo_status_t"), values);
diff --git a/util/cairo-script/cairo-script-private.h b/util/cairo-script/cairo-script-private.h
index 8d158d6..608758c 100644
--- a/util/cairo-script/cairo-script-private.h
+++ b/util/cairo-script/cairo-script-private.h
@@ -219,6 +219,14 @@ typedef enum _csi_status {
     CSI_STATUS_INVALID_CLUSTERS = CAIRO_STATUS_INVALID_CLUSTERS,
     CSI_STATUS_INVALID_SLANT = CAIRO_STATUS_INVALID_SLANT,
     CSI_STATUS_INVALID_WEIGHT = CAIRO_STATUS_INVALID_WEIGHT,
+    CSI_STATUS_INVALID_SIZE = CAIRO_STATUS_INVALID_SIZE,
+    CSI_STATUS_USER_FONT_NOT_IMPLEMENTED = CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED,
+    CSI_STATUS_DEVICE_TYPE_MISMATCH = CAIRO_STATUS_DEVICE_TYPE_MISMATCH,
+    CSI_STATUS_DEVICE_ERROR = CAIRO_STATUS_DEVICE_ERROR,
+    CSI_STATUS_INVALID_MESH_CONSTRUCTION = CAIRO_STATUS_INVALID_MESH_CONSTRUCTION,
+    CSI_STATUS_DEVICE_FINISHED = CAIRO_STATUS_DEVICE_FINISHED,
+    CSI_STATUS_JBIG2_GLOBAL_MISSING = CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
+    CSI_STATUS_PNG_ERROR = CAIRO_STATUS_PNG_ERROR,
 
     /* cairo-script-interpreter specific errors */
 
diff --git a/util/cairo-trace/trace.c b/util/cairo-trace/trace.c
index d5d7668..47b3bb7 100644
--- a/util/cairo-trace/trace.c
+++ b/util/cairo-trace/trace.c
@@ -1582,6 +1582,7 @@ _status_to_string (cairo_status_t status)
 	f(INVALID_MESH_CONSTRUCTION);
 	f(DEVICE_FINISHED);
 	f(JBIG2_GLOBAL_MISSING);
+	f(PNG_ERROR);
     case CAIRO_STATUS_LAST_STATUS:
 	break;
     }
commit c5ee3f11b5fb5a652466bbe407d2dc8e0ef4eb71
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Mar 26 07:24:26 2016 +1030

    Add CAIRO_STATUS_PNG_ERROR for errors returned by libpng

diff --git a/src/cairo-device.c b/src/cairo-device.c
index 585a9c1..e270666 100644
--- a/src/cairo-device.c
+++ b/src/cairo-device.c
@@ -159,6 +159,7 @@ _cairo_device_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION:
     case CAIRO_STATUS_DEVICE_FINISHED:
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
+    case CAIRO_STATUS_PNG_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_device_t *) &_nil_device;
diff --git a/src/cairo-error-private.h b/src/cairo-error-private.h
index 178078a..f94a893 100644
--- a/src/cairo-error-private.h
+++ b/src/cairo-error-private.h
@@ -94,6 +94,7 @@ enum _cairo_int_status {
     CAIRO_INT_STATUS_INVALID_MESH_CONSTRUCTION,
     CAIRO_INT_STATUS_DEVICE_FINISHED,
     CAIRO_INT_STATUS_JBIG2_GLOBAL_MISSING,
+    CAIRO_INT_STATUS_PNG_ERROR,
 
     CAIRO_INT_STATUS_LAST_STATUS,
 
diff --git a/src/cairo-misc.c b/src/cairo-misc.c
index 3c7c959..d1ab7b3 100644
--- a/src/cairo-misc.c
+++ b/src/cairo-misc.c
@@ -158,6 +158,8 @@ cairo_status_to_string (cairo_status_t status)
 	return "the target device has been finished";
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
 	return "CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID used but no CAIRO_MIME_TYPE_JBIG2_GLOBAL data provided";
+    case CAIRO_STATUS_PNG_ERROR:
+	return "error occurred in libpng while reading from or writing to a PNG file";
     default:
     case CAIRO_STATUS_LAST_STATUS:
 	return "<unknown error status>";
diff --git a/src/cairo-png.c b/src/cairo-png.c
index 068617d..562b743 100644
--- a/src/cairo-png.c
+++ b/src/cairo-png.c
@@ -136,7 +136,7 @@ png_simple_error_callback (png_structp png,
 
     /* default to the most likely error */
     if (*error == CAIRO_STATUS_SUCCESS)
-	*error = _cairo_error (CAIRO_STATUS_NO_MEMORY);
+	*error = _cairo_error (CAIRO_STATUS_PNG_ERROR);
 
 #ifdef PNG_SETJMP_SUPPORTED
     longjmp (png_jmpbuf (png), 1);
@@ -349,7 +349,8 @@ stdio_write_func (png_structp png, png_bytep data, png_size_t size)
  * be allocated for the operation or
  * %CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
  * pixel contents, or %CAIRO_STATUS_WRITE_ERROR if an I/O error occurs
- * while attempting to write the file.
+ * while attempting to write the file, or %CAIRO_STATUS_PNG_ERROR if libpng
+ * returned an error.
  *
  * Since: 1.0
  **/
@@ -417,7 +418,8 @@ stream_write_func (png_structp png, png_bytep data, png_size_t size)
  * successfully.  Otherwise, %CAIRO_STATUS_NO_MEMORY is returned if
  * memory could not be allocated for the operation,
  * %CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not have
- * pixel contents.
+ * pixel contents, or %CAIRO_STATUS_PNG_ERROR if libpng
+ * returned an error.
  *
  * Since: 1.0
  **/
@@ -744,6 +746,7 @@ read_png (struct png_read_closure_t *png_closure)
  *	%CAIRO_STATUS_NO_MEMORY
  *	%CAIRO_STATUS_FILE_NOT_FOUND
  *	%CAIRO_STATUS_READ_ERROR
+ *	%CAIRO_STATUS_PNG_ERROR
  *
  * Alternatively, you can allow errors to propagate through the drawing
  * operations and check the status on the context upon completion
@@ -799,6 +802,7 @@ cairo_image_surface_create_from_png (const char *filename)
  *
  *	%CAIRO_STATUS_NO_MEMORY
  *	%CAIRO_STATUS_READ_ERROR
+ *	%CAIRO_STATUS_PNG_ERROR
  *
  * Alternatively, you can allow errors to propagate through the drawing
  * operations and check the status on the context upon completion
diff --git a/src/cairo-region.c b/src/cairo-region.c
index 6a51225..6def842 100644
--- a/src/cairo-region.c
+++ b/src/cairo-region.c
@@ -107,6 +107,7 @@ _cairo_region_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION:
     case CAIRO_STATUS_DEVICE_FINISHED:
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
+    case CAIRO_STATUS_PNG_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_region_t *) &_cairo_region_nil;
diff --git a/src/cairo-spans.c b/src/cairo-spans.c
index 182390c..f185b1c 100644
--- a/src/cairo-spans.c
+++ b/src/cairo-spans.c
@@ -128,6 +128,7 @@ _cairo_scan_converter_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION: RETURN_NIL;
     case CAIRO_STATUS_DEVICE_FINISHED: RETURN_NIL;
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
+    case CAIRO_STATUS_PNG_ERROR:
     default:
 	break;
     }
@@ -241,6 +242,7 @@ _cairo_span_renderer_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION: RETURN_NIL;
     case CAIRO_STATUS_DEVICE_FINISHED: RETURN_NIL;
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING: RETURN_NIL;
+    case CAIRO_STATUS_PNG_ERROR: RETURN_NIL;
     default:
 	break;
     }
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 46f6894..9cf3f09 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -2725,6 +2725,7 @@ _cairo_surface_create_in_error (cairo_status_t status)
     case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION:
     case CAIRO_STATUS_DEVICE_FINISHED:
     case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
+    case CAIRO_STATUS_PNG_ERROR:
     default:
 	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
 	return (cairo_surface_t *) &_cairo_surface_nil;
diff --git a/src/cairo.c b/src/cairo.c
index e3acf4d..05fd86b 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -153,7 +153,8 @@ static const cairo_t _cairo_nil[] = {
     DEFINE_NIL_CONTEXT (CAIRO_STATUS_DEVICE_ERROR),
     DEFINE_NIL_CONTEXT (CAIRO_STATUS_INVALID_MESH_CONSTRUCTION),
     DEFINE_NIL_CONTEXT (CAIRO_STATUS_DEVICE_FINISHED),
-    DEFINE_NIL_CONTEXT (CAIRO_STATUS_JBIG2_GLOBAL_MISSING)
+    DEFINE_NIL_CONTEXT (CAIRO_STATUS_JBIG2_GLOBAL_MISSING),
+    DEFINE_NIL_CONTEXT (CAIRO_STATUS_PNG_ERROR)
 
 };
 COMPILE_TIME_ASSERT (ARRAY_LENGTH (_cairo_nil) == CAIRO_STATUS_LAST_STATUS - 1);
diff --git a/src/cairo.h b/src/cairo.h
index 3104d47..a1808bd 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -292,6 +292,7 @@ typedef struct _cairo_user_data_key {
  * @CAIRO_STATUS_DEVICE_FINISHED: target device has been finished (Since 1.12)
  * @CAIRO_STATUS_JBIG2_GLOBAL_MISSING: %CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID has been used on at least one image
  *   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_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
@@ -348,6 +349,7 @@ typedef enum _cairo_status {
     CAIRO_STATUS_INVALID_MESH_CONSTRUCTION,
     CAIRO_STATUS_DEVICE_FINISHED,
     CAIRO_STATUS_JBIG2_GLOBAL_MISSING,
+    CAIRO_STATUS_PNG_ERROR,
 
     CAIRO_STATUS_LAST_STATUS
 } cairo_status_t;


More information about the cairo-commit mailing list