From 124efe128854b7c9eb3a8197e06d1a2f8a673746 Mon Sep 17 00:00:00 2001 From: johanengelen Date: Mon, 28 Sep 2009 22:15:36 +0000 Subject: [PATCH] fix node counting for "moveto"-only paths. --- src/display/curve.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 5a1e2abeb..7d7dbc987 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -629,10 +629,14 @@ SPCurve::nodes_in_path() const nr++; // count last node (this works also for closed paths because although they don't have a 'last node', they do have an extra segment - if (it->closed()) { + // do not count closing knot double for zero-length closing line segments + // however, if the path is only a moveto, and is closed, do not subtract 1 (otherwise the result will be zero nodes) + if ( it->closed() + && ((*it).size() != 0) ) + { Geom::Curve const &c = it->back_closed(); if (are_near(c.initialPoint(), c.finalPoint())) { - nr--; // do not count closing knot double for zero-length closing line segments + nr--; } } } -- 2.30.2