[cairo-commit] cairo/src cairo-path-data-private.h, 1.1, 1.2 cairo.c, 1.59, 1.60 cairo.h, 1.83, 1.84 cairo_atsui_font.c, 1.3, 1.4 cairo_font.c, 1.36, 1.37 cairo_ft_font.c, 1.46, 1.47 cairo_gstate.c, 1.93, 1.94 cairo_path.c, 1.20, 1.21 cairo_path_bounds.c, 1.15, 1.16 cairo_path_data.c, 1.1, 1.2 cairo_path_fill.c, 1.14, 1.15 cairo_path_stroke.c, 1.20, 1.21 cairoint.h, 1.107, 1.108

Carl Worth commit at pdx.freedesktop.org
Fri Mar 18 14:28:55 PST 2005


Committed by: cworth

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

Modified Files:
	cairo-path-data-private.h cairo.c cairo.h cairo_atsui_font.c 
	cairo_font.c cairo_ft_font.c cairo_gstate.c cairo_path.c 
	cairo_path_bounds.c cairo_path_data.c cairo_path_fill.c 
	cairo_path_stroke.c cairoint.h 
Log Message:

        * src/cairo-path-data-private.h: * src/cairo.c: (cairo_copy_path),
        (cairo_copy_path_flat),
        (cairo_append_path): Rename cairo_copy_path_data,
        cairop_copy_path_data_flat, and cairo_append_path_data to
        cairo_copy_path, cairo_copy_path_flat, and cairo_append_path.

        * src/cairo.h: Add new cairo_path_t, containing a
        cairo_path_data_t array and an explicit length. Remove
        CAIRO_PATH_END_PATH terminator from cairo_path_data_t.

        * src/cairo_atsui_font.c: (_cairo_atsui_font_glyph_path):
        * src/cairo_font.c: (_cairo_font_glyph_path):
        * src/cairo_ft_font.c: (_move_to), (_line_to), (_conic_to),
        (_cubic_to), (_cairo_ft_font_glyph_path):
        * src/cairo_gstate.c: (_cairo_gstate_interpret_path):
        * src/cairo_path.c: (_cairo_path_init), (_cairo_path_init_copy),
        (_cairo_path_fini), (_cairo_path_move_to),
        (_cairo_path_rel_move_to), (_cairo_path_line_to),
        (_cairo_path_rel_line_to), (_cairo_path_curve_to),
        (_cairo_path_rel_curve_to), (_cairo_path_close_path),
        (_cairo_path_get_current_point), (_cairo_path_add),
        (_cairo_path_add_op_buf), (_cairo_path_new_op_buf),
        (_cairo_path_add_arg_buf), (_cairo_path_new_arg_buf),
        (_cairo_path_interpret):
        * src/cairo_path_bounds.c: (_cairo_path_bounds):
        * src/cairo_path_data.c: (_cairo_path_data_count),
        (_cairo_path_data_populate), (_cairo_path_data_create_real),
        (cairo_path_destroy), (_cairo_path_data_append_to_context):
        * src/cairo_path_fill.c: (_cairo_path_fill_to_traps):
        * src/cairo_path_stroke.c: (_cairo_path_stroke_to_traps):
        * src/cairoint.h:
        * test/path_data.c: (munge_and_set_path), (draw), (main): Rename
        the internal path object from cairo_path_t to cairo_path_real_t.


Index: cairo-path-data-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-path-data-private.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo-path-data-private.h	11 Mar 2005 22:29:15 -0000	1.1
+++ cairo-path-data-private.h	18 Mar 2005 22:28:53 -0000	1.2
@@ -38,19 +38,19 @@
 
 #include "cairoint.h"
 
-extern cairo_path_data_t _cairo_path_data_nil;
+extern cairo_path_t _cairo_path_nil;
 
 CAIRO_BEGIN_DECLS
 
-cairo_path_data_t *
+cairo_path_t *
 _cairo_path_data_create (cairo_gstate_t *gstate);
 
-cairo_path_data_t *
+cairo_path_t *
 _cairo_path_data_create_flat (cairo_gstate_t *gstate);
 
 cairo_status_t
-_cairo_path_data_append_to_context (cairo_path_data_t *path_data,
-				    cairo_t	      *cr);
+_cairo_path_data_append_to_context (cairo_path_t *path,
+				    cairo_t	 *cr);
 
 CAIRO_END_DECLS
 

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- cairo.c	17 Mar 2005 21:27:26 -0000	1.59
+++ cairo.c	18 Mar 2005 22:28:53 -0000	1.60
@@ -1708,83 +1708,83 @@
 DEPRECATE (cairo_current_path_flat, cairo_get_path_flat);
 
 /**
- * cairo_copy_path_data:
+ * cairo_copy_path:
  * @cr: a cairo context
  * 
- * Creates a copy of the current path and returns it to the user as an
- * array of #cairo_path_data_t. See #cairo_path_data_t for hints on
- * how to iterate over the returned data structure.
+ * Creates a copy of the current path and returns it to the user as a
+ * #cairo_path_t. See #cairo_path_data_t for hints on how to iterate
+ * over the returned data structure.
  * 
- * Return value: the copy of the current path. The caller is
- * responsible for the returned memory and should free() it when
- * finished.
+ * Return value: the copy of the current path. The caller owns the
+ * returned object and should call cairo_path_destroy() when finished
+ * with it.
  **/
-cairo_path_data_t *
-cairo_copy_path_data (cairo_t *cr)
+cairo_path_t *
+cairo_copy_path (cairo_t *cr)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
-	return &_cairo_path_data_nil;
+	return &_cairo_path_nil;
 
     return _cairo_path_data_create (cr->gstate);
 }
 
 /**
- * cairo_copy_path_data_flat:
+ * cairo_copy_path_flat:
  * @cr: a cairo context
  * 
  * Gets a flattened copy of the current path and returns it to the
- * user an an array of #cairo_path_data_t. See #cairo_path_data_t for hints on
+ * user as a #cairo_path_t. See #cairo_path_data_t for hints on
  * how to iterate over the returned data structure.
  *
- * This function is like cairo_copy_path_data() except that any curves
+ * This function is like cairo_copy_path() except that any curves
  * in the path will be approximated with piecewise-linear
  * approximations, (accurate to within the current tolerance
  * value). That is, the result is guaranteed to not have any elements
  * of type CAIRO_PATH_CURVE_TO which will instead be replaced by a
  * series of CAIRO_PATH_LINE_TO elements.
  * 
- * Return value: the copy of the current path. The caller is
- * responsible for the returned memory and should free() it when
- * finished.
+ * Return value: the copy of the current path. The caller owns the
+ * returned object and should call cairo_path_destroy() when finished
+ * with it.
  **/
-cairo_path_data_t *
-cairo_copy_path_data_flat (cairo_t *cr)
+cairo_path_t *
+cairo_copy_path_flat (cairo_t *cr)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
-	return &_cairo_path_data_nil;
+	return &_cairo_path_nil;
 
     return _cairo_path_data_create_flat (cr->gstate);
 }
 
 /**
- * cairo_append_path_data:
+ * cairo_append_path:
  * @cr: a cairo context
- * @path_data: path data to be appended
+ * @path: path to be appended
  * 
- * Append the @path_data onto the current path. See #cairo_path_data_t
- * for details on how the path data array must be initialized.
+ * Append the @path onto the current path. See #cairo_path_t
+ * for details on how the path data structure must be initialized.
  **/
 void
-cairo_append_path_data (cairo_t		  *cr,
-			cairo_path_data_t *path_data)
+cairo_append_path (cairo_t	*cr,
+		   cairo_path_t *path)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    if (!path_data) {
+    if (path == NULL || path->data == NULL) {
 	cr->status = CAIRO_STATUS_NULL_POINTER;
 	return;
     }
 
-    if (path_data == &_cairo_path_data_nil) {
+    if (path == &_cairo_path_nil) {
 	cr->status = CAIRO_STATUS_NO_MEMORY;
 	return;
     }
 
-    cr->status = _cairo_path_data_append_to_context (path_data, cr);
+    cr->status = _cairo_path_data_append_to_context (path, cr);
 
     CAIRO_CHECK_SANITY (cr);
 }

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- cairo.h	17 Mar 2005 20:57:43 -0000	1.83
+++ cairo.h	18 Mar 2005 22:28:53 -0000	1.84
@@ -703,15 +703,12 @@
 /**
  * cairo_path_data_t:
  *
- * A data structure for holding path data. This data structure is used
- * as the return value for cairo_copy_path_data() and
- * cairo_copy_path_data_flat() as well the input value for
- * cairo_append_path_data().
+ * A data structure for holding path data---appears within
+ * #cairo_path_t.
  *
  * The data structure is designed to try to balance the demands of
  * efficiency and ease-of-use. A path is represented as an array of
- * cairo_path_data_t which is a union of headers and points. The array
- * must be terminated by a header element of type CAIRO_PATH_END_PATH.
+ * cairo_path_data_t which is a union of headers and points.
  *
  * Each portion of the path is represented by one or more elements in
  * the array, (one header followed by 0 or more points). The length
@@ -729,26 +726,28 @@
  * with cairo_move_to(), cairo_line_to(), cairo_curve_to(), and
  * cairo_close_path().
  *
- * Here is sample code for iterating through a cairo_path_data_t
- * array:
+ * Here is sample code for iterating through a #cairo_path_t:
  *
  * <informalexample><programlisting>
- *	cairo_path_data_t *path, *p;
+ *      int i;
+ *	cairo_path_t *path;
+ *      cairo_path_data_t *data;
  *
- *	path = cairo_copy_path_data (cr);
+ *	path = cairo_copy_path (cr);
  *
- *	for (p = path; p->header.type != CAIRO_PATH_END; p += p->header.length) {
- *	    switch (p->header.type) {
+ *      for (i=0; i < path->num_data; i += path->data[i].header.length) {
+ *          data = &path->data[i];
+ *	    switch (data->header.type) {
  *	    case CAIRO_PATH_MOVE_TO:
- *		do_move_to_things (p[1].point.x, p[1].point.y);
+ *		do_move_to_things (data[1].point.x, data[1].point.y);
  *		break;
  *	    case CAIRO_PATH_LINE_TO:
- *		do_line_to_things (p[1].point.x, p[1].point.y);
+ *		do_line_to_things (data[1].point.x, data[1].point.y);
  *		break;
  *	    case CAIRO_PATH_CURVE_TO:
- *		do_curve_to_things (p[1].point.x, p[1].point.y,
- *				    p[2].point.x, p[2].point.y,
- *				    p[3].point.x, p[3].point.y);
+ *		do_curve_to_things (data[1].point.x, data[1].point.y,
+ *				    data[2].point.x, data[2].point.y,
+ *				    data[3].point.x, data[3].point.y);
  *		break;
  *	    case CAIRO_PATH_CLOSE_PATH:
  *		do_close_path_things ();
@@ -756,7 +755,7 @@
  *	    }
  *	}
  *
- *	free (path);
+ *	cairo_path_destroy (path);
  * </programlisting></informalexample>
  */
 typedef union {
@@ -765,8 +764,7 @@
 	    CAIRO_PATH_MOVE_TO,
 	    CAIRO_PATH_LINE_TO,
 	    CAIRO_PATH_CURVE_TO,
-	    CAIRO_PATH_CLOSE_PATH,
-	    CAIRO_PATH_END
+	    CAIRO_PATH_CLOSE_PATH
 	} type;
 	int length;
     } header;
@@ -775,15 +773,39 @@
     } point;
 } cairo_path_data_t;
 
-cairo_path_data_t *
-cairo_copy_path_data (cairo_t *cr);
+/**
+ * cairo_path_t:
+ *
+ * A data structure for holding a path. This data structure serves as
+ * the return value for cairo_copy_path_data() and
+ * cairo_copy_path_data_flat() as well the input value for
+ * cairo_append_path_data().
+ *
+ * See #cairo_path_data_t for hints on how to iterate over the
+ * actual data within the path.
+ *
+ * The num_data member gives the number of elements in the data
+ * array. This number is larger than the number of independent path
+ * portions (MOVE_TO, LINE_TO, CURVE_TO, CLOSE_PATH), since the data
+ * includes both headers and coordinates for each portion.
+ **/
+typedef struct cairo_path {
+    cairo_path_data_t *data;
+    int num_data;
+} cairo_path_t;
 
-cairo_path_data_t *
-cairo_copy_path_data_flat (cairo_t *cr);
+cairo_path_t *
+cairo_copy_path (cairo_t *cr);
+
+cairo_path_t *
+cairo_copy_path_flat (cairo_t *cr);
 
 void
-cairo_append_path_data (cairo_t		  *cr,
-			cairo_path_data_t *path_data);
+cairo_append_path (cairo_t	*cr,
+		   cairo_path_t *path);
+
+void
+cairo_path_destroy (cairo_path_t *path);
 
 /* Error status queries */
 

Index: cairo_atsui_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_atsui_font.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo_atsui_font.c	22 Feb 2005 19:32:02 -0000	1.3
+++ cairo_atsui_font.c	18 Mar 2005 22:28:53 -0000	1.4
@@ -58,7 +58,7 @@
 
 
 typedef struct cairo_ATSUI_glyph_path_callback_info_t {
-	cairo_path_t		*path;
+	cairo_path_real_t	*path;
 	cairo_matrix_t		scale;
 } cairo_ATSUI_glyph_path_callback_info_t;
 
@@ -676,7 +676,7 @@
 								cairo_font_scale_t 	*sc,
 								cairo_glyph_t		*glyphs, 
 								int					num_glyphs,
-								cairo_path_t		*path)
+								cairo_path_real_t	*path)
 {
 	int										i;
 	cairo_atsui_font_t						*font = abstract_font;

Index: cairo_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_font.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- cairo_font.c	16 Mar 2005 20:08:41 -0000	1.36
+++ cairo_font.c	18 Mar 2005 22:28:53 -0000	1.37
@@ -137,7 +137,7 @@
 _cairo_font_glyph_path (cairo_font_t	   *font,
 			cairo_glyph_t	   *glyphs, 
 			int		    num_glyphs,
-			cairo_path_t       *path)
+			cairo_path_real_t  *path)
 {
     return font->backend->glyph_path (font, glyphs, num_glyphs, path);
 }

Index: cairo_ft_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ft_font.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- cairo_ft_font.c	17 Mar 2005 21:27:26 -0000	1.46
+++ cairo_ft_font.c	18 Mar 2005 22:28:53 -0000	1.47
@@ -1054,7 +1054,7 @@
 static int
 _move_to (FT_Vector *to, void *closure)
 {
-    cairo_path_t *path = closure;
+    cairo_path_real_t *path = closure;
     cairo_point_t point;
 
     point.x = _cairo_fixed_from_26_6 (to->x);
@@ -1069,7 +1069,7 @@
 static int
 _line_to (FT_Vector *to, void *closure)
 {
-    cairo_path_t *path = closure;
+    cairo_path_real_t *path = closure;
     cairo_point_t point;
 
     point.x = _cairo_fixed_from_26_6 (to->x);
@@ -1083,7 +1083,7 @@
 static int
 _conic_to (FT_Vector *control, FT_Vector *to, void *closure)
 {
-    cairo_path_t *path = closure;
+    cairo_path_real_t *path = closure;
 
     cairo_point_t p0, p1, p2, p3;
     cairo_point_t conic;
@@ -1111,7 +1111,7 @@
 static int
 _cubic_to (FT_Vector *control1, FT_Vector *control2, FT_Vector *to, void *closure)
 {
-    cairo_path_t *path = closure;
+    cairo_path_real_t *path = closure;
     cairo_point_t p0, p1, p2;
 
     p0.x = _cairo_fixed_from_26_6 (control1->x);
@@ -1132,7 +1132,7 @@
 _cairo_ft_font_glyph_path (void				*abstract_font,
                            cairo_glyph_t		*glyphs, 
                            int				num_glyphs,
-                           cairo_path_t			*path)
+                           cairo_path_real_t		*path)
 {
     int i;
     cairo_ft_font_t *font = abstract_font;

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- cairo_gstate.c	17 Mar 2005 20:57:43 -0000	1.93
+++ cairo_gstate.c	18 Mar 2005 22:28:53 -0000	1.94
@@ -1301,7 +1301,7 @@
 			      cairo_close_path_func_t	*close_path,
 			      void			*closure)
 {
-    cairo_path_t path;
+    cairo_path_real_t path;
     gpi_t gpi;
 
     /* Anything we want from gstate must be copied. We must not retain

Index: cairo_path.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cairo_path.c	9 Mar 2005 20:35:36 -0000	1.20
+++ cairo_path.c	18 Mar 2005 22:28:53 -0000	1.21
@@ -39,19 +39,22 @@
 
 /* private functions */
 static cairo_status_t
-_cairo_path_add (cairo_path_t *path, cairo_path_op_t op, cairo_point_t *points, int num_pts);
+_cairo_path_add (cairo_path_real_t *path,
+		 cairo_path_op_t    op,
+		 cairo_point_t     *points,
+		 int		    num_points);
 
 static void
-_cairo_path_add_op_buf (cairo_path_t *path, cairo_path_op_buf_t *op);
+_cairo_path_add_op_buf (cairo_path_real_t *path, cairo_path_op_buf_t *op);
 
 static cairo_status_t
-_cairo_path_new_op_buf (cairo_path_t *path);
+_cairo_path_new_op_buf (cairo_path_real_t *path);
 
 static void
-_cairo_path_add_arg_buf (cairo_path_t *path, cairo_path_arg_buf_t *arg);
+_cairo_path_add_arg_buf (cairo_path_real_t *path, cairo_path_arg_buf_t *arg);
 
 static cairo_status_t
-_cairo_path_new_arg_buf (cairo_path_t *path);
+_cairo_path_new_arg_buf (cairo_path_real_t *path);
 
 static cairo_path_op_buf_t *
 _cairo_path_op_buf_create (void);
@@ -69,10 +72,12 @@
 _cairo_path_arg_buf_destroy (cairo_path_arg_buf_t *buf);
 
 static void
-_cairo_path_arg_buf_add (cairo_path_arg_buf_t *arg, cairo_point_t *points, int num_points);
+_cairo_path_arg_buf_add (cairo_path_arg_buf_t *arg,
+			 cairo_point_t	      *points,
+			 int		       num_points);
 
 void
-_cairo_path_init (cairo_path_t *path)
+_cairo_path_init (cairo_path_real_t *path)
 {
     path->op_head = NULL;
     path->op_tail = NULL;
@@ -87,7 +92,7 @@
 }
 
 cairo_status_t
-_cairo_path_init_copy (cairo_path_t *path, cairo_path_t *other)
+_cairo_path_init_copy (cairo_path_real_t *path, cairo_path_real_t *other)
 {
     cairo_path_op_buf_t *op, *other_op;
     cairo_path_arg_buf_t *arg, *other_arg;
@@ -121,7 +126,7 @@
 }
 
 void
-_cairo_path_fini (cairo_path_t *path)
+_cairo_path_fini (cairo_path_real_t *path)
 {
     cairo_path_op_buf_t *op;
     cairo_path_arg_buf_t *arg;
@@ -144,7 +149,7 @@
 }
 
 cairo_status_t
-_cairo_path_move_to (cairo_path_t *path, cairo_point_t *point)
+_cairo_path_move_to (cairo_path_real_t *path, cairo_point_t *point)
 {
     cairo_status_t status;
 
@@ -160,7 +165,7 @@
 }
 
 cairo_status_t
-_cairo_path_rel_move_to (cairo_path_t *path, cairo_distance_t *distance)
+_cairo_path_rel_move_to (cairo_path_real_t *path, cairo_distance_t *distance)
 {
     cairo_point_t point;
 
@@ -171,7 +176,7 @@
 }
 
 cairo_status_t
-_cairo_path_line_to (cairo_path_t *path, cairo_point_t *point)
+_cairo_path_line_to (cairo_path_real_t *path, cairo_point_t *point)
 {
     cairo_status_t status;
 
@@ -186,7 +191,7 @@
 }
 
 cairo_status_t
-_cairo_path_rel_line_to (cairo_path_t *path, cairo_distance_t *distance)
+_cairo_path_rel_line_to (cairo_path_real_t *path, cairo_distance_t *distance)
 {
     cairo_point_t point;
 
@@ -197,7 +202,7 @@
 }
 
 cairo_status_t
-_cairo_path_curve_to (cairo_path_t *path,
+_cairo_path_curve_to (cairo_path_real_t *path,
 		      cairo_point_t *p0,
 		      cairo_point_t *p1,
 		      cairo_point_t *p2)
@@ -220,10 +225,10 @@
 }
 
 cairo_status_t
-_cairo_path_rel_curve_to (cairo_path_t *path,
-			  cairo_distance_t *d0,
-			  cairo_distance_t *d1,
-			  cairo_distance_t *d2)
+_cairo_path_rel_curve_to (cairo_path_real_t *path,
+			  cairo_distance_t  *d0,
+			  cairo_distance_t  *d1,
+			  cairo_distance_t  *d2)
 {
     cairo_point_t p0, p1, p2;
 
@@ -240,7 +245,7 @@
 }
 
 cairo_status_t
-_cairo_path_close_path (cairo_path_t *path)
+_cairo_path_close_path (cairo_path_real_t *path)
 {
     cairo_status_t status;
 
@@ -256,7 +261,7 @@
 }
 
 cairo_status_t
-_cairo_path_get_current_point (cairo_path_t *path, cairo_point_t *point)
+_cairo_path_get_current_point (cairo_path_real_t *path, cairo_point_t *point)
 {
     if (! path->has_current_point)
 	return CAIRO_STATUS_NO_CURRENT_POINT;
@@ -267,7 +272,10 @@
 }
 
 static cairo_status_t
-_cairo_path_add (cairo_path_t *path, cairo_path_op_t op, cairo_point_t *points, int num_points)
+_cairo_path_add (cairo_path_real_t *path,
+		 cairo_path_op_t    op,
+		 cairo_point_t     *points,
+		 int		    num_points)
 {
     cairo_status_t status;
 
@@ -289,7 +297,7 @@
 }
 
 static void
-_cairo_path_add_op_buf (cairo_path_t *path, cairo_path_op_buf_t *op)
+_cairo_path_add_op_buf (cairo_path_real_t *path, cairo_path_op_buf_t *op)
 {
     op->next = NULL;
     op->prev = path->op_tail;
@@ -304,7 +312,7 @@
 }
 
 static cairo_status_t
-_cairo_path_new_op_buf (cairo_path_t *path)
+_cairo_path_new_op_buf (cairo_path_real_t *path)
 {
     cairo_path_op_buf_t *op;
 
@@ -318,7 +326,7 @@
 }
 
 static void
-_cairo_path_add_arg_buf (cairo_path_t *path, cairo_path_arg_buf_t *arg)
+_cairo_path_add_arg_buf (cairo_path_real_t *path, cairo_path_arg_buf_t *arg)
 {
     arg->next = NULL;
     arg->prev = path->arg_tail;
@@ -333,7 +341,7 @@
 }
 
 static cairo_status_t
-_cairo_path_new_arg_buf (cairo_path_t *path)
+_cairo_path_new_arg_buf (cairo_path_real_t *path)
 {
     cairo_path_arg_buf_t *arg;
 
@@ -416,8 +424,8 @@
 };
 
 cairo_status_t
-_cairo_path_interpret (cairo_path_t			*path,
-		       cairo_direction_t		dir,
+_cairo_path_interpret (cairo_path_real_t		*path,
+		       cairo_direction_t		 dir,
 		       cairo_path_move_to_func_t	*move_to,
 		       cairo_path_line_to_func_t	*line_to,
 		       cairo_path_curve_to_func_t	*curve_to,

Index: cairo_path_bounds.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path_bounds.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cairo_path_bounds.c	22 Feb 2005 19:35:03 -0000	1.15
+++ cairo_path_bounds.c	18 Mar 2005 22:28:53 -0000	1.16
@@ -151,7 +151,9 @@
 
 /* XXX: Perhaps this should compute a PixRegion rather than 4 doubles */
 cairo_status_t
-_cairo_path_bounds (cairo_path_t *path, double *x1, double *y1, double *x2, double *y2)
+_cairo_path_bounds (cairo_path_real_t *path,
+		    double *x1, double *y1,
+		    double *x2, double *y2)
 {
     cairo_status_t status;
 

Index: cairo_path_data.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path_data.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo_path_data.c	11 Mar 2005 22:29:15 -0000	1.1
+++ cairo_path_data.c	18 Mar 2005 22:28:53 -0000	1.2
@@ -35,8 +35,8 @@
 
 #include "cairo-path-data-private.h"
 
-cairo_path_data_t
-_cairo_path_data_nil = { {0} };
+cairo_path_t
+_cairo_path_nil = { NULL, 0 };
 
 /* Closure for path interpretation. */
 typedef struct cairo_path_data_count {
@@ -92,9 +92,6 @@
 				  _cpdc_close_path,
 				  &cpdc);
 
-    /* Add 1 for the final CAIRO_PATH_END */
-    cpdc.count++;
-
     return cpdc.count;
 }
 
@@ -173,14 +170,13 @@
 }
 
 static void
-_cairo_path_data_populate (cairo_path_data_t *data,
-			   int		     count,
-			   cairo_gstate_t    *gstate,
-			   cairo_bool_t	     flatten)
+_cairo_path_data_populate (cairo_path_t   *path,
+			   cairo_gstate_t *gstate,
+			   cairo_bool_t	   flatten)
 {
     cpdp_t cpdp;
 
-    cpdp.data = data;
+    cpdp.data = path->data;
 
     _cairo_gstate_interpret_path (gstate,
 				  _cpdp_move_to,
@@ -189,50 +185,61 @@
 				  _cpdp_close_path,
 				  &cpdp);
 
-    cpdp.data->header.type = CAIRO_PATH_END;
-    cpdp.data->header.length = 0;
-    cpdp.data++;
-
     /* Sanity check the count */
-    assert (cpdp.data - data == count);
+    assert (cpdp.data - path->data == path->num_data);
 }
 
-static cairo_path_data_t *
+static cairo_path_t *
 _cairo_path_data_create_real (cairo_gstate_t *gstate, cairo_bool_t flatten)
 {
-    int count;
-    cairo_path_data_t *data;
+    cairo_path_t *path;
 
-    count = _cairo_path_data_count (gstate, flatten);
+    path = malloc (sizeof (cairo_path_t));
+    if (path == NULL)
+	return &_cairo_path_nil;
 
-    data = malloc (count * sizeof (cairo_path_data_t));
-    if (data == NULL)
-	return &_cairo_path_data_nil;
+    path->num_data = _cairo_path_data_count (gstate, flatten);
 
-    _cairo_path_data_populate (data, count, gstate, flatten);
+    path->data = malloc (path->num_data * sizeof (cairo_path_data_t));
+    if (path->data == NULL) {
+	free (path);
+	return &_cairo_path_nil;
+    }
 
-    return data;
+    _cairo_path_data_populate (path, gstate, flatten);
+
+    return path;
 }
 
-cairo_path_data_t *
+void
+cairo_path_destroy (cairo_path_t *path)
+{
+    free (path->data);
+    path->num_data = 0;
+    free (path);
+}
+
+cairo_path_t *
 _cairo_path_data_create (cairo_gstate_t *gstate)
 {
     return _cairo_path_data_create_real (gstate, FALSE);
 }
 
-cairo_path_data_t *
+cairo_path_t *
 _cairo_path_data_create_flat (cairo_gstate_t *gstate)
 {
     return _cairo_path_data_create_real (gstate, TRUE);
 }
 
 cairo_status_t
-_cairo_path_data_append_to_context (cairo_path_data_t *path_data,
-				    cairo_t	      *cr)
+_cairo_path_data_append_to_context (cairo_path_t *path,
+				    cairo_t	 *cr)
 {
+    int i;
     cairo_path_data_t *p;
 
-    for (p = path_data; p->header.type != CAIRO_PATH_END; p += p->header.length) {
+    for (i=0; i < path->num_data; i += path->data[i].header.length) {
+	p = &path->data[i];
 	switch (p->header.type) {
 	case CAIRO_PATH_MOVE_TO:
 	    cairo_move_to (cr,

Index: cairo_path_fill.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path_fill.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cairo_path_fill.c	22 Feb 2005 19:35:03 -0000	1.14
+++ cairo_path_fill.c	18 Mar 2005 22:28:53 -0000	1.15
@@ -171,7 +171,9 @@
 }
 
 cairo_status_t
-_cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
+_cairo_path_fill_to_traps (cairo_path_real_t *path,
+			   cairo_gstate_t    *gstate,
+			   cairo_traps_t     *traps)
 {
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
     cairo_filler_t filler;

Index: cairo_path_stroke.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_path_stroke.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cairo_path_stroke.c	22 Feb 2005 19:35:03 -0000	1.20
+++ cairo_path_stroke.c	18 Mar 2005 22:28:53 -0000	1.21
@@ -794,7 +794,9 @@
 }
 
 cairo_status_t
-_cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps)
+_cairo_path_stroke_to_traps (cairo_path_real_t *path,
+			     cairo_gstate_t    *gstate,
+			     cairo_traps_t     *traps)
 {
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
     cairo_stroker_t stroker;

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- cairoint.h	17 Mar 2005 20:57:43 -0000	1.107
+++ cairoint.h	18 Mar 2005 22:28:53 -0000	1.108
@@ -218,7 +218,7 @@
     cairo_point_t last_move_point;
     cairo_point_t current_point;
     int has_current_point;
-} cairo_path_t;
+} cairo_path_real_t;
 
 typedef struct _cairo_edge {
     cairo_line_t edge;
@@ -516,7 +516,7 @@
     cairo_status_t (*glyph_path)     (void			*font,
 				      cairo_glyph_t		*glyphs, 
 				      int			num_glyphs,
-				      cairo_path_t		*path);
+				      cairo_path_real_t		*path);
     void (*get_glyph_cache_key)      (void                      *font,
 				      cairo_glyph_cache_key_t   *key);
 
@@ -876,7 +876,7 @@
     cairo_matrix_t ctm;
     cairo_matrix_t ctm_inverse;
 
-    cairo_path_t path;
+    cairo_path_real_t path;
 
     cairo_pen_t pen_regular;
 
@@ -1313,14 +1313,14 @@
 cairo_private cairo_status_t
 _cairo_font_glyph_path (cairo_font_t        *font,
 			cairo_glyph_t       *glyphs, 
-			int                 num_glyphs,
-			cairo_path_t        *path);
+			int                  num_glyphs,
+			cairo_path_real_t   *path);
 
 cairo_private cairo_status_t
 _cairo_font_glyph_path (cairo_font_t        *font,
 			cairo_glyph_t       *glyphs, 
-			int                 num_glyphs,
-			cairo_path_t        *path);
+			int                  num_glyphs,
+			cairo_path_real_t   *path);
 
 cairo_private void
 _cairo_font_get_glyph_cache_key (cairo_font_t            *font,
@@ -1332,43 +1332,43 @@
 
 /* cairo_path.c */
 cairo_private void
-_cairo_path_init (cairo_path_t *path);
+_cairo_path_init (cairo_path_real_t *path);
 
 cairo_private cairo_status_t
-_cairo_path_init_copy (cairo_path_t *path, cairo_path_t *other);
+_cairo_path_init_copy (cairo_path_real_t *path, cairo_path_real_t *other);
 
 cairo_private void
-_cairo_path_fini (cairo_path_t *path);
+_cairo_path_fini (cairo_path_real_t *path);
 
 cairo_private cairo_status_t
-_cairo_path_move_to (cairo_path_t *path, cairo_point_t *point);
+_cairo_path_move_to (cairo_path_real_t *path, cairo_point_t *point);
 
 cairo_private cairo_status_t
-_cairo_path_rel_move_to (cairo_path_t *path, cairo_slope_t *slope);
+_cairo_path_rel_move_to (cairo_path_real_t *path, cairo_slope_t *slope);
 
 cairo_private cairo_status_t
-_cairo_path_line_to (cairo_path_t *path, cairo_point_t *point);
+_cairo_path_line_to (cairo_path_real_t *path, cairo_point_t *point);
 
 cairo_private cairo_status_t
-_cairo_path_rel_line_to (cairo_path_t *path, cairo_slope_t *slope);
+_cairo_path_rel_line_to (cairo_path_real_t *path, cairo_slope_t *slope);
 
 cairo_private cairo_status_t
-_cairo_path_curve_to (cairo_path_t *path,
-		      cairo_point_t *p0,
-		      cairo_point_t *p1,
-		      cairo_point_t *p2);
+_cairo_path_curve_to (cairo_path_real_t *path,
+		      cairo_point_t     *p0,
+		      cairo_point_t     *p1,
+		      cairo_point_t     *p2);
 
 cairo_private cairo_status_t
-_cairo_path_rel_curve_to (cairo_path_t *path,
-			  cairo_slope_t *s0,
-			  cairo_slope_t *s1,
-			  cairo_slope_t *s2);
+_cairo_path_rel_curve_to (cairo_path_real_t *path,
+			  cairo_slope_t     *s0,
+			  cairo_slope_t     *s1,
+			  cairo_slope_t     *s2);
 
 cairo_private cairo_status_t
-_cairo_path_close_path (cairo_path_t *path);
+_cairo_path_close_path (cairo_path_real_t *path);
 
 cairo_private cairo_status_t
-_cairo_path_get_current_point (cairo_path_t *path, cairo_point_t *point);
+_cairo_path_get_current_point (cairo_path_real_t *path, cairo_point_t *point);
 
 typedef cairo_status_t (cairo_path_move_to_func_t) (void *closure,
 						    cairo_point_t *point);
@@ -1384,8 +1384,8 @@
 typedef cairo_status_t (cairo_path_close_path_func_t) (void *closure);
 
 cairo_private cairo_status_t
-_cairo_path_interpret (cairo_path_t			*path,
-		       cairo_direction_t		dir,
+_cairo_path_interpret (cairo_path_real_t		*path,
+		       cairo_direction_t		 dir,
 		       cairo_path_move_to_func_t	*move_to,
 		       cairo_path_line_to_func_t	*line_to,
 		       cairo_path_curve_to_func_t	*curve_to,
@@ -1393,15 +1393,21 @@
 		       void				*closure);
 
 cairo_private cairo_status_t
-_cairo_path_bounds (cairo_path_t *path, double *x1, double *y1, double *x2, double *y2);
+_cairo_path_bounds (cairo_path_real_t *path,
+		    double *x1, double *y1,
+		    double *x2, double *y2);
 
 /* cairo_path_fill.c */
 cairo_private cairo_status_t
-_cairo_path_fill_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps);
+_cairo_path_fill_to_traps (cairo_path_real_t *path,
+			   cairo_gstate_t    *gstate,
+			   cairo_traps_t     *traps);
 
 /* cairo_path_stroke.c */
 cairo_private cairo_status_t
-_cairo_path_stroke_to_traps (cairo_path_t *path, cairo_gstate_t *gstate, cairo_traps_t *traps);
+_cairo_path_stroke_to_traps (cairo_path_real_t *path,
+			     cairo_gstate_t    *gstate,
+			     cairo_traps_t     *traps);
 
 /* cairo_surface.c */
 cairo_private cairo_surface_t *




More information about the cairo-commit mailing list