From a2c91998644ae5a8096b0ee53beea16bee0a7ac7 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Sat, 8 Aug 2015 18:08:49 -0400 Subject: for spiro converters, close path only after last segment. (Bug 1473641) Fixed bugs: - https://launchpad.net/bugs/1473641 (bzr r14285) --- src/live_effects/spiro-converters.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'src/live_effects/spiro-converters.cpp') diff --git a/src/live_effects/spiro-converters.cpp b/src/live_effects/spiro-converters.cpp index f116d5256..ee214704c 100644 --- a/src/live_effects/spiro-converters.cpp +++ b/src/live_effects/spiro-converters.cpp @@ -21,43 +21,49 @@ namespace Spiro { void -ConverterSPCurve::moveto(double x, double y, bool is_open) +ConverterSPCurve::moveto(double x, double y) { if ( IS_FINITE(x) && IS_FINITE(y) ) { _curve.moveto(x, y); - if (!is_open) { - _curve.closepath(); - } } else { SPIRO_G_MESSAGE("Spiro: moveto not finite"); } } void -ConverterSPCurve::lineto(double x, double y) +ConverterSPCurve::lineto(double x, double y, bool close_last) { if ( IS_FINITE(x) && IS_FINITE(y) ) { _curve.lineto(x, y); + if (close_last) { + _curve.closepath(); + } } else { SPIRO_G_MESSAGE("Spiro: lineto not finite"); } } void -ConverterSPCurve::quadto(double xm, double ym, double x3, double y3) +ConverterSPCurve::quadto(double xm, double ym, double x3, double y3, bool close_last) { if ( IS_FINITE(xm) && IS_FINITE(ym) && IS_FINITE(x3) && IS_FINITE(y3) ) { _curve.quadto(xm, ym, x3, y3); + if (close_last) { + _curve.closepath(); + } } else { SPIRO_G_MESSAGE("Spiro: quadto not finite"); } } void -ConverterSPCurve::curveto(double x1, double y1, double x2, double y2, double x3, double y3) +ConverterSPCurve::curveto(double x1, double y1, double x2, double y2, double x3, double y3, bool close_last) { if ( IS_FINITE(x1) && IS_FINITE(y1) && IS_FINITE(x2) && IS_FINITE(y2) ) { _curve.curveto(x1, y1, x2, y2, x3, y3); + if (close_last) { + _curve.closepath(); + } } else { SPIRO_G_MESSAGE("Spiro: curveto not finite"); } @@ -71,41 +77,43 @@ ConverterPath::ConverterPath(Geom::Path &path) } void -ConverterPath::moveto(double x, double y, bool is_open) +ConverterPath::moveto(double x, double y) { if ( IS_FINITE(x) && IS_FINITE(y) ) { _path.start(Geom::Point(x, y)); - _path.close(!is_open); } else { SPIRO_G_MESSAGE("spiro moveto not finite"); } } void -ConverterPath::lineto(double x, double y) +ConverterPath::lineto(double x, double y, bool close_last) { if ( IS_FINITE(x) && IS_FINITE(y) ) { _path.appendNew( Geom::Point(x, y) ); + _path.close(close_last); } else { SPIRO_G_MESSAGE("spiro lineto not finite"); } } void -ConverterPath::quadto(double xm, double ym, double x3, double y3) +ConverterPath::quadto(double xm, double ym, double x3, double y3, bool close_last) { if ( IS_FINITE(xm) && IS_FINITE(ym) && IS_FINITE(x3) && IS_FINITE(y3) ) { _path.appendNew(Geom::Point(xm, ym), Geom::Point(x3, y3)); + _path.close(close_last); } else { SPIRO_G_MESSAGE("spiro quadto not finite"); } } void -ConverterPath::curveto(double x1, double y1, double x2, double y2, double x3, double y3) +ConverterPath::curveto(double x1, double y1, double x2, double y2, double x3, double y3, bool close_last) { if ( IS_FINITE(x1) && IS_FINITE(y1) && IS_FINITE(x2) && IS_FINITE(y2) ) { _path.appendNew(Geom::Point(x1, y1), Geom::Point(x2, y2), Geom::Point(x3, y3)); + _path.close(close_last); } else { SPIRO_G_MESSAGE("spiro curveto not finite"); } -- cgit v1.2.3