+ character_t* idtable = rfx_calloc(sizeof(character_t)*65536); // id to character mapping
+ SWFPLACEOBJECT** depthtable = rfx_calloc(sizeof(SWFPLACEOBJECT*)*65536); // depth to placeobject mapping
+
+ tag = swf->firstTag;
+ numplacements = 0;
+ while(tag) {
+ if(tag->id == ST_PLACEOBJECT ||
+ tag->id == ST_PLACEOBJECT2) {
+ numplacements++;
+ }
+ tag = tag->next;
+ }
+ SWFPLACEOBJECT* placements = rfx_calloc(sizeof(SWFPLACEOBJECT)*numplacements);
+ numplacements = 0;
+
+ /* set background color */
+ RGBA color = swf_GetSWFBackgroundColor(swf);
+ swf_Render_SetBackgroundColor(buf, color);
+
+ /* parse definitions */
+ tag = swf->firstTag;
+ while(tag) {
+ if(swf_isDefiningTag(tag)) {
+ int id = swf_GetDefineID(tag);
+ idtable[id].tag = tag;
+ idtable[id].bbox = rfx_alloc(sizeof(SRECT));
+ *idtable[id].bbox = swf_GetDefineBBox(tag);
+
+ if(swf_isShapeTag(tag)) {
+ SHAPE2* shape = rfx_calloc(sizeof(SHAPE2));
+ swf_ParseDefineShape(tag, shape);
+ idtable[id].type = shape_type;
+ idtable[id].obj.shape = shape;
+ } else if(swf_isImageTag(tag)) {
+ int width,height;
+ RGBA*data = swf_ExtractImage(tag, &width, &height);
+ idtable[id].type = image_type;
+ swf_Render_AddImage(buf, id, data, width, height);
+ free(data);
+ } else if(tag->id == ST_DEFINEFONT ||
+ tag->id == ST_DEFINEFONT2) {
+ //swf_FontExtract(swf,id,&idtable[id].font);
+ idtable[id].obj.font = 0;
+ } else if(tag->id == ST_DEFINEFONTINFO ||
+ tag->id == ST_DEFINEFONTINFO2) {
+ idtable[id].type = font_type;
+ } else if(tag->id == ST_DEFINETEXT ||
+ tag->id == ST_DEFINETEXT2) {
+ idtable[id].type = text_type;
+ }
+ } else if(tag->id == ST_PLACEOBJECT ||
+ tag->id == ST_PLACEOBJECT2) {
+ SWFPLACEOBJECT p;
+ swf_GetPlaceObject(tag, &p);
+ /* TODO: add move and deletion */
+ placements[numplacements++] = p;
+ }
+ tag = tag->next;
+ }