Commit f7daf70
Fix a point creation bug
Changed files (2)
Diff
@@ -50,23 +50,27 @@ public class TestRunner : NativeWindow, GLib.Object { static void speed_test () { Test test_object = new Test.time ("GObject"); - for (uint i = 0; i < 3000 * 300; i++) {- GLib.Object o = new GLib.Object ();+ for (uint i = 0; i < 3000; i++) {+ for (uint j = 0; j < 300; j++) {+ GLib.Object o = new GLib.Object ();+ } } test_object.print (); Test test_ref = new Test.time ("GObject ref"); - for (uint i = 0; i < 3000 * 300; i++) {- GLib.Object o = new GLib.Object ();- - for (int j = 0; j < 7; j++) {- o.ref ();- }- - for (int j = 0; j < 7; j++) {- o.unref ();+ for (uint i = 0; i < 3000; i++) {+ for (uint k = 0; k < 300; k++) {+ GLib.Object o = new GLib.Object ();+ + for (int j = 0; j < 7; j++) {+ o.ref ();+ }+ + for (int j = 0; j < 7; j++) {+ o.unref ();+ } } } @@ -74,16 +78,20 @@ public class TestRunner : NativeWindow, GLib.Object { Test test_edit_point = new Test.time ("EditPoint creation"); - for (uint i = 0; i < 3000 * 300; i++) {- EditPoint ep = new EditPoint ();+ for (uint i = 0; i < 3000; i++) {+ for (uint j = 0; j < 300; j++) {+ EditPoint ep = new EditPoint ();+ } } test_edit_point.print (); Test test_path = new Test.time ("Simple path creation"); - for (uint i = 0; i < 3000 * 300; i++) {- Path p = new Path ();+ for (uint i = 0; i < 3000; i++) {+ for (uint j = 0; j < 3000; j++) {+ Path p = new Path ();+ } } test_path.print ();@@ -964,19 +964,17 @@ public class Path : GLib.Object { } public EditPoint add_point (EditPoint p) {- int prev_index; EditPoint previous_point; if (points.size == 0) { points.add (p);- p.prev = points.get (0).get_link_item ();- p.next = points.get (0).get_link_item ();+ p.prev = p; + p.next = p; } else { previous_point = points.get (points.size - 1); points.add (p);- p.prev = (!) previous_point;- p.next = null;- points.add (p); + p.prev = previous_point;+ p.next = previous_point.next; } last_point = p;