stroke: Don't drop clockwise==0 lines

If the join indicates the pair of edges are parallel, we may be
considering the final segment of the spline with a different tangent
vector than the slope of the final edge and so lead to false dropping of
an edge. This has the effect that the line segments between 'arc arc arc
arc' (a rounded rectangle) are no longer horizontal or vertical. As path
construction tries to eliminate joins between colinear segments, this
optimisation should not be required anyway.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2012-05-14 17:46:32 +01:00
parent 099420a07c
commit e41dffb329
16 changed files with 3 additions and 11 deletions

View file

@ -1052,7 +1052,6 @@ line_to (void *closure,
cairo_stroke_face_t start;
cairo_point_t *p1 = &stroker->current_face.point;
cairo_slope_t dev_slope;
int move_last = 0;
stroker->has_initial_sub_path = TRUE;
@ -1069,9 +1068,7 @@ line_to (void *closure,
if (stroker->has_current_face) {
int clockwise = _cairo_slope_compare (&stroker->current_face.dev_vector,
&start.dev_vector);
if (clockwise == 0) {
move_last = 1;
} else {
if (clockwise) {
clockwise = clockwise < 0;
/* Join with final face from previous segment */
if (! within_tolerance (&stroker->current_face.ccw, &start.ccw,
@ -1102,13 +1099,8 @@ line_to (void *closure,
stroker->current_face.cw.x += dev_slope.dx;
stroker->current_face.cw.y += dev_slope.dy;
if (move_last) {
*_cairo_contour_last_point (&stroker->cw.contour) = stroker->current_face.cw;
*_cairo_contour_last_point (&stroker->ccw.contour) = stroker->current_face.ccw;
} else {
contour_add_point (stroker, &stroker->cw, &stroker->current_face.cw);
contour_add_point (stroker, &stroker->ccw, &stroker->current_face.ccw);
}
contour_add_point (stroker, &stroker->cw, &stroker->current_face.cw);
contour_add_point (stroker, &stroker->ccw, &stroker->current_face.ccw);
return CAIRO_STATUS_SUCCESS;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 951 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 569 B

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 951 B