diff options
| author | bulia byak <buliabyak@gmail.com> | 2009-08-13 20:18:16 +0000 |
|---|---|---|
| committer | buliabyak <buliabyak@users.sourceforge.net> | 2009-08-13 20:18:16 +0000 |
| commit | e5ccc7af7d7a3b93a1121c3ef8d75151f559a7b7 (patch) | |
| tree | ed89a63e1cea25f0ae3fd50813f17db2b7cec4f3 /src | |
| parent | Adding a copper and chocolate and a Relief print bumps and an Inner glow, fix... (diff) | |
| download | inkscape-e5ccc7af7d7a3b93a1121c3ef8d75151f559a7b7.tar.gz inkscape-e5ccc7af7d7a3b93a1121c3ef8d75151f559a7b7.zip | |
fix 304018
(bzr r8481)
Diffstat (limited to 'src')
| -rw-r--r-- | src/nodepath.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/nodepath.cpp b/src/nodepath.cpp index 74d0758a7..5b2a738d3 100644 --- a/src/nodepath.cpp +++ b/src/nodepath.cpp @@ -201,6 +201,19 @@ sp_nodepath_create_helperpaths(Inkscape::NodePath::Path *np) { } } +static void +sp_nodepath_destroy_helperpaths(Inkscape::NodePath::Path *np) { + for (HelperPathList::iterator i = np->helper_path_vec.begin(); i != np->helper_path_vec.end(); ++i) { + for (std::vector<SPCanvasItem *>::iterator j = (*i).second.begin(); j != (*i).second.end(); ++j) { + GtkObject *temp = *j; + *j = NULL; + gtk_object_destroy(temp); + } + } + np->helper_path_vec.clear(); +} + +/** updates canvas items from the effect's helper paths */ void sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { //std::map<Inkscape::LivePathEffect::Effect *, std::vector<SPCanvasItem *> > helper_path_vec; @@ -211,13 +224,15 @@ sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { SPLPEItem *lpeitem = SP_LPE_ITEM(np->item); PathEffectList lpelist = sp_lpe_item_get_effect_list(lpeitem); + + /* The number or type or LPEs may have changed, so we need to clear and recreate our + * helper_path_vec to make sure it is in sync */ + sp_nodepath_destroy_helperpaths(np); + sp_nodepath_create_helperpaths(np); + for (PathEffectList::iterator i = lpelist.begin(); i != lpelist.end(); ++i) { Inkscape::LivePathEffect::Effect *lpe = (*i)->lpeobject->get_lpe(); if (lpe) { - /* update canvas items from the effect's helper paths; note that this code relies on the - * fact that getHelperPaths() will always return the same number of helperpaths in the same - * order as during their creation in sp_nodepath_create_helperpaths - */ std::vector<Geom::PathVector> hpaths = lpe->getHelperPaths(lpeitem); for (unsigned int j = 0; j < hpaths.size(); ++j) { SPCurve *curve = new SPCurve(hpaths[j]); @@ -229,19 +244,6 @@ sp_nodepath_update_helperpaths(Inkscape::NodePath::Path *np) { } } -static void -sp_nodepath_destroy_helperpaths(Inkscape::NodePath::Path *np) { - for (HelperPathList::iterator i = np->helper_path_vec.begin(); i != np->helper_path_vec.end(); ++i) { - for (std::vector<SPCanvasItem *>::iterator j = (*i).second.begin(); j != (*i).second.end(); ++j) { - GtkObject *temp = *j; - *j = NULL; - gtk_object_destroy(temp); - } - } - np->helper_path_vec.clear(); -} - - /** * \brief Creates new nodepath from item * |
