From c883d7627a479c8c5b6a9f77b9841fa5631572ad Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 27 Apr 2015 19:39:29 -0400 Subject: 2Geom sync - initial commit (bzr r14059.2.1) --- src/splivarot.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 46279cbce..95bd179f9 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -305,8 +305,7 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat delete originaux[0]; delete originaux[1]; - std::vector outres = Geom::parse_svg_path(res->svg_dump_path()); - + Geom::PathVector outres = Geom::parse_svg_path(res->svg_dump_path()); delete res; return outres; @@ -315,7 +314,7 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat /* Convert from a livarot path to a 2geom PathVector */ Geom::PathVector pathliv_to_pathvector(Path *pathliv){ - std::vector outres = Geom::parse_svg_path(pathliv->svg_dump_path()); + Geom::PathVector outres = Geom::parse_svg_path(pathliv->svg_dump_path()); return outres; } @@ -2273,15 +2272,11 @@ Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who) } // derived from Path_for_item -// there must be some other way to load dest directly from epathv, without going through pathv... Path * Path_for_pathvector(Geom::PathVector const &epathv) { - Geom::PathVector *pathv = new Geom::PathVector; - std::copy(epathv.begin(), epathv.end(), std::back_inserter(*pathv)); - Path *dest = new Path; - dest->LoadPathVector(*pathv); + dest->LoadPathVector(epathv); delete pathv; return dest; -- cgit v1.2.3 From cfa7054c950050095e596edd18fedad53e7ed636 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 28 Apr 2015 19:02:19 -0400 Subject: Fix calls to Geom::cross() - sign change. (bzr r14059.2.2) --- src/splivarot.cpp | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) (limited to 'src/splivarot.cpp') diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 95bd179f9..0c62cfe8a 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -47,6 +47,7 @@ #include "xml/repr.h" #include "xml/repr-sorting.h" #include <2geom/pathvector.h> +#include <2geom/svg-path-writer.h> #include "helper/geom.h" #include "livarot/Path.h" @@ -305,7 +306,9 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat delete originaux[0]; delete originaux[1]; - Geom::PathVector outres = Geom::parse_svg_path(res->svg_dump_path()); + gchar *result_str = res->svg_dump_path(); + Geom::PathVector outres = Geom::parse_svg_path(result_str); + g_free(result_str); delete res; return outres; @@ -447,8 +450,9 @@ sp_selected_path_boolop(Inkscape::Selection *selection, SPDesktop *desktop, bool // reverse if needed // note that the selection list keeps its order if ( reverseOrderForOp ) { - Path* swap=originaux[0];originaux[0]=originaux[1];originaux[1]=swap; - FillRule swai=origWind[0]; origWind[0]=origWind[1]; origWind[1]=swai; + using std::swap; + swap(originaux[0], originaux[1]); + swap(origWind[0], origWind[1]); } // and work @@ -2275,10 +2279,14 @@ Ancetre(Inkscape::XML::Node *a, Inkscape::XML::Node *who) Path * Path_for_pathvector(Geom::PathVector const &epathv) { + /*std::cout << "converting to Livarot path" << std::endl; + + Geom::SVGPathWriter wr; + wr.feed(epathv); + std::cout << wr.str() << std::endl;*/ + Path *dest = new Path; - dest->LoadPathVector(epathv); - delete pathv; - + dest->LoadPathVector(epathv); return dest; } @@ -2289,14 +2297,26 @@ Path_for_item(SPItem *item, bool doTransformation, bool transformFull) if (curve == NULL) return NULL; - + Geom::PathVector *pathv = pathvector_for_curve(item, curve, doTransformation, transformFull, Geom::identity(), Geom::identity()); curve->unref(); - + + /*std::cout << "converting to Livarot path" << std::endl; + + Geom::SVGPathWriter wr; + if (pathv) { + wr.feed(*pathv); + } + std::cout << wr.str() << std::endl;*/ + Path *dest = new Path; dest->LoadPathVector(*pathv); delete pathv; - + + /*gchar *str = dest->svg_dump_path(); + std::cout << "After conversion:\n" << str << std::endl; + g_free(str);*/ + return dest; } @@ -2343,7 +2363,7 @@ pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool t } else { *dest *= extraPreAffine * extraPostAffine; } - + return dest; } -- cgit v1.2.3