Commit bc893cd
Last to first in SVG paths
Changed files (3)
Diff
@@ -48,6 +48,20 @@ public class Doubles : GLib.Object { data[index].value = p; }++ public void set_type (int index, uchar t) {+ if (unlikely (index < 0)) {+ warning ("index < 0");+ return;+ }++ if (unlikely (index >= size)) {+ warning ("index >= size");+ return;+ }+ + data[index].type = t;+ } public void insert (int position, double p) { if (capacity < size + 1) {@@ -18,13 +18,18 @@ namespace SvgBird { public class Points : GLib.Object { public Doubles point_data = new Doubles.for_capacity (100);- public bool closed = false;+ public bool closed;+ public int size { get { return point_data.size; } } + public void set_type (int index, uchar p) {+ point_data.set_type (index, p);+ }+ public void set_double (int index, double p) { point_data.set_double (index, p); }@@ -798,12 +798,17 @@ public class SvgFile : GLib.Object { // all instructions are padded + double first_x = 0;+ double first_y = 0; for (int i = 0; i < points_size; i++) { // FIXME: add more types if (bezier_points[i].type == 'M') {+ first_x = bezier_points[i].x0;+ first_y = bezier_points[i].y0;+ points.add_type (POINT_LINE);- points.add (bezier_points[i].x0);- points.add (bezier_points[i].y0);+ points.add (first_x);+ points.add (first_y); points.add (0); points.add (0); points.add (0);@@ -850,6 +855,16 @@ public class SvgFile : GLib.Object { points.add (rotation); } else if (bezier_points[i].type == 'z') { points.closed = true;+ + points.add_type (POINT_LINE);+ points.add (first_x);+ points.add (first_y);+ points.add (0);+ points.add (0);+ points.add (0);+ points.add (0);+ points.add (0);+ path_data.add (points); points = new Points (); } else {