[cairo-commit] cairo/src cairo-pattern.c, 1.43, 1.44 cairo.c, 1.103, 1.104 cairoint.h, 1.152, 1.153

Carl Worth commit at pdx.freedesktop.org
Mon Jun 13 16:53:54 PDT 2005


Committed by: cworth

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

Modified Files:
	cairo-pattern.c cairo.c cairoint.h 
Log Message:

        * src/cairoint.h:
        * src/cairo-pattern.c: (_cairo_pattern_create_in_error): Add new
        _cairo_pattern_create_in_error.

        * src/cairo.c: (cairo_get_source): Propagate error values from
        cr->status to pattern->status.


Index: cairo-pattern.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pattern.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- cairo-pattern.c	13 Jun 2005 23:36:40 -0000	1.43
+++ cairo-pattern.c	13 Jun 2005 23:53:52 -0000	1.44
@@ -263,6 +263,37 @@
     return &pattern->base;
 }
 
+/**
+ * _cairo_pattern_create_in_error:
+ * @status: an error status
+ * 
+ * Create an empty #cairo_pattern_t object to hold an error
+ * status. This is useful for propagating status values from an
+ * existing object to a new #cairo_pattern_t.
+ *
+ * Return value: a (solid, black) #cairo_pattern_t object with status
+ * of @status. If there is insufficient memory a pointer to a special,
+ * static cairo_solid_pattern_nil will be returned instead with a
+ * status of CAIRO_STATUS_NO_MEMORY rather than @status.
+ * 
+ * Return value: 
+ **/
+cairo_pattern_t *
+_cairo_pattern_create_in_error (cairo_status_t status)
+{
+    cairo_solid_pattern_t *pattern;
+
+    pattern = malloc (sizeof (cairo_solid_pattern_t));
+    if (pattern == NULL)
+	return (cairo_pattern_t *) &cairo_solid_pattern_nil.base;
+
+    _cairo_pattern_init_solid (pattern, CAIRO_COLOR_BLACK);
+
+    pattern->base.status = status;
+
+    return &pattern->base;
+}
+
 cairo_pattern_t *
 cairo_pattern_create_for_surface (cairo_surface_t *surface)
 {

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- cairo.c	13 Jun 2005 23:36:40 -0000	1.103
+++ cairo.c	13 Jun 2005 23:53:52 -0000	1.104
@@ -481,10 +481,8 @@
 cairo_get_source (cairo_t *cr)
 {
     CAIRO_CHECK_SANITY (cr);
-    /* XXX: We'll want to do something like this:
     if (cr->status)
-	return cairo_pattern_nil;
-    */
+	return _cairo_pattern_create_in_error (cr->status);
 
     return _cairo_gstate_get_source (cr->gstate);
 }

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -d -r1.152 -r1.153
--- cairoint.h	13 Jun 2005 23:36:40 -0000	1.152
+++ cairoint.h	13 Jun 2005 23:53:52 -0000	1.153
@@ -1717,6 +1717,9 @@
 cairo_private cairo_pattern_t *
 _cairo_pattern_create_solid (const cairo_color_t *color);
 
+cairo_pattern_t *
+_cairo_pattern_create_in_error (cairo_status_t status);
+
 cairo_private void
 _cairo_pattern_transform (cairo_pattern_t      *pattern,
 			  const cairo_matrix_t *ctm_inverse);




More information about the cairo-commit mailing list