mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-25 11:10:56 +00:00
Refreshing shape/frame cache after image replace
formatting
This commit is contained in:
@@ -47,7 +47,6 @@ public class KeyValue<K, V> {
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
|
||||
@@ -92,6 +92,7 @@ import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.filters.BlendComposite;
|
||||
import com.jpexs.decompiler.flash.types.filters.FILTER;
|
||||
import com.jpexs.decompiler.flash.types.filters.Filtering;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.sound.AdpcmDecoder;
|
||||
import com.jpexs.decompiler.flash.xfl.XFLConverter;
|
||||
import java.awt.AlphaComposite;
|
||||
@@ -1899,6 +1900,11 @@ public class SWF {
|
||||
}
|
||||
private static Cache cache = new Cache(false);
|
||||
|
||||
public void clearImageCache() {
|
||||
cache.clear();
|
||||
SHAPERECORD.clearShapeCache();
|
||||
}
|
||||
|
||||
public static RECT fixRect(RECT rect) {
|
||||
RECT ret = new RECT();
|
||||
ret.Xmin = rect.Xmin;
|
||||
|
||||
@@ -382,7 +382,7 @@ public class AVM2Graph extends Graph {
|
||||
ret = new ArrayList<>();
|
||||
ret.addAll(output);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (((part.nextParts.size() == 2)
|
||||
&& (!stack.isEmpty())
|
||||
&& (stack.peek() instanceof StrictEqTreeItem)
|
||||
|
||||
@@ -278,7 +278,7 @@ public class ActionGraph extends Graph {
|
||||
});*/
|
||||
|
||||
//GraphPart breakPart = breakParts.isEmpty() ? null : breakParts.get(0);
|
||||
List<GraphPart> mcp=new ArrayList<>();
|
||||
List<GraphPart> mcp = new ArrayList<>();
|
||||
mcp.addAll(caseBodyParts);
|
||||
mcp.add(defaultPart2);
|
||||
GraphPart breakPart = getMostCommonPart(mcp, loops);
|
||||
@@ -329,12 +329,12 @@ public class ActionGraph extends Graph {
|
||||
stopPart2x.add(next);
|
||||
defaultCommands = printGraph(new ArrayList<GraphPart>(), localData, stack, allParts, null, defaultPart, stopPart2x, loops);
|
||||
}
|
||||
|
||||
if(!defaultCommands.isEmpty()){
|
||||
if(defaultCommands.get(defaultCommands.size()-1) instanceof BreakItem){
|
||||
BreakItem bi=(BreakItem)defaultCommands.get(defaultCommands.size()-1);
|
||||
if(bi.loopId==currentLoop.id){
|
||||
defaultCommands.remove(defaultCommands.size()-1);
|
||||
|
||||
if (!defaultCommands.isEmpty()) {
|
||||
if (defaultCommands.get(defaultCommands.size() - 1) instanceof BreakItem) {
|
||||
BreakItem bi = (BreakItem) defaultCommands.get(defaultCommands.size() - 1);
|
||||
if (bi.loopId == currentLoop.id) {
|
||||
defaultCommands.remove(defaultCommands.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -551,10 +551,10 @@ public class Graph {
|
||||
System.out.println("</loops>");*/
|
||||
getPrecontinues(null, heads.get(0), loops, null);
|
||||
/*System.err.println("<loopspre>");
|
||||
for (Loop el : loops) {
|
||||
System.err.println(el);
|
||||
}
|
||||
System.err.println("</loopspre>");//*/
|
||||
for (Loop el : loops) {
|
||||
System.err.println(el);
|
||||
}
|
||||
System.err.println("</loopspre>");//*/
|
||||
|
||||
List<GraphTargetItem> ret = printGraph(new ArrayList<GraphPart>(), localData, stack, allParts, null, heads.get(0), null, loops);
|
||||
processIfs(ret);
|
||||
|
||||
@@ -1664,6 +1664,7 @@ public class MainFrame extends AppFrame implements ActionListener, TreeSelection
|
||||
byte data[] = Helper.readFile(selfile.getAbsolutePath());
|
||||
try {
|
||||
it.setImage(data);
|
||||
swf.clearImageCache();
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(MainFrame.class.getName()).log(Level.SEVERE, "Invalid image", ex);
|
||||
JOptionPane.showMessageDialog(null, translate("error.image.invalid"), translate("error"), JOptionPane.ERROR_MESSAGE);
|
||||
|
||||
@@ -279,7 +279,7 @@ public class ActionPanel extends JPanel implements ActionListener {
|
||||
}
|
||||
};
|
||||
asm.addDisassemblyListener(listener);
|
||||
lastDisasm = asm.getASMSource(SWF.DEFAULT_VERSION, true);
|
||||
lastDisasm = asm.getASMSource(SWF.DEFAULT_VERSION, true);
|
||||
asm.removeDisassemblyListener(listener);
|
||||
srcWithHex = Helper.hexToComments(lastDisasm);
|
||||
srcNoHex = Helper.stripComments(lastDisasm);
|
||||
|
||||
@@ -422,9 +422,9 @@ public class Helper {
|
||||
bs = new byte[0];
|
||||
Logger.getLogger(Helper.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
String sn="";
|
||||
String sn = "";
|
||||
for (int i = 0; i < bs.length; i++) {
|
||||
sn += "0x" + Integer.toHexString(bs[i]&0xff) + " ";
|
||||
sn += "0x" + Integer.toHexString(bs[i] & 0xff) + " ";
|
||||
}
|
||||
return sn;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ public class PlaceObject2Tag extends Tag implements Container, PlaceObjectTypeTa
|
||||
*
|
||||
* @param data Data bytes
|
||||
* @param version SWF version
|
||||
* @param pos
|
||||
* @param pos
|
||||
* @throws IOException
|
||||
*/
|
||||
public PlaceObject2Tag(byte data[], int version, long pos) throws IOException {
|
||||
|
||||
@@ -272,7 +272,7 @@ public class PlaceObject3Tag extends Tag implements Container, PlaceObjectTypeTa
|
||||
*
|
||||
* @param data Data bytes
|
||||
* @param version SWF version
|
||||
* @param pos
|
||||
* @param pos
|
||||
* @throws IOException
|
||||
*/
|
||||
public PlaceObject3Tag(byte data[], int version, long pos) throws IOException {
|
||||
|
||||
@@ -20,9 +20,9 @@ public interface PlaceObjectTypeTag {
|
||||
public MATRIX getMatrix();
|
||||
|
||||
public String getInstanceName();
|
||||
|
||||
|
||||
public void setInstanceName(String name);
|
||||
|
||||
|
||||
public void setClassName(String className);
|
||||
|
||||
public CXFORM getColorTransform();
|
||||
|
||||
@@ -813,6 +813,10 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters {
|
||||
}
|
||||
private static HashMap<String, BufferedImage> cache = new HashMap<>();
|
||||
|
||||
public static void clearShapeCache() {
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
public static BufferedImage shapeToImage(List<Tag> tags, int shapeNum, FILLSTYLEARRAY fillStyles, LINESTYLEARRAY lineStylesList, List<SHAPERECORD> records) {
|
||||
return shapeToImage(tags, shapeNum, fillStyles, lineStylesList, records, null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user