X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=1c3c2da2cd2c0a5499e1b38eb697a709cad7e2ed;hb=c7f2cde8319ab9138179caccda88dfd605712613;hp=3a84d11f67e0b4a154606f61b969503811f083a9;hpb=ec1409176c61594fd6c3c0311f4cea40772d47a6;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 3a84d11..1c3c2da 100644 --- a/lib/rfxswf.c +++ b/lib/rfxswf.c @@ -250,7 +250,7 @@ int swf_SetRGB(TAG * t,RGBA * col) void swf_GetRGB(TAG * t, RGBA * col) { RGBA dummy; - if(!col); + if(!col) col = &dummy; col->r = swf_GetU8(t); col->g = swf_GetU8(t); @@ -299,22 +299,35 @@ void swf_GetGradient(TAG * tag, GRADIENT * gradient, char alpha) } } +int swf_CountUBits(U32 v,int nbits) +{ int n = 32; + U32 m = 0x80000000; + if(v == 0x00000000) n = 0; + else + while (!(v&m)) + { n--; + m>>=1; + } + return (n>nbits)?n:nbits; +} + int swf_CountBits(U32 v,int nbits) { int n = 33; U32 m = 0x80000000; - if (!v) n = 0; else if (v&m) - { while (v&m) + { if(v == 0xffffffff) n = 1; + else + while (v&m) { n--; m>>=1; - if (!m) break; } } else - { while (!(v&m)) + { if(v == 0x00000000) n = 0; + else + while (!(v&m)) { n--; m>>=1; - if (!m) break; } } return (n>nbits)?n:nbits; @@ -1209,8 +1222,10 @@ int swf_WriteSWF(int handle, SWF * swf) // Writes SWF to file, returns leng { struct writer_t writer; swf->compressed = 0; - if(handle<0) + if(handle<0) { + writer_init_nullwriter(&writer); return swf_WriteSWF2(&writer, swf); + } writer_init_filewriter(&writer, handle); return swf_WriteSWF2(&writer, swf); } @@ -1219,8 +1234,10 @@ int swf_WriteSWC(int handle, SWF * swf) // Writes SWF to file, returns leng { struct writer_t writer; swf->compressed = 1; - if(handle<0) + if(handle<0) { + writer_init_nullwriter(&writer); return swf_WriteSWF2(&writer, swf); + } writer_init_filewriter(&writer, handle); return swf_WriteSWF2(&writer, swf); } @@ -1282,3 +1299,4 @@ void swf_FreeTags(SWF * swf) // Frees all malloc'ed memory for t #include "modules/swfbits.c" #include "modules/swfaction.c" #include "modules/swfsound.c" +#include "h.263/swfvideo.c"