diff --git a/ChangeLog b/ChangeLog index 6045e55ef..bb865a457 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2003-09-30 Carl Worth + * configure.in: Bumped version to 0.1.7 to indicate change in + cairo_copy. + + * src/cairo.c (cairo_copy): Changed cairo_copy to copy graphics + state from one cairo_t to another rather than allocating a new + cairo_t. + * src/cairo_surface.c (cairo_surface_destroy): (cairo_surface_create_similar_solid): Fix to delay XFreePixmap until cairo_surface_destroy. diff --git a/configure.in b/configure.in index 4ad94a085..0c4649245 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_INIT(src/cairo.h) dnl =========================================================================== # Package version number, (as distinct from shared library version) -CAIRO_VERSION=0.1.6 +CAIRO_VERSION=0.1.7 # libtool shared library version diff --git a/src/cairo.c b/src/cairo.c index 909529c5e..5a47f7580 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -51,25 +51,6 @@ cairo_create (void) 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 @@ cairo_restore (cairo_t *cr) } 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) diff --git a/src/cairo.h b/src/cairo.h index 9a375f0ed..23ab1b592 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -50,9 +50,6 @@ extern "C" { 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 @@ cairo_save (cairo_t *cr); 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);