summaryrefslogtreecommitdiffstats
path: root/src/sp-item-group.cpp
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-01 14:02:26 +0000
committerJabiertxof <jtx@jtx>2017-01-01 14:02:26 +0000
commit57132e1d5f4729e2ea1abc2ef835f3962f6680b4 (patch)
tree369c9d944697c466c99a549b9456a805e0d47d76 /src/sp-item-group.cpp
parentUpdate to trunk (diff)
parentUpdate to trunk (diff)
downloadinkscape-57132e1d5f4729e2ea1abc2ef835f3962f6680b4.tar.gz
inkscape-57132e1d5f4729e2ea1abc2ef835f3962f6680b4.zip
merge mirror improvements
(bzr r15295.1.41)
Diffstat (limited to 'src/sp-item-group.cpp')
-rw-r--r--src/sp-item-group.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 7b2507b5e..808d475c7 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -950,25 +950,36 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write)
} else {
c = subShape->getCurve();
}
-
+ bool success = false;
// only run LPEs when the shape has a curve defined
if (c) {
c->transform(i2anc_affine(subitem, topgroup));
- topgroup->performPathEffect(c);
+ success = topgroup->performPathEffect(c, subShape);
c->transform(i2anc_affine(subitem, topgroup).inverse());
- subShape->setCurve(c, TRUE);
-
- if (write) {
+ if (c && success) {
+ subShape->setCurve(c, TRUE);
+ if (write) {
+ Inkscape::XML::Node *repr = subitem->getRepr();
+ gchar *str = sp_svg_write_path(c->get_pathvector());
+ repr->setAttribute("d", str);
+ #ifdef GROUP_VERBOSE
+ g_message("sp_group_perform_patheffect writes 'd' attribute");
+ #endif
+ g_free(str);
+ }
+ c->unref();
+ } else {
+ // LPE was unsuccesfull or doeffect stack return null. Read the old 'd'-attribute.
Inkscape::XML::Node *repr = subitem->getRepr();
- gchar *str = sp_svg_write_path(c->get_pathvector());
- repr->setAttribute("d", str);
-#ifdef GROUP_VERBOSE
- g_message("sp_group_perform_patheffect writes 'd' attribute");
-#endif
- g_free(str);
+ if (gchar const * value = repr->attribute("d")) {
+ Geom::PathVector pv = sp_svg_read_pathv(value);
+ SPCurve *oldcurve = new (std::nothrow) SPCurve(pv);
+ if (oldcurve) {
+ subShape->setCurve(oldcurve, TRUE);
+ oldcurve->unref();
+ }
+ }
}
-
- c->unref();
}
}
}