fix breakage to ellipses with multiple peripheries
authorellson <devnull@localhost>
Mon, 5 Nov 2007 20:02:18 +0000 (20:02 +0000)
committerellson <devnull@localhost>
Mon, 5 Nov 2007 20:02:18 +0000 (20:02 +0000)
lib/common/shapes.c

index 8372488c7b9e6884b7e0c69e38792b787cc10878..728a3182cf6f124dfaed8bb48b5636e1a3c3b064 100644 (file)
@@ -806,14 +806,19 @@ static void poly_init(node_t * n)
        vertices = N_NEW(outp * sides, pointf);
        P.x = bb.x / 2.;
        P.y = bb.y / 2.;
-       vertices[1] = P;
        vertices[0].x = -P.x;
        vertices[0].y = -P.y;
+       vertices[1] = P;
        if (peripheries > 1) {
-           for (j = 1; j < peripheries; j++) {
-               P.x += GAP;
-               P.y += GAP;
-               vertices[j] = P;
+           for (j = 1, i = 2; j < peripheries; j++) {
+               P.x += GAP;
+               P.y += GAP;
+                vertices[i].x = -P.x;
+                vertices[i].y = -P.y;
+               i++;
+                vertices[i].x = P.x;
+                vertices[i].y = P.y;
+               i++;
            }
            bb.x = 2. * P.x;
            bb.y = 2. * P.y;