summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 79bf53d)
raw | patch | inline | side by side (parent: 79bf53d)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 4 Jul 2008 23:36:25 +0000 (23:36 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Fri, 4 Jul 2008 23:36:25 +0000 (23:36 +0000) |
src/object-snapper.cpp | patch | blob | history | |
src/splivarot.cpp | patch | blob | history | |
src/splivarot.h | patch | blob | history |
diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp
index 88e709b7fb4eb3591452544e3c3842ac3f2d5635..ef6c5fce26c55be8d1ad802037b488574670ace2 100644 (file)
--- a/src/object-snapper.cpp
+++ b/src/object-snapper.cpp
@@ -320,7 +320,7 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const &
if (!very_lenghty_prose && !very_complex_path) {
SPCurve *curve = curve_for_item(root_item);
if (curve) {
- NArtBpath *bpath = bpath_for_curve(root_item, curve, true, true);
+ NArtBpath *bpath = bpath_for_curve(root_item, curve, true, true); // perhaps for speed, get a reference to the Geom::pathvector, and store the transformation besides it. apply transformation on the snap points, instead of generating whole new path
_bpaths_to_snap_to->push_back(bpath); // we will get a dupe of the path, which must be freed at some point
curve->unref();
}
diff --git a/src/splivarot.cpp b/src/splivarot.cpp
index 944c15f842b11942e61e3f441cdd8e509732fb34..88daaa666f707df17de1ec9f810053789146e360 100644 (file)
--- a/src/splivarot.cpp
+++ b/src/splivarot.cpp
#include "libnr/nr-path.h"
#include "xml/repr.h"
#include "xml/repr-sorting.h"
-
+#include <2geom/pathvector.h>
#include <libnr/nr-matrix-fns.h>
#include <libnr/nr-matrix-ops.h>
#include <libnr/nr-matrix-translate-ops.h>
@@ -1764,6 +1764,27 @@ bpath_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transf
return new_bpath;
}
+/*
+ * NOTE: Returns empty pathvector if curve == NULL
+ * TODO: see if calling this method can be optimized. All the pathvector copying might be slow.
+ */
+Geom::PathVector
+pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull)
+{
+ if (curve == NULL)
+ return Geom::PathVector();
+
+ if (doTransformation) {
+ if (transformFull) {
+ return (curve->get_pathvector()) * sp_item_i2doc_affine(item);
+ } else {
+ return (curve->get_pathvector()) * to_2geom(item->transform);
+ }
+ } else {
+ return curve->get_pathvector();
+ }
+}
+
SPCurve* curve_for_item(SPItem *item)
{
if (!item)
diff --git a/src/splivarot.h b/src/splivarot.h
index 2ac47135a947434211fe5770b87d8a8dc5da0192..6e59d2cc501e3056d216b91970449f379c6d3e5b 100644 (file)
--- a/src/splivarot.h
+++ b/src/splivarot.h
*/
#include "livarot/Path.h"
+#include <2geom/forward.h>
// boolean operations
// work on the current selection
Path *Path_for_item(SPItem *item, bool doTransformation, bool transformFull = true);
NArtBpath *bpath_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull);
+Geom::PathVector pathvector_for_curve(SPItem *item, SPCurve *curve, bool doTransformation, bool transformFull);
SPCurve *curve_for_item(SPItem *item);
NR::Maybe<Path::cut_position> get_nearest_position_on_Path(Path *path, NR::Point p, unsigned seg = 0);
NR::Point get_point_on_Path(Path *path, int piece, double t);