#1205: shape cache needs less memory

This commit is contained in:
honfika@gmail.com
2016-03-17 15:42:44 +01:00
parent c648565eb9
commit ecd038e50b
2 changed files with 14 additions and 12 deletions

View File

@@ -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;
}