X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fmodules%2Fswfdraw.c;h=ae04aeee57e8edafe32597c73c3e1cb0ea110444;hb=879d0eec420fe0fd5ddcd56c8fe62b82a6744edd;hp=40aa255a786bd76efa19aab900b886899cf49c8e;hpb=adae61aed9ea2f282d05ccf2c5d25f20c4c95f94;p=swftools.git diff --git a/lib/modules/swfdraw.c b/lib/modules/swfdraw.c index 40aa255..ae04aee 100644 --- a/lib/modules/swfdraw.c +++ b/lib/modules/swfdraw.c @@ -1,5 +1,7 @@ // swfdraw.c +#include "../rfxswf.h" + typedef struct _SWFSHAPEDRAWER { SHAPE*shape; @@ -23,7 +25,7 @@ static void swf_ShapeDrawerClear(drawer_t*draw); static void swf_ShapeDrawerInit(drawer_t*draw, TAG*tag, int fillstylebits, int linestylebits) { - SWFSHAPEDRAWER*sdraw = rfx_calloc(sizeof(SWFSHAPEDRAWER)); + SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)rfx_calloc(sizeof(SWFSHAPEDRAWER)); draw->internal = sdraw; draw->setLineStyle = swf_ShapeDrawerSetLineStyle; @@ -95,8 +97,8 @@ static void fixEndPoint(drawer_t*draw) static void swf_ShapeDrawerMoveTo(drawer_t*draw, FPOINT * to) { SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)draw->internal; - int x = to->x*20+0.001; - int y = to->y*20+0.001; + int x = floor(to->x*20); + int y = floor(to->y*20); /* we need to write moveto always- it might be that it signals the end of a polygon, otherwise @@ -117,8 +119,8 @@ static void swf_ShapeDrawerMoveTo(drawer_t*draw, FPOINT * to) static void swf_ShapeDrawerLineTo(drawer_t*draw, FPOINT * to) { SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)draw->internal; - int x = to->x*20+0.001; - int y = to->y*20+0.001; + int x = floor(to->x*20); + int y = floor(to->y*20); if(sdraw->lastx < sdraw->bbox.xmin) sdraw->bbox.xmin = sdraw->lastx; if(sdraw->lasty < sdraw->bbox.ymin) sdraw->bbox.ymin = sdraw->lasty; if(sdraw->lastx > sdraw->bbox.xmax) sdraw->bbox.xmax = sdraw->lastx; @@ -135,10 +137,10 @@ static void swf_ShapeDrawerLineTo(drawer_t*draw, FPOINT * to) static void swf_ShapeDrawerSplineTo(drawer_t*draw, FPOINT * c1, FPOINT* to) { SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)draw->internal; - int tx = c1->x*20+0.001; - int ty = c1->y*20+0.001; - int x = to->x*20+0.001; - int y = to->y*20+0.001; + int tx = floor(c1->x*20); + int ty = floor(c1->y*20); + int x = floor(to->x*20); + int y = floor(to->y*20); if(sdraw->lastx < sdraw->bbox.xmin) sdraw->bbox.xmin = sdraw->lastx; if(sdraw->lasty < sdraw->bbox.ymin) sdraw->bbox.ymin = sdraw->lasty; if(sdraw->lastx > sdraw->bbox.xmax) sdraw->bbox.xmax = sdraw->lastx; @@ -177,7 +179,7 @@ static void swf_ShapeDrawerClear(drawer_t*draw) { SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)draw->internal; if(sdraw->tagfree) { - swf_DeleteTag(sdraw->tag); + swf_DeleteTag(0, sdraw->tag); sdraw->tag = 0; } swf_ShapeFree(sdraw->shape); @@ -196,7 +198,7 @@ SRECT swf_ShapeDrawerGetBBox(drawer_t*draw) SHAPE* swf_ShapeDrawerToShape(drawer_t*draw) { SWFSHAPEDRAWER*sdraw = (SWFSHAPEDRAWER*)draw->internal; - SHAPE* shape = rfx_alloc(sizeof(SHAPE)); + SHAPE* shape = (SHAPE*)rfx_alloc(sizeof(SHAPE)); if(!sdraw->isfinished) { fprintf(stderr, "Warning: you should Finish() your drawer before calling DrawerToShape"); swf_ShapeDrawerFinish(draw);