diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c index ff09f308b..4fe7e311b 100644 --- a/src/cairo-path-stroke.c +++ b/src/cairo-path-stroke.c @@ -548,11 +548,11 @@ _compute_face (cairo_point_t *point, cairo_slope_t *slope, cairo_stroker_t *stro static cairo_status_t _cairo_stroker_add_sub_edge (cairo_stroker_t *stroker, cairo_point_t *p1, cairo_point_t *p2, - cairo_stroke_face_t *start, cairo_stroke_face_t *end) + cairo_slope_t *slope, cairo_stroke_face_t *start, + cairo_stroke_face_t *end) { cairo_status_t status; cairo_polygon_t polygon; - cairo_slope_t slope; if (p1->x == p2->x && p1->y == p2->y) { /* XXX: Need to rethink how this case should be handled, (both @@ -561,13 +561,12 @@ _cairo_stroker_add_sub_edge (cairo_stroker_t *stroker, cairo_point_t *p1, cairo_ return CAIRO_STATUS_SUCCESS; } - _cairo_slope_init (&slope, p1, p2); - _compute_face (p1, &slope, stroker, start); + _compute_face (p1, slope, stroker, start); /* XXX: This could be optimized slightly by not calling _compute_face again but rather translating the relevant fields from start. */ - _compute_face (p2, &slope, stroker, end); + _compute_face (p2, slope, stroker, end); /* XXX: I should really check the return value of the move_to/line_to functions here to catch out of memory @@ -633,6 +632,7 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point) cairo_stroke_face_t start, end; cairo_point_t *p1 = &stroker->current_point; cairo_point_t *p2 = point; + cairo_slope_t slope; if (!stroker->has_current_point) return _cairo_stroker_move_to (stroker, point); @@ -644,8 +644,10 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point) as possible. */ return CAIRO_STATUS_SUCCESS; } + + _cairo_slope_init (&slope, p1, p2); - status = _cairo_stroker_add_sub_edge (stroker, p1, p2, &start, &end); + status = _cairo_stroker_add_sub_edge (stroker, p1, p2, &slope, &start, &end); if (status) return status; @@ -683,6 +685,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) cairo_stroke_face_t sub_start, sub_end; cairo_point_t *p1 = &stroker->current_point; cairo_point_t *p2 = point; + cairo_slope_t slope; if (!stroker->has_current_point) return _cairo_stroker_move_to (stroker, point); @@ -695,6 +698,8 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) return CAIRO_STATUS_SUCCESS; } + _cairo_slope_init (&slope, p1, p2); + dx = _cairo_fixed_to_double (p2->x - p1->x); dy = _cairo_fixed_to_double (p2->y - p1->y); @@ -719,7 +724,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) * XXX simplify this case analysis */ if (stroker->dash_on) { - status = _cairo_stroker_add_sub_edge (stroker, &fd1, &fd2, &sub_start, &sub_end); + status = _cairo_stroker_add_sub_edge (stroker, &fd1, &fd2, &slope, &sub_start, &sub_end); if (status) return status; if (!first) {