[cairo-commit] cairo/src cairo-gstate.c, 1.143, 1.144 cairo.c, 1.112, 1.113 cairo.h, 1.132, 1.133

Carl Worth commit at pdx.freedesktop.org
Wed Jul 6 14:52:03 PDT 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv28622/src

Modified Files:
	cairo-gstate.c cairo.c cairo.h 
Log Message:

        * src/cairo.h:
        * src/cairo.c: (cairo_status_to_string): Remove
        CAIRO_STATUS_NO_TARGET_SURFAC and add CAIRO_STATUS_INVALID_STATUS.

        * src/cairo-gstate.c:
        (_cairo_gstate_clip_and_composite_trapezoids),
        (_cairo_gstate_copy_page), (_cairo_gstate_show_page): Don't check
        for gstate->target == NULL anymore as the API now guarantees it
        never occurs.

        * src/cairo.c: (cairo_append_path): Check that path->status is a
        valid status value and cause an INVALID_STATUS error otherwise.

        * test/path-data.c: (main): Test the new
        CAIRO_STATUS_INVALID_STATUS error case in cairo_append_path.


Index: cairo-gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-gstate.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -d -r1.143 -r1.144
--- cairo-gstate.c	15 Jun 2005 19:44:52 -0000	1.143
+++ cairo-gstate.c	6 Jul 2005 21:52:01 -0000	1.144
@@ -1376,9 +1376,6 @@
     if (traps->num_traps == 0)
 	return CAIRO_STATUS_SUCCESS;
 
-    if (gstate->target == NULL)
-	return CAIRO_STATUS_NO_TARGET_SURFACE;
-
     status = _cairo_traps_extract_region (traps, &trap_region);
     if (status)
 	return status;
@@ -1515,18 +1512,12 @@
 cairo_status_t
 _cairo_gstate_copy_page (cairo_gstate_t *gstate)
 {
-    if (gstate->target == NULL)
-	return CAIRO_STATUS_NO_TARGET_SURFACE;
-
     return _cairo_surface_copy_page (gstate->target);
 }
 
 cairo_status_t
 _cairo_gstate_show_page (cairo_gstate_t *gstate)
 {
-    if (gstate->target == NULL)
-	return CAIRO_STATUS_NO_TARGET_SURFACE;
-
     return _cairo_surface_show_page (gstate->target);
 }
 

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- cairo.c	28 Jun 2005 22:58:42 -0000	1.112
+++ cairo.c	6 Jul 2005 21:52:01 -0000	1.113
@@ -62,7 +62,7 @@
  * a bit of a pain, but it should be easy to always catch as long as
  * one adds a new test case to test a trigger of the new status value.
  */
-#define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_SURFACE_TYPE_MISMATCH
+#define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_PATTERN_TYPE_MISMATCH
 
 /**
  * _cairo_error:
@@ -2268,13 +2268,21 @@
 	return;
     }
 
-    if (path == NULL || path->data == NULL) {
+    if (path == NULL) {
 	_cairo_error (cr, CAIRO_STATUS_NULL_POINTER);
 	return;
     }
 
     if (path->status) {
-	_cairo_error (cr, path->status);
+	if (path->status <= CAIRO_STATUS_LAST_STATUS)
+	    _cairo_error (cr, path->status);
+	else
+	    _cairo_error (cr, CAIRO_STATUS_INVALID_STATUS);
+	return;
+    }
+
+    if (path->data == NULL) {
+	_cairo_error (cr, CAIRO_STATUS_NULL_POINTER);
 	return;
     }
 
@@ -2305,8 +2313,8 @@
 	return "no current point defined";
     case CAIRO_STATUS_INVALID_MATRIX:
 	return "invalid matrix (not invertible)";
-    case CAIRO_STATUS_NO_TARGET_SURFACE:
-	return "no target surface has been set";
+    case CAIRO_STATUS_INVALID_STATUS:
+	return " invalid value for an input cairo_status_t";
     case CAIRO_STATUS_NULL_POINTER:
 	return "NULL pointer";
     case CAIRO_STATUS_INVALID_STRING:

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -d -r1.132 -r1.133
--- cairo.h	28 Jun 2005 22:58:42 -0000	1.132
+++ cairo.h	6 Jul 2005 21:52:01 -0000	1.133
@@ -127,19 +127,20 @@
 /**
  * cairo_status_t
  * @CAIRO_STATUS_SUCCESS: no error has occurred
- * @CAIRO_STATUS_NO_MEMORY: 
- * @CAIRO_STATUS_INVALID_RESTORE:
+ * @CAIRO_STATUS_NO_MEMORY: out of memory
+ * @CAIRO_STATUS_INVALID_RESTORE: cairo_restore without matching cairo_save
  * @CAIRO_STATUS_INVALID_POP_GROUP:
- * @CAIRO_STATUS_NO_CURRENT_POINT:
- * @CAIRO_STATUS_INVALID_MATRIX:
- * @CAIRO_STATUS_NO_TARGET_SURFACE:
- * @CAIRO_STATUS_NULL_POINTER:
- * @CAIRO_STATUS_INVALID_STRING:
- * @CAIRO_STATUS_INVALID_PATH_DATA:
- * @CAIRO_STATUS_READ_ERROR:
- * @CAIRO_STATUS_WRITE_ERROR:
- * @CAIRO_STATUS_SURFACE_FINISHED:
- * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
+ * @CAIRO_STATUS_NO_CURRENT_POINT: no current point defined
+ * @CAIRO_STATUS_INVALID_MATRIX: invalid matrix (not invertible)
+ * @CAIRO_STATUS_INVALID_STATUS: invalid value for an input cairo_status_t
+ * @CAIRO_STATUS_NULL_POINTER: NULL pointer
+ * @CAIRO_STATUS_INVALID_STRING: input string not valid UTF-8
+ * @CAIRO_STATUS_INVALID_PATH_DATA: input path data not valid
+ * @CAIRO_STATUS_READ_ERROR: error while reading from input stream
+ * @CAIRO_STATUS_WRITE_ERROR: error while writing to output stream
+ * @CAIRO_STATUS_SURFACE_FINISHED: target surface has been finished
+ * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: the surface type is not appropriate for the operation
+ * @CAIRO_STATUS_PATTERN_TYPE_MISMATCH: the pattern type is not appropriate for the operation
  *
  * #cairo_status_t is used to indicate errors that can occur when
  * using Cairo. In some cases it is returned directly by functions.
@@ -153,7 +154,7 @@
     CAIRO_STATUS_INVALID_POP_GROUP,
     CAIRO_STATUS_NO_CURRENT_POINT,
     CAIRO_STATUS_INVALID_MATRIX,
-    CAIRO_STATUS_NO_TARGET_SURFACE,
+    CAIRO_STATUS_INVALID_STATUS,
     CAIRO_STATUS_NULL_POINTER,
     CAIRO_STATUS_INVALID_STRING,
     CAIRO_STATUS_INVALID_PATH_DATA,




More information about the cairo-commit mailing list