added bbox parsing.
authorkramm <kramm>
Sat, 18 Dec 2004 19:19:24 +0000 (19:19 +0000)
committerkramm <kramm>
Sat, 18 Dec 2004 19:19:24 +0000 (19:19 +0000)
src/swfdump.c

index a697900..1f038a6 100644 (file)
@@ -56,6 +56,7 @@ static int showtext = 0;
 static int showshapes = 0;
 static int hex = 0;
 static int used = 0;
+static int bbox = 0;
 
 static struct options_t options[] = {
 {"h", "help"},
@@ -70,6 +71,7 @@ static struct options_t options[] = {
 {"Y", "height"},
 {"r", "rate"},
 {"f", "frames"},
+{"b", "bbox"},
 {"d", "hex"},
 {"u", "used"},
 {0,0}
@@ -125,6 +127,10 @@ int args_callback_option(char*name,char*val)
        used = 1;
        return 0;
     }
+    else if(name[0]=='b') {
+       bbox = 1;
+       return 0;
+    }
     else if(name[0]=='D') {
        action = placements = showtext = showshapes = 1;
        return 0;
@@ -1035,6 +1041,15 @@ int main (int argc,char ** argv)
        else {
            printf("\n");
        }
+
+       if(bbox && swf_isDefiningTag(tag) && tag->id != ST_DEFINESPRITE) {
+           SRECT r = swf_GetDefineBBox(tag);
+           printf("                %s bbox [%.2f, %.2f, %.2f, %.2f]\n", prefix,
+                   r.xmin/20.0,
+                   r.ymin/20.0,
+                   r.xmax/20.0,
+                   r.ymax/20.0);
+       }
         
         sprintf(myprefix, "                %s", prefix);