diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 665022d30..a624ef97f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -715,7 +715,7 @@ public final class SWF implements SWFContainerItem, Timelined { } } - private void assignExportNamesToSymbols() { + public void assignExportNamesToSymbols() { HashMap exportNames = new HashMap<>(); for (Tag t : tags) { if (t instanceof ExportAssetsTag) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java index 92a3b13c6..79009ba0a 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -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 = new ArrayList<>(); - List 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; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java index 2b75b92d5..05ae57dd8 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Timeline.java @@ -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); } diff --git a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java index ad1258aaf..566a244da 100644 --- a/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java @@ -302,6 +302,10 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener { tag.setSwf(targetSwf); targetSwf.tags.add(tag); tag.setModified(true); + sourceSwf.assignExportNamesToSymbols(); + targetSwf.assignExportNamesToSymbols(); + sourceSwf.assignClassesToSymbols(); + targetSwf.assignClassesToSymbols(); sourceSwf.clearImageCache(); targetSwf.clearImageCache(); mainPanel.refreshTree(); @@ -324,6 +328,8 @@ public class TagTreeContextMenu extends JPopupMenu implements ActionListener { copyTag.setSwf(targetSwf); targetSwf.tags.add(copyTag); copyTag.setModified(true); + targetSwf.assignExportNamesToSymbols(); + targetSwf.assignClassesToSymbols(); targetSwf.clearImageCache(); mainPanel.refreshTree(); } catch (IOException | InterruptedException ex) {