summaryrefslogtreecommitdiffstats
path: root/src/sp-item-group.cpp
diff options
context:
space:
mode:
authorJabiertxof <jtx@jtx>2017-01-24 00:02:46 +0000
committerJabiertxof <jtx@jtx>2017-01-24 00:02:46 +0000
commite06fb0c25cc352df40b77a1988b5045426e7ef2d (patch)
treedd40be94ed5d56afdce3f4535a559d8d4741dd05 /src/sp-item-group.cpp
parentAdd fixes sugested by Martin Owens (diff)
downloadinkscape-e06fb0c25cc352df40b77a1988b5045426e7ef2d.tar.gz
inkscape-e06fb0c25cc352df40b77a1988b5045426e7ef2d.zip
Fixing to merge
(bzr r15392.1.8)
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 b9a8fb83f..70787708e 100644
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
@@ -959,25 +959,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) {
- 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 (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.
+ 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();
}
}
}