[cairo-commit] cairo/src cairo-path-stroke.c,1.24,1.25

Carl Worth commit at pdx.freedesktop.org
Tue Aug 23 07:44:16 PDT 2005


Committed by: cworth

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

Modified Files:
	cairo-path-stroke.c 
Log Message:

2005-08-23  Carl Worth  <cworth at cworth.org>

        Fix for bug #4205:

        * src/cairo-path-stroke.c: (_cairo_stroker_add_caps):
        (_cairo_path_fixed_stroke_to_traps): Abstract the cap-addition
        code from the end of the stroke operation into a new
        _cairo_stroker_add_caps function.

        * src/cairo-path-stroke.c: (_cairo_stroker_move_to): Call the new
        _cairo_stroker_add_caps at the beginning of every move_to so that
        we get caps on every subpath and not just the last one.


Index: cairo-path-stroke.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-path-stroke.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- cairo-path-stroke.c	23 Mar 2005 22:17:40 -0000	1.24
+++ cairo-path-stroke.c	23 Aug 2005 14:44:14 -0000	1.25
@@ -405,6 +405,35 @@
     }
 }
 
+static cairo_status_t
+_cairo_stroker_add_caps (cairo_stroker_t *stroker)
+{
+    cairo_status_t status;
+
+    if (stroker->has_first_face) {
+	cairo_point_t t;
+	/* The initial cap needs an outward facing vector. Reverse everything */
+	stroker->first_face.usr_vector.x = -stroker->first_face.usr_vector.x;
+	stroker->first_face.usr_vector.y = -stroker->first_face.usr_vector.y;
+	stroker->first_face.dev_vector.dx = -stroker->first_face.dev_vector.dx;
+	stroker->first_face.dev_vector.dy = -stroker->first_face.dev_vector.dy;
+	t = stroker->first_face.cw;
+	stroker->first_face.cw = stroker->first_face.ccw;
+	stroker->first_face.ccw = t;
+	status = _cairo_stroker_cap (stroker, &stroker->first_face);
+	if (status)
+	    return status;
+    }
+
+    if (stroker->has_current_face) {
+	status = _cairo_stroker_cap (stroker, &stroker->current_face);
+	if (status)
+	    return status;
+    }
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
 static void
 _compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_gstate_t *gstate, cairo_stroke_face_t *face)
 {
@@ -527,8 +556,13 @@
 static cairo_status_t
 _cairo_stroker_move_to (void *closure, cairo_point_t *point)
 {
+    cairo_status_t status;
     cairo_stroker_t *stroker = closure;
 
+    status = _cairo_stroker_add_caps (stroker);
+    if (status)
+	return status;
+
     stroker->first_point = *point;
     stroker->current_point = *point;
     stroker->has_current_point = 1;
@@ -824,26 +858,7 @@
     if (status)
 	goto BAIL;
 
-    if (stroker.has_first_face) {
-	cairo_point_t t;
-	/* The initial cap needs an outward facing vector. Reverse everything */
-	stroker.first_face.usr_vector.x = -stroker.first_face.usr_vector.x;
-	stroker.first_face.usr_vector.y = -stroker.first_face.usr_vector.y;
-	stroker.first_face.dev_vector.dx = -stroker.first_face.dev_vector.dx;
-	stroker.first_face.dev_vector.dy = -stroker.first_face.dev_vector.dy;
-	t = stroker.first_face.cw;
-	stroker.first_face.cw = stroker.first_face.ccw;
-	stroker.first_face.ccw = t;
-	status = _cairo_stroker_cap (&stroker, &stroker.first_face);
-	if (status)
-	    goto BAIL;
-    }
-
-    if (stroker.has_current_face) {
-	status = _cairo_stroker_cap (&stroker, &stroker.current_face);
-	if (status)
-	    goto BAIL;
-    }
+    status = _cairo_stroker_add_caps (&stroker);
 
 BAIL:
     _cairo_stroker_fini (&stroker);



More information about the cairo-commit mailing list