From: johanengelen Date: Fri, 2 Jan 2009 15:16:26 +0000 (+0000) Subject: fix bug in livarot where open paths are rendered as closed path when start == end... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c2cf12cf2e4970bac187974fcb36927ec693e728;p=inkscape.git fix bug in livarot where open paths are rendered as closed path when start == end point. now svg testsuite paths-data-10-t.svg is rendered correctly --- diff --git a/src/livarot/Path.h b/src/livarot/Path.h index b478449cd..102840d54 100644 --- a/src/livarot/Path.h +++ b/src/livarot/Path.h @@ -76,13 +76,14 @@ public: // t=0 means it's at the start of the command's chunk, t=1 it's at the end struct path_lineto { - path_lineto(bool m, Geom::Point pp) : isMoveTo(m), p(pp), piece(-1), t(0) {} - path_lineto(bool m, Geom::Point pp, int pie, double tt) : isMoveTo(m), p(pp), piece(pie), t(tt) {} + path_lineto(bool m, Geom::Point pp) : isMoveTo(m), p(pp), piece(-1), t(0), closed(false) {} + path_lineto(bool m, Geom::Point pp, int pie, double tt) : isMoveTo(m), p(pp), piece(pie), t(tt), closed(false) {} int isMoveTo; Geom::Point p; int piece; double t; + bool closed; // true if subpath is closed (this point is the last point of a closed subpath) }; std::vector pts; diff --git a/src/livarot/PathConversion.cpp b/src/livarot/PathConversion.cpp index 6ac6717af..29cacb657 100644 --- a/src/livarot/PathConversion.cpp +++ b/src/livarot/PathConversion.cpp @@ -75,7 +75,8 @@ void Path::ConvertWithBackData(double treshhold) case descr_close: { nextX = pts[lastMoveTo].p; - AddPoint(nextX, curP, 1.0, false); + int n = AddPoint(nextX, curP, 1.0, false); + if (n > 0) pts[n].closed = true; curP++; break; } @@ -251,6 +252,7 @@ void Path::Convert(double treshhold) descr_cmd[curP]->associated = descr_cmd[curP - 1]->associated; } } + pts[descr_cmd[curP]->associated].closed = true; curP++; break; } @@ -460,6 +462,7 @@ void Path::Convert(NRRectL *area, double treshhold) nextX = nData->p; lastMoveTo = AddPoint(nextX, true); descr_cmd[curP]->associated = lastMoveTo; + last_point_relation = POINT_RELATION_TO_AREA(nextX, area); start_elimination = false; @@ -477,6 +480,7 @@ void Path::Convert(NRRectL *area, double treshhold) descr_cmd[curP]->associated = descr_cmd[curP - 1]->associated; } } + pts[descr_cmd[curP]->associated].closed = true; last_point_relation = 0; curP++; break; @@ -752,7 +756,7 @@ void Path::ConvertEvenLines(double treshhold) descr_cmd[curP]->associated = descr_cmd[curP - 1]->associated; } } - + pts[descr_cmd[curP]->associated].closed = true; curP++; break; } diff --git a/src/livarot/PathStroke.cpp b/src/livarot/PathStroke.cpp index 5e952eff7..18cd05033 100644 --- a/src/livarot/PathStroke.cpp +++ b/src/livarot/PathStroke.cpp @@ -65,7 +65,7 @@ void Path::Stroke(Shape *dest, bool doClose, double width, JoinType join, if ( lastP > lastM+1 ) { Geom::Point sbStart = pts[lastM].p; Geom::Point sbEnd = pts[lastP - 1].p; - if ( Geom::LInfty(sbEnd-sbStart) < 0.00001 ) { // why close lines that shouldn't be closed? + if ( pts[lastP - 1].closed /*Geom::LInfty(sbEnd-sbStart) < 0.00001 */ ) { // why close lines that shouldn't be closed? // ah I see, because close is defined here for // a whole path and should be defined per subpath. // debut==fin => ferme (on devrait garder un element pour les close(), mais tant pis)