X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fdevices%2Frender.c;h=250356a271cabbf8f6a266dad21cfe578aa81544;hp=cdba4421ec4d7ff151de07ca953014f62026b5e5;hb=e321a0df2c56ff61602b13c1440465911b231f89;hpb=c4d1967a7fdeb51f311012e56bc0567e842a97e0 diff --git a/lib/devices/render.c b/lib/devices/render.c index cdba442..250356a 100644 --- a/lib/devices/render.c +++ b/lib/devices/render.c @@ -25,9 +25,8 @@ #include "../gfxdevice.h" #include "../gfxtools.h" #include "../mem.h" -#define PNG_INLINE_EXPORTS #include "../types.h" -#include "../png.c" +#include "../png.h" #include "../log.h" #include "render.h" @@ -275,16 +274,16 @@ static void fill_line_solid(RGBA*line, U32*z, int y, int x1, int x2, RGBA col) if(col.a!=255) { int ainv = 255-col.a; - col.r = (col.r*col.a)>>8; - col.g = (col.g*col.a)>>8; - col.b = (col.b*col.a)>>8; + col.r = (col.r*col.a)/255; + col.g = (col.g*col.a)/255; + col.b = (col.b*col.a)/255; do { if(z[bitpos]&bit) { - line[x].r = ((line[x].r*ainv)>>8)+col.r; - line[x].g = ((line[x].g*ainv)>>8)+col.g; - line[x].b = ((line[x].b*ainv)>>8)+col.b; + line[x].r = ((line[x].r*ainv)/255)+col.r; + line[x].g = ((line[x].g*ainv)/255)+col.g; + line[x].b = ((line[x].b*ainv)/255)+col.b; //line[x].a = 255; - line[x].a = ((line[x].a*ainv)>>8)+col.a; + line[x].a = ((line[x].a*ainv)/255)+col.a; } bit <<= 1; if(!bit) { @@ -354,9 +353,9 @@ static void fill_line_bitmap(RGBA*line, U32*z, int y, int x1, int x2, fillinfo_t ainv = 255-col.a; /* needs bitmap with premultiplied alpha */ - line[x].r = ((line[x].r*ainv)>>8)+col.r; - line[x].g = ((line[x].g*ainv)>>8)+col.g; - line[x].b = ((line[x].b*ainv)>>8)+col.b; + line[x].r = ((line[x].r*ainv)/255)+col.r; + line[x].g = ((line[x].g*ainv)/255)+col.g; + line[x].b = ((line[x].b*ainv)/255)+col.b; line[x].a = 255; } bit <<= 1; @@ -822,7 +821,7 @@ char*gfximage_asXPM(gfximage_t*img, int depth) int d= 256/depth; char*str = (char*)malloc(img->width*img->height*4 + 500 + 16*depth*depth*depth); char*p = str; - p+= sprintf(p, "static char *noname[] = {\n\"%d %d 262144 3\",\n"); + p+= sprintf(p, "static char *noname[] = {\n\"%d %d 262144 3\",\n", img->width, img->height); int r,g,b; for(r=0;r