[Commit] cairo/src cairo.c, 1.11, 1.12 cairo.h, 1.12,
1.13 cairo_gstate.c, 1.11, 1.12 cairo_surface.c, 1.8,
1.9 cairoint.h, 1.16, 1.17
Carl Worth
commit at keithp.com
Tue Sep 16 07:45:22 PDT 2003
Committed by: cworth
Update of /local/src/CVS/cairo/src
In directory home.keithp.com:/tmp/cvs-serv13251/src
Modified Files:
cairo.c cairo.h cairo_gstate.c cairo_surface.c cairoint.h
Log Message:
Add cairo_reference and cairo_surface_reference
Index: cairo.c
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cairo.c 15 Sep 2003 14:55:10 -0000 1.11
+++ cairo.c 16 Sep 2003 13:45:20 -0000 1.12
@@ -42,6 +42,7 @@
return NULL;
cr->status = CAIRO_STATUS_SUCCESS;
+ cr->ref_count = 1;
cr->gstate = _cairo_gstate_create ();
if (cr->gstate == NULL)
@@ -50,16 +51,6 @@
return cr;
}
-void
-cairo_destroy (cairo_t *cr)
-{
- while (cr->gstate) {
- cairo_restore (cr);
- }
-
- free (cr);
-}
-
cairo_t *
cairo_copy (cairo_t *cr_other)
{
@@ -70,6 +61,7 @@
return NULL;
*cr = *cr_other;
+ cr->ref_count = 0;
cr->gstate = _cairo_gstate_clone (cr_other->gstate);
if (cr->gstate == NULL)
@@ -79,6 +71,32 @@
}
void
+cairo_reference (cairo_t *cr)
+{
+ if (cr->status)
+ return;
+
+ cr->ref_count++;
+}
+
+void
+cairo_destroy (cairo_t *cr)
+{
+ if (cr->status)
+ return;
+
+ cr->ref_count--;
+ if (cr->ref_count)
+ return;
+
+ while (cr->gstate) {
+ cairo_restore (cr);
+ }
+
+ free (cr);
+}
+
+void
cairo_save (cairo_t *cr)
{
cairo_gstate_t *top;
Index: cairo.h
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- cairo.h 5 Sep 2003 22:29:49 -0000 1.12
+++ cairo.h 16 Sep 2003 13:45:20 -0000 1.13
@@ -50,13 +50,16 @@
extern cairo_t * __external_linkage
cairo_create (void);
-extern void __external_linkage
-cairo_destroy (cairo_t *cr);
-
extern cairo_t * __external_linkage
cairo_copy (cairo_t *cr_other);
extern void __external_linkage
+cairo_reference (cairo_t *cr);
+
+extern void __external_linkage
+cairo_destroy (cairo_t *cr);
+
+extern void __external_linkage
cairo_save (cairo_t *cr);
extern void __external_linkage
@@ -444,6 +447,9 @@
double alpha);
extern void __external_linkage
+cairo_surface_reference (cairo_surface_t *surface);
+
+extern void __external_linkage
cairo_surface_destroy (cairo_surface_t *surface);
/* XXX: NYI
Index: cairo_gstate.c
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo_gstate.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cairo_gstate.c 5 Sep 2003 22:29:49 -0000 1.11
+++ cairo_gstate.c 16 Sep 2003 13:45:20 -0000 1.12
@@ -119,9 +119,9 @@
if (status)
goto CLEANUP_DASHES;
- _cairo_surface_reference (gstate->surface);
- _cairo_surface_reference (gstate->source);
- _cairo_surface_reference (gstate->clip.surface);
+ cairo_surface_reference (gstate->surface);
+ cairo_surface_reference (gstate->source);
+ cairo_surface_reference (gstate->clip.surface);
status = _cairo_path_init_copy (&gstate->path, &other->path);
if (status)
@@ -293,7 +293,7 @@
cairo_surface_destroy (gstate->surface);
gstate->surface = surface;
- _cairo_surface_reference (gstate->surface);
+ cairo_surface_reference (gstate->surface);
scale = surface->ppm / gstate->ppm;
_cairo_gstate_scale (gstate, scale, scale);
@@ -321,7 +321,7 @@
gstate->source = pattern;
gstate->source_is_solid = 0;
- _cairo_surface_reference (gstate->source);
+ cairo_surface_reference (gstate->source);
_cairo_gstate_current_point (gstate,
&gstate->source_offset.x,
Index: cairo_surface.c
===================================================================
RCS file: /local/src/CVS/cairo/src/cairo_surface.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cairo_surface.c 15 Sep 2003 20:17:33 -0000 1.8
+++ cairo_surface.c 16 Sep 2003 13:45:20 -0000 1.9
@@ -309,7 +309,7 @@
slim_hidden_def(cairo_surface_create_similar_solid);
void
-_cairo_surface_reference (cairo_surface_t *surface)
+cairo_surface_reference (cairo_surface_t *surface)
{
if (surface == NULL)
return;
Index: cairoint.h
===================================================================
RCS file: /local/src/CVS/cairo/src/cairoint.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- cairoint.h 5 Sep 2003 22:29:49 -0000 1.16
+++ cairoint.h 16 Sep 2003 13:45:20 -0000 1.17
@@ -370,6 +370,7 @@
} cairo_gstate_t;
struct cairo {
+ unsigned int ref_count;
cairo_gstate_t *gstate;
cairo_status_t status;
};
@@ -691,9 +692,6 @@
/* cairo_surface.c */
extern void __internal_linkage
-_cairo_surface_reference (cairo_surface_t *surface);
-
-extern void __internal_linkage
_cairo_surface_fill_rectangle (cairo_surface_t *surface,
cairo_operator_t operator,
cairo_color_t *color,
More information about the Commit
mailing list