+ if(number == 1) {
+ /* if there is only one object, we will scale it.
+ So let's figure out its bounding box */
+ TAG*tag = swf->firstTag;
+ while(tag) {
+ if(swf_isDefiningTag(tag) && tag->id != ST_DEFINESPRITE) {
+ if(swf_GetDefineID(tag) == id)
+ bbox = swf_GetDefineBBox(tag);
+ objtag = tag;
+ }
+ tag = tag->next;
+ }
+ newswf.movieSize.xmin = 0;
+ newswf.movieSize.ymin = 0;
+ newswf.movieSize.xmax = 512*20;
+ newswf.movieSize.ymax = 512*20;
+ } else {
+ if((objectbbox.xmin|objectbbox.ymin|objectbbox.xmax|objectbbox.ymax)!=0)
+ newswf.movieSize = objectbbox;
+ }
+
+ if(extractname_id>=0) {
+ desttag = swf_InsertTag(desttag, ST_PLACEOBJECT2);
+ swf_ObjectPlace(desttag, extractname_id, extractname_id, 0,0,extractname);
+ } else {
+ for(t=0;t<65536;t++) {
+ if(is_in_range(t, extractids)) {
+ MATRIX m;
+ desttag = swf_InsertTag(desttag, ST_PLACEOBJECT2);
+ swf_GetMatrix(0, &m);
+ if(objtag) {
+ int width = bbox.xmax - bbox.xmin;
+ int height = bbox.ymax - bbox.ymin;
+ int max = width>height?width:height;
+ m.tx = -bbox.xmin;
+ m.ty = -bbox.ymin;
+ if(max) {
+ m.sx = (512*20*65536)/max;
+ m.sy = (512*20*65536)/max;
+ }
+ //newswf.movieSize = swf_TurnRect(newswf.movieSize, &m);
+ }
+ swf_ObjectPlace(desttag, t, t, &m,0,0);
+ }
+ }
+ }
+ }
+ desttag = swf_InsertTag(desttag,ST_SHOWFRAME);
+ }