X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fswfcombine.c;h=403419df80d542e7546b498aec287f99066849ec;hb=c7432833fe3a6469d63fad135151a92e12877b94;hp=e595d26affc43d2df6830179032305bb1e383f73;hpb=6f3e9add89a0157ef6552bc154475b43b371e615;p=swftools.git diff --git a/src/swfcombine.c b/src/swfcombine.c index e595d26..403419d 100644 --- a/src/swfcombine.c +++ b/src/swfcombine.c @@ -497,7 +497,6 @@ TAG* write_sprite_defines(TAG*tag, SWF*sprite) void changedepth(TAG*tag, int add) { - /* fucking byteorders */ if(tag->id == ST_PLACEOBJECT) PUT16(&tag->data[2],GET16(&tag->data[2])+add); if(tag->id == ST_PLACEOBJECT2) @@ -506,6 +505,23 @@ void changedepth(TAG*tag, int add) PUT16(&tag->data[2],GET16(&tag->data[2])+add); if(tag->id == ST_REMOVEOBJECT2) PUT16(&tag->data[0],GET16(&tag->data[0])+add); + if(tag->id == ST_PLACEOBJECT2) { + SWFPLACEOBJECT obj; + U8 flags; + swf_SetTagPos(tag, 0); + flags = swf_GetU8(tag); + if(flags&2) swf_GetU16(tag); //id + if(flags&4) swf_GetMatrix(tag, 0); + if(flags&8) swf_GetCXForm(tag, 0,1); + if(flags&16) swf_GetU16(tag); //ratio + if(flags&64) { + swf_ResetReadBits(tag); + printf("%d->%d\n", GET16(&tag->data[tag->pos]), + GET16(&tag->data[tag->pos])+add); + PUT16(&tag->data[tag->pos],GET16(&tag->data[tag->pos])+add); + } + msg(" Depth relocation not fully working yet with clipdepths", tag->id); + } } void matrix_adjust(MATRIX*m, int movex, int movey, float scalex, float scaley, int scalepos) @@ -524,7 +540,7 @@ void matrix_adjust(MATRIX*m, int movex, int movey, float scalex, float scaley, i void write_changepos(TAG*output, TAG*tag, int movex, int movey, float scalex, float scaley, int scalepos) { - if(movex || movey || scalex != 1 || scaley != 1) + if(movex || movey || scalex != 1.0 || scaley != 1.0) { switch(tag->id) { @@ -551,7 +567,8 @@ void write_changepos(TAG*output, TAG*tag, int movex, int movey, float scalex, fl matrix_adjust(&m, movex, movey, scalex, scaley, scalepos); swf_SetMatrix(output, &m); - //swf_ResetReadBits(tag); + if (tag->readBit) { tag->pos++; tag->readBit = 0; } //swf_ResetReadBits(tag); + swf_SetBlock(output, &tag->data[tag->pos], tag->len - tag->pos); break; } @@ -564,7 +581,8 @@ void write_changepos(TAG*output, TAG*tag, int movex, int movey, float scalex, fl matrix_adjust(&m, movex, movey, scalex, scaley, scalepos); swf_SetMatrix(output, &m); - //swf_ResetReadBits(tag); + if (tag->readBit) { tag->pos++; tag->readBit = 0; } //swf_ResetReadBits(tag); + swf_SetBlock(output, &tag->data[tag->pos], tag->len - tag->pos); break; } @@ -616,8 +634,9 @@ TAG* write_sprite(TAG*tag, SWF*sprite, int spriteid, int replaceddefine) rtag->id, rtag->len); tag = swf_InsertTag(tag, rtag->id); write_changepos(tag, rtag, config.movex, config.movey, config.scalex, config.scaley, 0); - - changedepth(tag, +2); + + if(config.clip || (config.overlay && !config.isframe)) + changedepth(tag, +2); if(tag->id == ST_SHOWFRAME) { @@ -955,7 +974,8 @@ void normalcombine(SWF*master, char*slave_name, SWF*slave, SWF*newswf) } swf_Relocate (slave, masterbitmap); - swf_RelocateDepth (slave, depthbitmap); + if(config.merge) + swf_RelocateDepth (slave, depthbitmap); jpeg_assert(slave, master); if (config.overlay)