added name
[swftools.git] / lib / devices / opengl.c
index aee8be8..51a1564 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <math.h>
 
 #include "../gfxdevice.h"
 #include "../gfxtools.h"
@@ -177,7 +178,7 @@ void opengl_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color)
     len = 0;
     while(l) {
        if(l->type == gfx_splineTo) {
-            double c = sqrt(abs(l->x-2*l->sx+lastx) + abs(l->x-2*l->sy+lasty))/2;
+            double c = sqrt(abs(l->x-2*l->sx+lastx) + abs(l->y-2*l->sy+lasty))/2;
            int steps = (int)c;
            if(steps<1) steps = 1;
            len += steps;
@@ -205,7 +206,7 @@ void opengl_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color)
 
        if(l->type == gfx_splineTo) {
            int j;
-            double c = sqrt(abs(l->x-2*l->sx+lastx) + abs(l->x-2*l->sy+lasty))/2;
+            double c = sqrt(abs(l->x-2*l->sx+lastx) + abs(l->y-2*l->sy+lasty))/2;
            int steps = (int)c;
            if(steps<1) steps = 1;
            //printf("c=%f d1=%f (%f/%f) d2=%f (%f/%f)\n", c,d1,l->x-l->sx,l->y-l->sy,d2,lastx-l->sx,lasty-l->sy);
@@ -448,6 +449,8 @@ void gfxdevice_opengl_init(gfxdevice_t*dev)
     dbg("init");
     internal_t*i = (internal_t*)rfx_calloc(sizeof(internal_t));
     memset(dev, 0, sizeof(gfxdevice_t));
+    
+    dev->name = "opengl";
 
     dev->internal = i;