mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-01 10:55:12 +00:00
#1205: shape cache needs less memory
This commit is contained in:
@@ -2497,6 +2497,12 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
}
|
||||
|
||||
public static void clearAllStaticCache() {
|
||||
Cache.clearAll();
|
||||
Helper.clearShapeCache();
|
||||
System.gc();
|
||||
}
|
||||
|
||||
public void clearAllCache() {
|
||||
characters = null;
|
||||
characterIdTags = null;
|
||||
@@ -2505,9 +2511,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
clearReadOnlyListCache();
|
||||
clearImageCache();
|
||||
clearScriptCache();
|
||||
Cache.clearAll();
|
||||
Helper.clearShapeCache();
|
||||
System.gc();
|
||||
clearAllStaticCache();
|
||||
}
|
||||
|
||||
public static void uncache(ASMSource src) {
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Helper {
|
||||
|
||||
public static String decompilationErrorAdd = null;
|
||||
|
||||
private static final Map<String, Area> shapeCache = new HashMap<>();
|
||||
private static final Map<BitSet, Area> shapeCache = new HashMap<>();
|
||||
|
||||
private static final String[] hexStringCache;
|
||||
|
||||
@@ -1180,9 +1180,8 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
String key = byteArrayToBase64String(bs.toByteArray());
|
||||
if (shapeCache.containsKey(key)) {
|
||||
return shapeCache.get(key);
|
||||
if (shapeCache.containsKey(bs)) {
|
||||
return shapeCache.get(bs);
|
||||
}
|
||||
|
||||
for (int x = 0; x < width; x++) {
|
||||
@@ -1210,7 +1209,7 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
shapeCache.put(key, area);
|
||||
shapeCache.put(bs, area);
|
||||
return area;
|
||||
}
|
||||
|
||||
@@ -1238,9 +1237,8 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
String key = byteArrayToBase64String(bs.toByteArray());
|
||||
if (shapeCache.containsKey(key)) {
|
||||
return shapeCache.get(key);
|
||||
if (shapeCache.containsKey(bs)) {
|
||||
return shapeCache.get(bs);
|
||||
}
|
||||
|
||||
BitSet bsArea = new BitSet(width * height);
|
||||
@@ -1321,7 +1319,7 @@ public class Helper {
|
||||
}
|
||||
}
|
||||
|
||||
shapeCache.put(key, area);
|
||||
shapeCache.put(bs, area);
|
||||
return area;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user