diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-item-group.cpp | 30 | ||||
| -rw-r--r-- | src/sp-lpe-item.cpp | 22 |
2 files changed, 47 insertions, 5 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 88b2bb1f9..c81375f05 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -32,6 +32,7 @@ #include "attributes.h" #include "sp-item-transform.h" #include "sp-root.h" +#include "sp-rect.h" #include "sp-offset.h" #include "sp-clippath.h" #include "sp-mask.h" @@ -953,11 +954,28 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write) SPShape *subShape = dynamic_cast<SPShape *>(subitem); if (subShape) { SPCurve * c = NULL; - - SPPath *subPath = dynamic_cast<SPPath *>(subShape); - if (subPath) { - c = subPath->get_original_curve(); - } else { + // If item is a SPRect, convert it to path first: + if ( dynamic_cast<SPRect *>(subShape) ) { + SPDesktop *desktop = SP_ACTIVE_DESKTOP; + if (desktop) { + Inkscape::Selection *sel = desktop->getSelection(); + if ( sel && !sel->isEmpty() ) { + sel->clear(); + sel->add(SP_ITEM(subShape)); + sel->toCurves(); + subitem = sel->singleItem(); + subShape = dynamic_cast<SPShape *>(subitem); + if (!subShape) { + continue; + } + sel->clear(); + sel->add(SP_ITEM(topgroup)); + } + } + } + //SPPath *subPath = dynamic_cast<SPPath *>(subShape); + c = subShape->getCurveBeforeLPE(); + if (!c || (subShape->getCurve() != c)) { c = subShape->getCurve(); } bool success = false; @@ -968,7 +986,9 @@ sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write) c->transform(i2anc_affine(subitem, topgroup).inverse()); Inkscape::XML::Node *repr = subitem->getRepr(); if (c && success) { + subShape->setCurveInsync( subShape->getCurveBeforeLPE(), TRUE); subShape->setCurve(c, TRUE); + subShape->setCurveInsync( c, TRUE); if (write) { gchar *str = sp_svg_write_path(c->get_pathvector()); repr->setAttribute("d", str); diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index edd572b8b..6e30419ef 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -439,6 +439,28 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths) } else { sp_lpe_item_update_patheffect(lpeitem, true, true); } + } else if (SP_IS_SHAPE(lpeitem)) { + Inkscape::XML::Node *repr = lpeitem->getRepr(); + SPMask * mask = lpeitem->mask_ref->getObject(); + if(mask) { + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild()), keep_paths); + } + SPClipPath * clip_path = lpeitem->clip_ref->getObject(); + if(clip_path) { + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clip_path->firstChild()), keep_paths); + } + mask = dynamic_cast<SPMask *>(lpeitem->parent); + clip_path = dynamic_cast<SPClipPath *>(lpeitem->parent); + if ((!lpeitem->hasPathEffectRecursive() && repr->attribute("inkscape:original-d")) || + ((mask || clip_path) && !lpeitem->hasPathEffectOnClipOrMaskRecursive() && repr->attribute("inkscape:original-d"))) + { + if (!keep_paths) { + repr->setAttribute("d", NULL); + } + } else { + sp_lpe_item_update_patheffect(lpeitem, true, true); + } + } } |
