[cairo-commit] cairo/src cairo-clip.c,1.5,1.6

Carl Worth commit at pdx.freedesktop.org
Mon Nov 7 10:46:25 PST 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv5757/src

Modified Files:
	cairo-clip.c 
Log Message:

2005-11-07  Carl Worth  <cworth at 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.


Index: cairo-clip.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-clip.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cairo-clip.c	12 Oct 2005 22:05:09 -0000	1.5
+++ cairo-clip.c	7 Nov 2005 18:46:23 -0000	1.6
@@ -49,60 +49,69 @@
 _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;
 }



More information about the cairo-commit mailing list