summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cb814cb)
raw | patch | inline | side by side (parent: cb814cb)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 19 Aug 2007 13:18:04 +0000 (13:18 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Sun, 19 Aug 2007 13:18:04 +0000 (13:18 +0000) |
* sp_shape_update_effect is now called much less than before.
src/2geom/sbasis-to-bezier.cpp | patch | blob | history | |
src/sp-shape.cpp | patch | blob | history |
index e823b29cac16a411a630fefa80faf10f6fae4cd5..613c39288b817bf15f936389d4aecf3b5b8ad0a3 100644 (file)
//TODO: some of this logic should be lifted into svg-path
std::vector<Geom::Path>
path_from_piecewise(Geom::Piecewise<Geom::D2<Geom::SBasis> > const &B, double tol) {
-
+/*
Geom::PathBuilder pb;
if(B.size() == 0) return pb.peek();
Geom::Point start = B[0].at0();
@@ -205,11 +205,39 @@ path_from_piecewise(Geom::Piecewise<Geom::D2<Geom::SBasis> > const &B, double to
if(i+1 >= B.size()) break;
start = B[i+1].at0();
pb.moveTo(start);
+ i++;
}
build_from_sbasis(pb, B[i], tol);
}
pb.finish();
return pb.peek();
+*/
+ Geom::PathBuilder pb;
+ if(B.size() == 0) return pb.peek();
+ Geom::Point start = B[0].at0();
+ pb.moveTo(start);
+ for(unsigned i = 0; ; i++) {
+ if(i+1 == B.size() || !near(B[i+1].at0(), B[i].at1(), tol)) {
+ //start of a new path
+ if(near(start, B[i].at1())) {
+ //it's closed
+ pb.closePath();
+ if(sbasis_size(B[i]) <= 1) {
+ //last line seg already there
+ goto no_add;
+ }
+ }
+ build_from_sbasis(pb, B[i], tol);
+ no_add:
+ if(i+1 >= B.size()) break;
+ start = B[i+1].at0();
+ pb.moveTo(start);
+ } else {
+ build_from_sbasis(pb, B[i], tol);
+ }
+ }
+ pb.finish();
+ return pb.peek();
}
};
diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp
index 9d08fc58de4e838f443ced3d7c775daa9bee81b4..76fd37af1a132a3190f7ec206a3a43ef2571f3bc 100644 (file)
--- a/src/sp-shape.cpp
+++ b/src/sp-shape.cpp
sp_shape_set(SPObject *object, unsigned int key, gchar const *value)
{
SPShape *shape = (SPShape *) object;
- bool path_effect_changed = false;
switch (key) {
case SP_ATTR_INKSCAPE_PATH_EFFECT:
shape->path_effect_ref->detach();
}
} else {
+ // Detach, which emits the changed signal.
shape->path_effect_ref->detach();
}
}
- path_effect_changed = true; // updated twice now when connected to changed signal??
break;
default:
if (((SPObjectClass *) parent_class)->set) {
}
break;
}
-
- if (path_effect_changed)
- sp_shape_update_patheffect ((SPShape *) object, false);
}
static Inkscape::XML::Node *
void
sp_shape_update_patheffect (SPShape *shape, bool write)
{
+#ifdef SHAPE_VERBOSE
+ g_message("sp_shape_update_patheffect");
+#endif
g_return_if_fail (shape != NULL);
g_return_if_fail (SP_IS_SHAPE (shape));
if ( IS_LIVEPATHEFFECT(ref) && ref != shape )
{
ref->connectModified(sigc::bind(sigc::ptr_fun(&lpeobject_ref_modified), shape));
+ lpeobject_ref_modified(ref, 0, shape);
}
-
- lpeobject_ref_modified(ref, 0, shape);
}
/**