X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfbbox.c;h=95ff67a094146cf52bb54b44829bc4c0ec0e0e73;hb=878ee5fa4b0535398f72bbcb9aee50e4fac115d2;hp=b8facd01abe99a9765974e4713b714e43e7c1ee8;hpb=3cba8ce3ff7563a4c8db25b89e48f9770db509cf;p=swftools.git diff --git a/src/swfbbox.c b/src/swfbbox.c index b8facd0..95ff67a 100644 --- a/src/swfbbox.c +++ b/src/swfbbox.c @@ -40,12 +40,12 @@ static int expand = 1; static struct options_t options[] = { {"h", "help"}, -{"O", "optimize"}, -{"S", "swifty"}, -{"o", "output"}, {"b", "bbox"}, {"B", "newbbox"}, {"e", "expand"}, +{"O", "optimize"}, +{"S", "swifty"}, +{"o", "output"}, {"v", "verbose"}, {"V", "version"}, {0,0} @@ -106,13 +106,15 @@ int args_callback_longoption(char*name,char*val) void args_callback_usage(char *name) { printf("\n"); - printf("Usage: %s [-OSe] file.swf\n", name); + printf("Usage: %s [-OS] file.swf\n", name); printf("\n"); printf("-h , --help Print help and exit\n"); + printf("-b , --bbox Show movie bounding box (default)\n"); + printf("-B , --newbbox Show recalculated (optimized/expanded) bounding box\n"); + printf("-e , --expand Write out a new file using the recalculated bounding box\n"); + printf("-O , --optimize Recalculate bounding boxes\n"); printf("-S , --swifty Print out transformed bounding boxes\n"); - printf("-O , --optimize Recalculate bounding boxes and write new file\n"); - printf("-e , --expand Recalculate main bounding box and write new file\n"); - printf("-o , --output Set output filename to (for -O/-e)\n"); + printf("-o , --output Set output filename to (for -O)\n"); printf("-v , --verbose Be more verbose\n"); printf("-V , --version Print program version and exit\n"); printf("\n"); @@ -187,10 +189,10 @@ MATRIX getmatrix(TAG*tag) static int fontnum = -1; static SWFFONT**fonts; static SWF*c_swf; -static void fontcallback1(U16 id,U8 * name) +static void fontcallback1(void*self, U16 id,U8 * name) { fontnum++; } -static void fontcallback2(U16 id,U8 * name) +static void fontcallback2(void*self, U16 id,U8 * name) { fonts[fontnum] = 0; swf_FontExtract(c_swf,id,&fonts[fontnum]); @@ -240,8 +242,8 @@ static void textcallback(void*self, int*chars, int*xpos, int nr, int fontid, int SRECT newglyphbbox, glyphbbox = font->layout->bounds[chars[t]]; MATRIX m = bounds->m; - if(ch < font->numchars && font->glyph2ascii) { - ch = font->glyph2ascii[ch]; + if(chars[t] < font->numchars && font->glyph2ascii) { + ch = font->glyph2ascii[chars[t]]; } m.sx = (m.sx * fontsize) / 1024; @@ -294,11 +296,11 @@ static void swf_OptimizeBoundingBoxes(SWF*swf) if(verbose) printf("Extracting fonts...\n"); c_swf = swf; fontnum = 0; - swf_FontEnumerate(swf,&fontcallback1); + swf_FontEnumerate(swf,&fontcallback1,0); fonts = (SWFFONT**)malloc(fontnum*sizeof(SWFFONT*)); memset(fonts, 0, fontnum*sizeof(SWFFONT*)); fontnum = 0; - swf_FontEnumerate(swf,&fontcallback2); + swf_FontEnumerate(swf,&fontcallback2,0); } memset(&bounds, 0, sizeof(bounds));