Reorder function bodies to match the order of fields in the structure definition. Some style cleanups.

Fix bug in that several fields were not being copied.
This commit is contained in:
Carl Worth 2005-11-07 10:46:23 +00:00
parent 8d09247fcd
commit 80e4c6307d
2 changed files with 35 additions and 17 deletions

View file

@ -1,3 +1,12 @@
2005-11-07 Carl Worth <cworth@cworth.org>
* src/cairo-clip.c: (_cairo_clip_init), (_cairo_clip_fini),
(_cairo_clip_reset): Reorder function bodies to match the order of
fields in the structure definition. Some style cleanups.
* src/cairo-clip.c: (_cairo_clip_init_copy): Fix bug in that
several fields were not being copied.
2005-11-07 Carl Worth <cworth@cworth.org>
* src/cairo-gstate.c (_cairo_gstate_init_copy): Two more instances

View file

@ -49,60 +49,69 @@ void
_cairo_clip_init (cairo_clip_t *clip, cairo_surface_t *target)
{
clip->mode = _cairo_surface_get_clip_mode (target);
clip->region = NULL;
clip->surface = NULL;
clip->surface_rect.x = 0;
clip->surface_rect.y = 0;
clip->surface_rect.width = 0;
clip->surface_rect.height = 0;
clip->serial = 0;
clip->region = NULL;
clip->path = NULL;
}
void
_cairo_clip_fini (cairo_clip_t *clip)
{
if (clip->surface)
cairo_surface_destroy (clip->surface);
cairo_surface_destroy (clip->surface);
clip->surface = NULL;
if (clip->path)
_cairo_clip_path_destroy (clip->path);
clip->path = NULL;
clip->serial = 0;
if (clip->region)
pixman_region_destroy (clip->region);
clip->region = NULL;
clip->serial = 0;
_cairo_clip_path_destroy (clip->path);
clip->path = NULL;
}
void
_cairo_clip_init_copy (cairo_clip_t *clip, cairo_clip_t *other)
{
clip->mode = other->mode;
clip->surface = cairo_surface_reference (other->surface);
clip->surface_rect = other->surface_rect;
clip->serial = other->serial;
if (other->region) {
clip->region = pixman_region_create ();
pixman_region_copy (clip->region, other->region);
}
cairo_surface_reference (other->surface);
clip->surface = other->surface;
_cairo_clip_path_reference (other->path);
clip->path = other->path;
clip->path = _cairo_clip_path_reference (other->path);
}
cairo_status_t
_cairo_clip_reset (cairo_clip_t *clip)
{
/* destroy any existing clip-region artifacts */
if (clip->surface)
cairo_surface_destroy (clip->surface);
cairo_surface_destroy (clip->surface);
clip->surface = NULL;
clip->serial = 0;
if (clip->region)
pixman_region_destroy (clip->region);
clip->region = NULL;
if (clip->path)
_cairo_clip_path_destroy (clip->path);
_cairo_clip_path_destroy (clip->path);
clip->path = NULL;
clip->serial = 0;
return CAIRO_STATUS_SUCCESS;
}