Commit 99805d95 authored by Menner's avatar Menner Committed by Federico Mena Quintero
Browse files

bgo#476507 - Marker endpoints have the wrong angle

If a curveto has coincident control points at the start or end, then the angle of the marker
at that endpoint is not computed correctly.  This uses the next or previous control points
as appropriate to compute the correct angle.
parent 1ef73bd0
......@@ -276,10 +276,18 @@ rsvg_render_markers (RsvgDrawingCtx * ctx,
code == CAIRO_PATH_CLOSE_PATH) {
if (endmarker) {
if (code == CAIRO_PATH_CURVE_TO) {
rsvg_marker_render (endmarker, x, y,
atan2 (y - data[2].point.y,
x - data[2].point.x),
linewidth, ctx);
if (data[2].point.x == x && data[2].point.y == y) {
/* Can't calculate angle as points are coincident; use the previous point */
rsvg_marker_render (endmarker, x, y,
atan2 (y - data[1].point.y,
x - data[1].point.x),
linewidth, ctx);
} else {
rsvg_marker_render (endmarker, x, y,
atan2 (y - data[2].point.y,
x - data[2].point.x),
linewidth, ctx);
}
} else {
rsvg_marker_render (endmarker, x, y,
atan2 (y - lasty, x - lastx),
......@@ -290,11 +298,20 @@ rsvg_render_markers (RsvgDrawingCtx * ctx,
code == CAIRO_PATH_CLOSE_PATH) {
if (startmarker) {
if (nextcode == CAIRO_PATH_CURVE_TO) {
rsvg_marker_render (startmarker, x, y,
atan2 (nextdata[1].point.y - y,
nextdata[1].point.x - x),
linewidth,
ctx);
if (nextdata[1].point.x == x && nextdata[1].point.y == y) {
/* Can't calculate angle as points are coincident; use the next point */
rsvg_marker_render (startmarker, x, y,
atan2 (nextdata[2].point.y - y,
nextdata[2].point.x - x),
linewidth,
ctx);
} else {
rsvg_marker_render (startmarker, x, y,
atan2 (nextdata[1].point.y - y,
nextdata[1].point.x - x),
linewidth,
ctx);
}
} else {
rsvg_marker_render (startmarker, x, y,
atan2 (nextp.point.y - y, nextp.point.x - x),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment