mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-21 22:55:34 +00:00
DefineJPEG3 tag reading fix, Caching Shape outline, zoom to fit fixed, shape caching
This commit is contained in:
@@ -768,10 +768,12 @@ public class SWFInputStream implements AutoCloseable {
|
||||
endDumpLevel();
|
||||
InflaterInputStream dis = new InflaterInputStream(new ByteArrayInputStream(data));
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
if (count > 0) {
|
||||
byte[] buf = new byte[4096];
|
||||
int c = 0;
|
||||
while ((c = dis.read(buf)) > 0) {
|
||||
baos.write(buf, 0, c);
|
||||
int c = 0;
|
||||
while ((c = dis.read(buf)) > 0) {
|
||||
baos.write(buf, 0, c);
|
||||
}
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ public class SHAPE implements NeedsCharacters, Serializable {
|
||||
public int numLineBits;
|
||||
public List<SHAPERECORD> shapeRecords;
|
||||
|
||||
private Shape cachedOutline;
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
for (SHAPERECORD r : shapeRecords) {
|
||||
@@ -62,12 +64,17 @@ public class SHAPE implements NeedsCharacters, Serializable {
|
||||
}
|
||||
|
||||
public Shape getOutline() {
|
||||
if (cachedOutline != null) {
|
||||
return cachedOutline;
|
||||
}
|
||||
|
||||
List<GeneralPath> paths = PathExporter.export(this);
|
||||
Area area = new Area();
|
||||
for (GeneralPath path : paths) {
|
||||
area.add(new Area(path));
|
||||
}
|
||||
|
||||
cachedOutline = area;
|
||||
return area;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user