summaryrefslogtreecommitdiffstats
path: root/src/splivarot.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2015-07-04 16:15:46 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2015-07-04 16:15:46 +0000
commit1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8 (patch)
treea91517f9165322b4e42c6cdeb4263beaedc4d02f /src/splivarot.cpp
parentPackaging. New Win32 installer Danish translation. (diff)
parentUpgrade to 2Geom r2413 (diff)
downloadinkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.tar.gz
inkscape-1112ab0a12fc0cb5a6b00d1bbd5b100c55eedff8.zip
Sync 2Geom to revision 2413.
May introduce regressions. (bzr r14226)
Diffstat (limited to 'src/splivarot.cpp')
-rw-r--r--src/splivarot.cpp47
1 files changed, 31 insertions, 16 deletions
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index bec300936..726df6e20 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,8 +306,9 @@ sp_pathvector_boolop(Geom::PathVector const &pathva, Geom::PathVector const &pat
delete originaux[0];
delete originaux[1];
- std::vector<Geom::Path> 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;
@@ -315,7 +317,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<Geom::Path> outres = Geom::parse_svg_path(pathliv->svg_dump_path());
+ Geom::PathVector outres = Geom::parse_svg_path(pathliv->svg_dump_path());
return outres;
}
@@ -445,8 +447,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
@@ -2260,17 +2263,17 @@ 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));
-
+ /*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(*pathv);
- delete pathv;
-
+ dest->LoadPathVector(epathv);
return dest;
}
@@ -2281,14 +2284,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;
}
@@ -2335,7 +2350,7 @@ pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool t
} else {
*dest *= extraPreAffine * extraPostAffine;
}
-
+
return dest;
}