X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Frfxswf.c;h=f48045848ba02a88947643be8c4c09c1a8dc30f9;hb=3c7acbedb30491cc7e7e827f06853bc18ec91759;hp=3a84d11f67e0b4a154606f61b969503811f083a9;hpb=ec1409176c61594fd6c3c0311f4cea40772d47a6;p=swftools.git diff --git a/lib/rfxswf.c b/lib/rfxswf.c index 3a84d11..f480458 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; @@ -1282,3 +1295,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"