From 47d7675c0ec6a65e27e9ff69a8bfd34b621effab Mon Sep 17 00:00:00 2001 From: Marc Jeanmougin Date: Sat, 21 Feb 2015 17:23:30 +0100 Subject: Fix for the performance loss in ungrouping observed by Tavmjong in rev 13933 Added std::list hrefList member to SPObject class. (bzr r13935) --- src/sp-item-group.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/sp-item-group.cpp') diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 3c2053cb2..0f76051bc 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -399,10 +399,10 @@ void SPGroup::snappoints(std::vector &p, Inkscape: } } -void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Affine const g) +void sp_item_group_ungroup_handle_clones(SPItem *parent, Geom::Affine const g) { - for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { - SPItem *citem = dynamic_cast(child); + for(std::list::const_iterator refd=parent->hrefList.begin();refd!=parent->hrefList.end();refd++){ + SPItem *citem = dynamic_cast(*refd); if (citem) { SPUse *useitem = dynamic_cast(citem); if (useitem && useitem->get_original() == parent) { @@ -412,10 +412,6 @@ void sp_item_group_ungroup_handle_clones(SPGroup *group,SPItem *parent, Geom::Af citem->setAttribute("transform", affinestr); g_free(affinestr); } - SPGroup *groupitem = dynamic_cast(citem); - if (groupitem) { - sp_item_group_ungroup_handle_clones(groupitem,parent,g); - } } } } @@ -459,7 +455,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) if (SPItem *citem = dynamic_cast(child)) - sp_item_group_ungroup_handle_clones(root,citem,g); + sp_item_group_ungroup_handle_clones(citem,g); for (SPObject *child = group->firstChild() ; child; child = child->getNext() ) { -- cgit v1.2.3