From 62820017a6d7b284d9495cb1951bc1a3b83a92d5 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Sun, 28 May 2006 14:38:37 +0000 Subject: [PATCH] break apart faster: prepend to list instead of append, add objects to selection wholesale instead of one by one --- src/display/curve.cpp | 7 +------ src/draw-context.cpp | 2 +- src/path-chemistry.cpp | 8 ++++++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/display/curve.cpp b/src/display/curve.cpp index 3e491a2b8..bbbba09f0 100644 --- a/src/display/curve.cpp +++ b/src/display/curve.cpp @@ -254,12 +254,7 @@ sp_curve_split(SPCurve const *curve) new_curve->substart = 0; new_curve->closed = (new_curve->_bpath->code == NR_MOVETO); new_curve->hascpt = (new_curve->_bpath->code == NR_MOVETO_OPEN); - l = g_slist_append(l, new_curve); - /** \todo - * effic: Use g_slist_prepend instead. Either work backwards from - * the end of curve, or work forwards as at present but do - * g_slist_reverse before returning. - */ + l = g_slist_prepend(l, new_curve); p += i; } diff --git a/src/draw-context.cpp b/src/draw-context.cpp index 6263880a4..6bea0851b 100644 --- a/src/draw-context.cpp +++ b/src/draw-context.cpp @@ -301,7 +301,7 @@ spdc_attach_selection(SPDrawContext *dc, Inkscape::Selection *sel) SPCurve *norm = sp_shape_get_curve(SP_SHAPE(item)); sp_curve_transform(norm, sp_item_i2d_affine(dc->white_item)); g_return_if_fail( norm != NULL ); - dc->white_curves = sp_curve_split(norm); + dc->white_curves = g_slist_reverse(sp_curve_split(norm)); sp_curve_unref(norm); /* Anchor list */ for (GSList *l = dc->white_curves; l != NULL; l = l->next) { diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index 1cd7480aa..c11754ece 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -192,7 +192,8 @@ sp_selected_path_break_apart(void) sp_curve_unref(curve); - for (GSList *l = g_slist_reverse(list); l != NULL; l = l->next) { + GSList *reprs = NULL; + for (GSList *l = list; l != NULL; l = l->next) { curve = (SPCurve *) l->data; Inkscape::XML::Node *repr = sp_repr_new("svg:path"); @@ -212,11 +213,14 @@ sp_selected_path_break_apart(void) if (l == list) repr->setAttribute("id", id); - selection->add(repr); + reprs = g_slist_prepend (reprs, repr); Inkscape::GC::release(repr); } + selection->setReprList(reprs); + + g_slist_free(reprs); g_slist_free(list); g_free(style); -- 2.30.2