mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-19 14:38:07 +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;
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,7 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
}
|
||||
|
||||
@Override
|
||||
public void zoomToFit() {
|
||||
public double getZoomToFit() {
|
||||
if (timelined instanceof BoundedTag) {
|
||||
RECT bounds = ((BoundedTag) timelined).getRect(new HashSet<BoundedTag>());
|
||||
double w1 = bounds.getWidth() / SWF.unitDivisor;
|
||||
@@ -424,8 +424,10 @@ public final class ImagePanel extends JPanel implements ActionListener, MediaDis
|
||||
} else {
|
||||
w = w2;
|
||||
}
|
||||
zoom = (double) w / (double) w1;
|
||||
return (double) w / (double) w1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void setImage(byte[] data) {
|
||||
|
||||
@@ -2631,6 +2631,11 @@ public final class MainPanel extends JPanel implements ActionListener, TreeSelec
|
||||
}
|
||||
return new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return tag.hashCode();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,7 +207,8 @@ public class SoundTagPlayer implements MediaDisplay {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void zoomToFit() {
|
||||
public double getZoomToFit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -58,8 +58,9 @@ public class FlashPlayerPanel extends Panel implements Closeable, MediaDisplay {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void zoomToFit() {
|
||||
public double getZoomToFit() {
|
||||
//TODO
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -53,7 +53,7 @@ public interface MediaDisplay {
|
||||
|
||||
public boolean zoomAvailable();
|
||||
|
||||
public void zoomToFit();
|
||||
public double getZoomToFit();
|
||||
|
||||
public double getZoom();
|
||||
}
|
||||
|
||||
@@ -316,8 +316,8 @@ public class PlayerControls extends JPanel implements ActionListener {
|
||||
updateZoom();
|
||||
break;
|
||||
case ACTION_ZOOMFIT:
|
||||
display.zoomToFit();
|
||||
//updateZoom();
|
||||
realZoom = display.getZoomToFit();
|
||||
updateZoom();
|
||||
break;
|
||||
case ACTION_SNAPSHOT:
|
||||
putImageToClipBoard(display.printScreen());
|
||||
|
||||
Reference in New Issue
Block a user