Code

break apart faster: prepend to list instead of append, add objects to selection whole...
authorbuliabyak <buliabyak@users.sourceforge.net>
Sun, 28 May 2006 14:38:37 +0000 (14:38 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sun, 28 May 2006 14:38:37 +0000 (14:38 +0000)
src/display/curve.cpp
src/draw-context.cpp
src/path-chemistry.cpp

index 3e491a2b8a67114ee040b66e2e1bdfd5af44a242..bbbba09f0da72ceed33dfc917f882976a642cf94 100644 (file)
@@ -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;
     }
 
index 6263880a4ded0f79151a13b94dc0a826e48c8bac..6bea0851b8d465ae9aad488edc4aae69d9aebef4 100644 (file)
@@ -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) {
index 1cd7480aa6692a5fd459f3997cec650d9a69a0eb..c11754ecee4ce4316db5a543fa3c0c145f8e867d 100644 (file)
@@ -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);