#747 Move tag to adds extra frame fixed

This commit is contained in:
honfika@gmail.com
2014-12-14 17:57:53 +01:00
parent fac4df46e5
commit 9ea4f6c6b7
4 changed files with 26 additions and 13 deletions

View File

@@ -715,7 +715,7 @@ public final class SWF implements SWFContainerItem, Timelined {
}
}
private void assignExportNamesToSymbols() {
public void assignExportNamesToSymbols() {
HashMap<Integer, String> exportNames = new HashMap<>();
for (Tag t : tags) {
if (t instanceof ExportAssetsTag) {

View File

@@ -3235,19 +3235,20 @@ public class SWFInputStream implements AutoCloseable {
public BITMAPDATA readBITMAPDATA(int bitmapFormat, int bitmapWidth, int bitmapHeight, String name) throws IOException {
BITMAPDATA ret = new BITMAPDATA();
newDumpLevel(name, "BITMAPDATA");
List<PIX15> pix15 = new ArrayList<>();
List<PIX24> pix24 = new ArrayList<>();
int pixelCount = bitmapWidth * bitmapHeight;
PIX15[] pix15 = bitmapFormat == DefineBitsLosslessTag.FORMAT_15BIT_RGB ? new PIX15[pixelCount] : null;
PIX24[] pix24 = bitmapFormat == DefineBitsLosslessTag.FORMAT_24BIT_RGB ? new PIX24[pixelCount] : null;
int dataLen = 0;
int pos = 0;
for (int y = 0; y < bitmapHeight; y++) {
int x = 0;
for (; x < bitmapWidth; x++) {
for (int x = 0; x < bitmapWidth; x++) {
if (bitmapFormat == DefineBitsLosslessTag.FORMAT_15BIT_RGB) {
dataLen += 2;
pix15.add(readPIX15("pix15"));
pix15[pos++] = readPIX15("pix15");
}
if (bitmapFormat == DefineBitsLosslessTag.FORMAT_24BIT_RGB) {
dataLen += 4;
pix24.add(readPIX24("pix24"));
pix24[pos++] = readPIX24("pix24");
}
}
while ((dataLen % 4) != 0) {
@@ -3256,9 +3257,9 @@ public class SWFInputStream implements AutoCloseable {
}
}
if (bitmapFormat == DefineBitsLosslessTag.FORMAT_15BIT_RGB) {
ret.bitmapPixelDataPix15 = pix15.toArray(new PIX15[pix15.size()]);
ret.bitmapPixelDataPix15 = pix15;
} else if (bitmapFormat == DefineBitsLosslessTag.FORMAT_24BIT_RGB) {
ret.bitmapPixelDataPix24 = pix24.toArray(new PIX24[pix24.size()]);
ret.bitmapPixelDataPix24 = pix24;
}
endDumpLevel();
return ret;

View File

@@ -154,19 +154,23 @@ public class Timeline {
int frameIdx = 0;
Frame frame = new Frame(this, frameIdx++);
frame.layersChanged = true;
boolean tagAdded = false;
boolean newFrameNeeded = false;
for (Tag t : tags) {
tagAdded = true;
if (ShowFrameTag.isNestedTagType(t.getId())) {
newFrameNeeded = true;
frame.innerTags.add(t);
}
if (t instanceof StartSoundTag) {
newFrameNeeded = true;
frame.sounds.add(((StartSoundTag) t).soundId);
} else if (t instanceof StartSound2Tag) {
newFrameNeeded = true;
frame.soundClasses.add(((StartSound2Tag) t).soundClassName);
} else if (t instanceof SetBackgroundColorTag) {
newFrameNeeded = true;
frame.backgroundColor = ((SetBackgroundColorTag) t).backgroundColor;
} else if (t instanceof PlaceObjectTypeTag) {
newFrameNeeded = true;
PlaceObjectTypeTag po = (PlaceObjectTypeTag) t;
int depth = po.getDepth();
if (!frame.layers.containsKey(depth)) {
@@ -228,25 +232,27 @@ public class Timeline {
}
fl.key = true;
} else if (t instanceof RemoveTag) {
newFrameNeeded = true;
RemoveTag r = (RemoveTag) t;
int depth = r.getDepth();
frame.layers.remove(depth);
frame.layersChanged = true;
} else if (t instanceof DoActionTag) {
newFrameNeeded = true;
frame.actions.add((DoActionTag) t);
actionFrames.put((DoActionTag) t, frame.frame);
} else if (t instanceof ShowFrameTag) {
frame.showFrameTag = (ShowFrameTag) t;
frames.add(frame);
frame = new Frame(frame, frameIdx++);
tagAdded = false;
newFrameNeeded = false;
} else if (t instanceof ASMSource) {
asmSources.add((ASMSource) t);
} else {
otherTags.add(t);
}
}
if (tagAdded) {
if (newFrameNeeded) {
frames.add(frame);
}