[Commit] cairo/src cairo.c,1.15,1.16 cairo.h,1.16,1.17

Carl Worth commit at keithp.com
Tue Sep 30 12:39:09 PDT 2003


Committed by: cworth

Update of /local/src/CVS/cairo/src
In directory home.keithp.com:/tmp/cvs-serv16581/src

Modified Files:
	cairo.c cairo.h 
Log Message:
Changed cairo_copy to copy graphics state from one cairo_t to another
rather than allocating a new cairo_t.

Index: cairo.c
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cairo.c	29 Sep 2003 15:36:30 -0000	1.15
+++ cairo.c	30 Sep 2003 18:39:07 -0000	1.16
@@ -51,25 +51,6 @@
     return cr;
 }
 
-cairo_t *
-cairo_copy (cairo_t *cr_other)
-{
-    cairo_t *cr;
-
-    cr = malloc (sizeof (cairo_t));
-    if (cr == NULL)
-	return NULL;
-
-    *cr = *cr_other;
-    cr->ref_count = 0;
-
-    cr->gstate = _cairo_gstate_clone (cr_other->gstate);
-    if (cr->gstate == NULL)
-	cr->status = CAIRO_STATUS_NO_MEMORY;
-
-    return cr;
-}
-
 void
 cairo_reference (cairo_t *cr)
 {
@@ -138,6 +119,17 @@
 }
 slim_hidden_def(cairo_restore);
 
+void
+cairo_copy (cairo_t *dest, cairo_t *src)
+{
+    *dest = *src;
+    dest->ref_count = 0;
+
+    dest->gstate = _cairo_gstate_clone (src->gstate);
+    if (dest->gstate == NULL)
+	dest->status = CAIRO_STATUS_NO_MEMORY;
+}
+
 /* XXX: I want to rethink this API
 void
 cairo_push_group (cairo_t *cr)

Index: cairo.h
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cairo.h	29 Sep 2003 15:36:30 -0000	1.16
+++ cairo.h	30 Sep 2003 18:39:07 -0000	1.17
@@ -50,9 +50,6 @@
 extern cairo_t * __external_linkage
 cairo_create (void);
 
-extern cairo_t * __external_linkage
-cairo_copy (cairo_t *cr_other);
-
 extern void __external_linkage
 cairo_reference (cairo_t *cr);
 
@@ -65,6 +62,9 @@
 extern void __external_linkage
 cairo_restore (cairo_t *cr);
 
+extern void __external_linkage
+cairo_copy (cairo_t *dest, cairo_t *src);
+
 /* XXX: I want to rethink this API
 extern void __external_linkage
 cairo_push_group (cairo_t *cr);




More information about the Commit mailing list