Added cairo_copy. Bumbed version to 0.1.2.

This commit is contained in:
Carl Worth 2003-09-05 08:35:08 +00:00
parent 196388abe6
commit 67275336bf
6 changed files with 58 additions and 32 deletions

View file

@ -1,8 +1,28 @@
2003-09-05 Carl Worth <cworth@east.isi.edu>
* configure.in: Bumped version to 0.1.2 for new cairo_copy
function.
* src/cairo_gstate.c (_cairo_gstate_init): Fixed uninitialized
current_pt values.
(_cairo_gstate_clone): Force gstate->next to NULL after cloning,
to prevent the clone from trashing the former stack.
* src/cairo.c (cairo_create): Folded _cairo_init into cairo_create.
(cairo_destroy): Folded _cairo_fini into cairo_dstroy.
(cairo_copy): Added new cairo_copy function.
2003-09-05 Carl Worth <cworth@isi.edu>
* src/cairo_gstate.c (_cairo_gstate_show_text): Fix crash due to
missing call to ensure_source.
2003-09-04 Carl Worth <cworth@east.isi.edu>
* src/cairoint.h (DEPRECATE): Changed DEPRECATE mechanism to
preseve binary compatibility, but break source-level
compatibility.
2003-09-04 Carl Worth <cworth@isi.edu>
* src/cairo_gstate.c (_cairo_gstate_init): Combine gstate->pattern

View file

@ -3,7 +3,7 @@ AC_INIT(src/cairo.h)
dnl ===========================================================================
# Package version number, (as distinct from shared library version)
CAIRO_VERSION=0.1.1
CAIRO_VERSION=0.1.2
# libtool shared library version

View file

@ -93,6 +93,8 @@ _cairo_gstate_init (cairo_gstate_t *gstate)
_cairo_path_init (&gstate->path);
gstate->current_pt.x = 0.0;
gstate->current_pt.y = 0.0;
gstate->has_current_pt = 0;
_cairo_pen_init_empty (&gstate->pen_regular);
@ -193,6 +195,7 @@ _cairo_gstate_clone (cairo_gstate_t *gstate)
return NULL;
}
}
clone->next = NULL;
return clone;
}

View file

@ -32,55 +32,52 @@
static void
_cairo_restrict_value (double *value, double min, double max);
static void
_cairo_init (cairo_t *cr);
static void
_cairo_fini (cairo_t *cr);
cairo_t *
cairo_create (void)
{
cairo_t *cr;
cr = malloc (sizeof (cairo_t));
if (cr) {
_cairo_init (cr);
if (cr->status) {
free (cr);
return NULL;
}
}
return cr;
}
static void
_cairo_init (cairo_t *cr)
{
cr->gstate = NULL;
if (cr == NULL)
return NULL;
cr->status = CAIRO_STATUS_SUCCESS;
cairo_save (cr);
}
cr->gstate = _cairo_gstate_create ();
if (cr->gstate == NULL)
cr->status = CAIRO_STATUS_NO_MEMORY;
static void
_cairo_fini (cairo_t *cr)
{
while (cr->gstate) {
cairo_restore (cr);
}
return cr;
}
void
cairo_destroy (cairo_t *cr)
{
_cairo_fini (cr);
while (cr->gstate) {
cairo_restore (cr);
}
free (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->gstate = _cairo_gstate_clone (cr_other->gstate);
if (cr->gstate == NULL)
cr->status = CAIRO_STATUS_NO_MEMORY;
return cr;
}
void
cairo_save (cairo_t *cr)
{

View file

@ -53,6 +53,9 @@ 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_save (cairo_t *cr);

View file

@ -93,6 +93,8 @@ _cairo_gstate_init (cairo_gstate_t *gstate)
_cairo_path_init (&gstate->path);
gstate->current_pt.x = 0.0;
gstate->current_pt.y = 0.0;
gstate->has_current_pt = 0;
_cairo_pen_init_empty (&gstate->pen_regular);
@ -193,6 +195,7 @@ _cairo_gstate_clone (cairo_gstate_t *gstate)
return NULL;
}
}
clone->next = NULL;
return clone;
}