[cairo-commit] cairo/src cairo-path-data-private.h, 1.2, 1.3 cairo.c, 1.63, 1.64 cairoint.h, 1.110, 1.111

Carl Worth commit at pdx.freedesktop.org
Wed Mar 23 13:52:13 PST 2005


Committed by: cworth

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

Modified Files:
	cairo-path-data-private.h cairo.c cairoint.h 
Log Message:

        * src/cairo-path-data-private.h: Remove CAIRO_BEGIN_DECLS and
        CAIRO_END_DECLS as they are not needed for private headers.

        * src/cairoint.h: Add ASSERT_NOT_REACHED macro.

        * src/cairo.c: (cairo_get_path), (cairo_get_path_flat): Rewrite in
        terms of cairo_copt_path and cairo_copy_path_flat in preparation
        for removing cairo_gstate_interpret_path.


Index: cairo-path-data-private.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-path-data-private.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cairo-path-data-private.h	18 Mar 2005 22:28:53 -0000	1.2
+++ cairo-path-data-private.h	23 Mar 2005 21:52:11 -0000	1.3
@@ -40,8 +40,6 @@
 
 extern cairo_path_t _cairo_path_nil;
 
-CAIRO_BEGIN_DECLS
-
 cairo_path_t *
 _cairo_path_data_create (cairo_gstate_t *gstate);
 
@@ -52,6 +50,4 @@
 _cairo_path_data_append_to_context (cairo_path_t *path,
 				    cairo_t	 *cr);
 
-CAIRO_END_DECLS
-
 #endif /* CAIRO_PATH_DATA_PRIVATE_H */

Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- cairo.c	23 Mar 2005 21:50:51 -0000	1.63
+++ cairo.c	23 Mar 2005 21:52:11 -0000	1.64
@@ -2068,16 +2068,39 @@
 		cairo_close_path_func_t	*close_path,
 		void			*closure)
 {
+    int i;
+    cairo_path_t *path;
+    cairo_path_data_t *data;
+
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
-	
-    cr->status = _cairo_gstate_interpret_path (cr->gstate,
-					       move_to,
-					       line_to,
-					       curve_to,
-					       close_path,
-					       closure);
+ 
+    path = cairo_copy_path (cr);
+
+    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:
+	    (move_to) (closure, data[1].point.x, data[1].point.y);
+	    break;
+	case CAIRO_PATH_LINE_TO:
+	    (line_to) (closure, data[1].point.x, data[1].point.y);
+	    break;
+	case CAIRO_PATH_CURVE_TO:
+	    (curve_to) (closure,
+			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:
+	    (close_path) (closure);
+	    break;
+	}
+    }
+
+    cairo_path_destroy (path);
+
     CAIRO_CHECK_SANITY (cr);
 }
 DEPRECATE (cairo_current_path, cairo_get_path);
@@ -2089,16 +2112,36 @@
 		     cairo_close_path_func_t *close_path,
 		     void		     *closure)
 {
+    int i;
+    cairo_path_t *path;
+    cairo_path_data_t *data;
+
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_interpret_path (cr->gstate,
-					       move_to,
-					       line_to,
-					       NULL,
-					       close_path,
-					       closure);
+    path = cairo_copy_path_flat (cr);
+
+    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:
+	    (move_to) (closure, data[1].point.x, data[1].point.y);
+	    break;
+	case CAIRO_PATH_LINE_TO:
+	    (line_to) (closure, data[1].point.x, data[1].point.y);
+	    break;
+	case CAIRO_PATH_CLOSE_PATH:
+	    (close_path) (closure);
+	    break;
+	case CAIRO_PATH_CURVE_TO:
+	    ASSERT_NOT_REACHED;
+	    break;
+	}
+    }
+
+    cairo_path_destroy (path);
+
     CAIRO_CHECK_SANITY (cr);
 }
 DEPRECATE (cairo_current_path_flat, cairo_get_path_flat);

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -d -r1.110 -r1.111
--- cairoint.h	23 Mar 2005 21:50:51 -0000	1.110
+++ cairoint.h	23 Mar 2005 21:52:11 -0000	1.111
@@ -120,6 +120,12 @@
 #define TRUE 1
 #endif
 
+#define ASSERT_NOT_REACHED		\
+do {					\
+    static const int NOT_REACHED = 0;	\
+    assert (NOT_REACHED);		\
+} while (0)
+
 #include "cairo-wideint.h"
 
 typedef int32_t		cairo_fixed_16_16_t;




More information about the cairo-commit mailing list