diff options
| author | Jabiertxof <jtx@jtx> | 2017-05-28 06:10:29 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-05-28 06:10:29 +0000 |
| commit | 0e48d3acb1c3ae038cf4ecda45cf482bb3177a0a (patch) | |
| tree | ba73579e5d2e636262b85d50c2a0cc742821e543 /src | |
| parent | Force not original-d if the clip-path or mask has not a LPE allowed to change it (diff) | |
| download | inkscape-0e48d3acb1c3ae038cf4ecda45cf482bb3177a0a.tar.gz inkscape-0e48d3acb1c3ae038cf4ecda45cf482bb3177a0a.zip | |
Remove original-d from clip and mask LPE if keep paths
(bzr r15703.1.5)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-lpe-item.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index d1f1697a8..7dcbc4311 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -50,7 +50,7 @@ static void sp_lpe_item_enable_path_effects(SPLPEItem *lpeitem, bool enable); static void lpeobject_ref_modified(SPObject *href, guint flags, SPLPEItem *lpeitem); static void sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem); -static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem); +static void sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths); typedef std::list<std::string> HRefList; static std::string patheffectlist_svg_string(PathEffectList const & list); @@ -408,7 +408,7 @@ sp_lpe_item_create_original_path_recursive(SPLPEItem *lpeitem) } static void -sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) +sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem, bool keep_paths) { g_return_if_fail(lpeitem != NULL); if (SP_IS_GROUP(lpeitem)) { @@ -416,37 +416,39 @@ sp_lpe_item_cleanup_original_path_recursive(SPLPEItem *lpeitem) SPMask * mask = lpeitem->mask_ref->getObject(); if(mask) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); + 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())); + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clip_path->firstChild()), keep_paths); } } std::vector<SPItem*> item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); for ( std::vector<SPItem*>::const_iterator iter=item_list.begin();iter!=item_list.end();++iter) { SPObject *subitem = *iter; if (SP_IS_LPE_ITEM(subitem)) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(subitem)); + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(subitem), keep_paths); } } } else if (SP_IS_PATH(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())); + 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())); + 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->hasPathEffectOnClipOrMask() && repr->attribute("inkscape:original-d"))) + ((mask || clip_path) && !lpeitem->hasPathEffectOnClipOrMaskRecursive() && repr->attribute("inkscape:original-d"))) { - repr->setAttribute("d", repr->attribute("inkscape:original-d")); + if (!keep_paths) { + repr->setAttribute("d", repr->attribute("inkscape:original-d")); + } repr->setAttribute("inkscape:original-d", NULL); } else { sp_lpe_item_update_patheffect(lpeitem, true, true); @@ -503,14 +505,14 @@ void SPLPEItem::addPathEffect(std::string value, bool reset) // Apply the path effect sp_lpe_item_update_patheffect(this, true, true); SPMask * mask = mask_ref->getObject(); - if(mask && !hasPathEffectOnClipOrMask()) + if(mask && !hasPathEffectOnClipOrMaskRecursive()) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild())); + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(mask->firstChild()), false); } SPClipPath * clip_path = clip_ref->getObject(); - if(clip_path && !hasPathEffectOnClipOrMask()) + if(clip_path && !hasPathEffectOnClipOrMaskRecursive()) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clip_path->firstChild())); + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(clip_path->firstChild()), false); } //fix bug 1219324 if (SP_ACTIVE_DESKTOP ) { @@ -552,9 +554,8 @@ void SPLPEItem::removeCurrentPathEffect(bool keep_paths) if( SP_IS_GENERICELLIPSE(this)) { SP_GENERICELLIPSE(this)->write( this->getRepr()->document(), this->getRepr(), SP_OBJECT_WRITE_EXT ); } - - sp_lpe_item_cleanup_original_path_recursive(this); } + sp_lpe_item_cleanup_original_path_recursive(this, keep_paths); } /** @@ -584,9 +585,8 @@ void SPLPEItem::removeAllPathEffects(bool keep_paths) if (SP_IS_GENERICELLIPSE(this)) { SP_GENERICELLIPSE(this)->write(this->getRepr()->document(), this->getRepr(), SP_OBJECT_WRITE_EXT); } - - sp_lpe_item_cleanup_original_path_recursive(this); } + sp_lpe_item_cleanup_original_path_recursive(this, keep_paths); } void SPLPEItem::downCurrentPathEffect() @@ -607,7 +607,7 @@ void SPLPEItem::downCurrentPathEffect() this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); - sp_lpe_item_cleanup_original_path_recursive(this); + sp_lpe_item_cleanup_original_path_recursive(this, false); } void SPLPEItem::upCurrentPathEffect() @@ -626,7 +626,7 @@ void SPLPEItem::upCurrentPathEffect() this->getRepr()->setAttribute("inkscape:path-effect", patheffectlist_svg_string(new_list)); - sp_lpe_item_cleanup_original_path_recursive(this); + sp_lpe_item_cleanup_original_path_recursive(this, false); } /** used for shapes so they can see if they should also disable shape calculation and read from d= */ @@ -854,7 +854,7 @@ void SPLPEItem::remove_child(Inkscape::XML::Node * child) { SPObject *ochild = this->get_child_by_repr(child); if ( ochild && SP_IS_LPE_ITEM(ochild) ) { - sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(ochild)); + sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(ochild), false); } } |
