bgo#685906 - Marker angles are wrong when control points of a curve are coincident
This is a rewrite of the code to draw markers at path vertices. The previous code did a single pass over the cairo_path_t data, and it tried to figure out the appropriate marker type for each vertex (start marker, middle, or end). However, it had trouble with coincident points in curveto commands, and with zero-length path segments. The SVG spec is verbose but clear on the behavior for those cases. The code now does two passes: 1. Take the cairo_path_t data, which is an array of moveto/lineto/curveto/closepath commands, and turn it into a sequence of segments. Each segment either has four control points, *or* it has a single point and the segment is degenerate. 2. Walk that list of segments, and draw the appropriate markers for them. Having the list of segments makes it easy to implement the algorithm from the SVG spec, in which the directionality of special vertices (like those at the ends of zero-length segments) needs to be determined. This code is careful to not do division by zero or to get NaNs in the middle of the computation, which would get Cairo into an error state, preventing further drawing of markers within the path. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=685906
parent
7621ae4f
Please register or sign in to comment