mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-05-28 20:44:55 +00:00
define shape refactor 1
This commit is contained in:
@@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -52,7 +51,7 @@ public class DefineShape2Tag extends ShapeTag {
|
||||
try {
|
||||
SWFInputStream sis = new SWFInputStream(swf, shapeData.getArray(), 0, shapeData.getPos() + shapeData.getLength());
|
||||
sis.seek(shapeData.getPos());
|
||||
shapes = sis.readSHAPEWITHSTYLE(2, false, "shapes");
|
||||
shapes = sis.readSHAPEWITHSTYLE(getShapeNum(), false, "shapes");
|
||||
shapeData = null; // not needed anymore, give it to GC
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(DefineShape2Tag.class.getName()).log(Level.SEVERE, null, ex);
|
||||
@@ -112,7 +111,7 @@ public class DefineShape2Tag extends ShapeTag {
|
||||
shapeId = sis.readUI16("shapeId");
|
||||
shapeBounds = sis.readRECT("shapeBounds");
|
||||
if (!lazy) {
|
||||
shapes = sis.readSHAPEWITHSTYLE(2, false, "shapes");
|
||||
shapes = sis.readSHAPEWITHSTYLE(getShapeNum(), false, "shapes");
|
||||
} else {
|
||||
shapeData = new ByteArrayRange(data.getArray(), (int) sis.getPos(), sis.available());
|
||||
}
|
||||
@@ -126,12 +125,11 @@ public class DefineShape2Tag extends ShapeTag {
|
||||
@Override
|
||||
public byte[] getData() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
OutputStream os = baos;
|
||||
SWFOutputStream sos = new SWFOutputStream(os, getVersion());
|
||||
SWFOutputStream sos = new SWFOutputStream(baos, getVersion());
|
||||
try {
|
||||
sos.writeUI16(shapeId);
|
||||
sos.writeRECT(shapeBounds);
|
||||
sos.writeSHAPEWITHSTYLE(getShapes(), 2);
|
||||
sos.writeSHAPEWITHSTYLE(getShapes(), getShapeNum());
|
||||
} catch (IOException e) {
|
||||
throw new Error("This should never happen.", e);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class DefineShapeTag extends ShapeTag {
|
||||
try {
|
||||
SWFInputStream sis = new SWFInputStream(swf, shapeData.getArray(), 0, shapeData.getPos() + shapeData.getLength());
|
||||
sis.seek(shapeData.getPos());
|
||||
shapes = sis.readSHAPEWITHSTYLE(1, false, "shapes");
|
||||
shapes = sis.readSHAPEWITHSTYLE(getShapeNum(), false, "shapes");
|
||||
shapeData = null; // not needed anymore, give it to GC
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(DefineShapeTag.class.getName()).log(Level.SEVERE, null, ex);
|
||||
@@ -111,7 +111,7 @@ public class DefineShapeTag extends ShapeTag {
|
||||
shapeId = sis.readUI16("shapeId");
|
||||
shapeBounds = sis.readRECT("shapeBounds");
|
||||
if (!lazy) {
|
||||
shapes = sis.readSHAPEWITHSTYLE(1, false, "shapes");
|
||||
shapes = sis.readSHAPEWITHSTYLE(getShapeNum(), false, "shapes");
|
||||
} else {
|
||||
shapeData = new ByteArrayRange(data.getArray(), (int) sis.getPos(), sis.available());
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class DefineShapeTag extends ShapeTag {
|
||||
try {
|
||||
sos.writeUI16(shapeId);
|
||||
sos.writeRECT(shapeBounds);
|
||||
sos.writeSHAPEWITHSTYLE(getShapes(), 1);
|
||||
sos.writeSHAPEWITHSTYLE(getShapes(), getShapeNum());
|
||||
} catch (IOException e) {
|
||||
throw new Error("This should never happen.", e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user