From 8a2ea660fb59beb4eacaf73978368c8db7a6b584 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sun, 9 Apr 2006 23:10:46 -0400 Subject: [PATCH] Check for zero length dashed lines. This makes line_to_dashed more like line_to by returning immediately on degenerate paths. This is needed so that we can do the slope calculation for the entire line. --- src/cairo-path-stroke.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c index a02a3aaa4..ff09f308b 100644 --- a/src/cairo-path-stroke.c +++ b/src/cairo-path-stroke.c @@ -686,7 +686,15 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point) if (!stroker->has_current_point) return _cairo_stroker_move_to (stroker, point); - + + if (p1->x == p2->x && p1->y == p2->y) { + /* XXX: Need to rethink how this case should be handled, (both + here and in cairo_stroker_add_sub_edge and in _compute_face). The + key behavior is that degenerate paths should draw as much + as possible. */ + return CAIRO_STATUS_SUCCESS; + } + dx = _cairo_fixed_to_double (p2->x - p1->x); dy = _cairo_fixed_to_double (p2->y - p1->y);