bugfixes
[swftools.git] / lib / devices / render.c
index 1865e88..69cfae6 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <math.h>
 #include <memory.h>
 #include "../gfxdevice.h"
 #include "../gfxtools.h"
@@ -648,6 +649,7 @@ void render_addfont(struct _gfxdevice*dev, char*fontid, gfxfont_t*font)
     }
     l = (fontlist_t*)rfx_calloc(sizeof(fontlist_t));
     l->font = font;
+    l->id = strdup(fontid);
     l->next = 0;
     if(last) {
        last->next = l;
@@ -667,7 +669,7 @@ void render_drawchar(struct _gfxdevice*dev, char*fontid, int glyphnr, gfxcolor_t
        i->font = 0;
        i->fontid = 0;
        while(l) {
-           if(!strcmp((char*)l->id, i->fontid)) {
+           if(!strcmp((char*)l->id, fontid)) {
                i->font = l->font;
                i->fontid = l->id;
                break;
@@ -707,6 +709,7 @@ int  render_result_save(gfxresult_t*r, char*filename)
     } else {
        writePNG(filename, (unsigned char*)i->img, i->width, i->height);
     }
+    return 1;
 }
 void*render_result_get(gfxresult_t*r, char*name)
 {
@@ -733,6 +736,9 @@ gfxresult_t* render_finish(struct _gfxdevice*dev)
     res->destroy = render_result_destroy;
 
     free(dev->internal); dev->internal = 0; i = 0;
+
+    /* TODO: free fonts */
+
     return res;
 }