mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-04 15:14:49 +00:00
usinig sets for known addresses, some deepcopy call modified to clone() call
This commit is contained in:
@@ -1566,7 +1566,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
|
||||
if (debugMode) {
|
||||
System.err.println("Visit " + ip + ": ofs" + Helper.formatAddress(((Action) ins).getAddress()) + ":" + ((Action) ins).getASMSource(new ActionList(), new ArrayList<Long>(), ScriptExportMode.PCODE) + " stack:" + Helper.stackToString(stack, LocalData.create(new ConstantPool())));
|
||||
System.err.println("Visit " + ip + ": ofs" + Helper.formatAddress(((Action) ins).getAddress()) + ":" + ((Action) ins).getASMSource(new ActionList(), new HashSet<Long>(), ScriptExportMode.PCODE) + " stack:" + Helper.stackToString(stack, LocalData.create(new ConstantPool())));
|
||||
}
|
||||
if (ins.isExit()) {
|
||||
break;
|
||||
@@ -2378,7 +2378,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
colorTransform = new ColorTransform();
|
||||
}
|
||||
|
||||
ColorTransform clrTrans = Helper.deepCopy(colorTransform);
|
||||
ColorTransform clrTrans = colorTransform.clone();
|
||||
if (layer.colorTransForm != null && layer.blendMode <= 1) { //Normal blend mode
|
||||
clrTrans = colorTransform.merge(layer.colorTransForm);
|
||||
}
|
||||
@@ -2525,7 +2525,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
colorTransform = new ColorTransform();
|
||||
}
|
||||
|
||||
ColorTransform clrTrans = Helper.deepCopy(colorTransform);
|
||||
ColorTransform clrTrans = colorTransform.clone();
|
||||
if (layer.colorTransForm != null && layer.blendMode <= 1) { //Normal blend mode
|
||||
clrTrans = colorTransform.merge(layer.colorTransForm);
|
||||
}
|
||||
|
||||
@@ -2987,14 +2987,13 @@ public class AVM2Code implements Cloneable {
|
||||
return 1;
|
||||
}*/
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
public AVM2Code clone() throws CloneNotSupportedException {
|
||||
AVM2Code ret = (AVM2Code) super.clone();
|
||||
if (code != null) {
|
||||
List<AVM2Instruction> codeCopy = new ArrayList<>(code.size());
|
||||
for (AVM2Instruction ins : code) {
|
||||
codeCopy.add((AVM2Instruction) ins.clone());
|
||||
codeCopy.add(ins.clone());
|
||||
}
|
||||
ret.code = codeCopy;
|
||||
}
|
||||
|
||||
@@ -137,28 +137,28 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
|
||||
s.add(constants.getString(operands[i]));
|
||||
break;
|
||||
case AVM2Code.DAT_INT_INDEX:
|
||||
s.add(Long.valueOf(constants.getInt(operands[i])));
|
||||
s.add(constants.getInt(operands[i]));
|
||||
break;
|
||||
case AVM2Code.DAT_UINT_INDEX:
|
||||
s.add(new Long(constants.getUInt(operands[i])));
|
||||
s.add(constants.getUInt(operands[i]));
|
||||
break;
|
||||
case AVM2Code.DAT_DOUBLE_INDEX:
|
||||
s.add(Double.valueOf(constants.getDouble(operands[i])));
|
||||
s.add(constants.getDouble(operands[i]));
|
||||
break;
|
||||
case AVM2Code.DAT_OFFSET:
|
||||
s.add(new Long(offset + operands[i] + getBytes().length));
|
||||
s.add(offset + operands[i] + getBytes().length);
|
||||
break;
|
||||
case AVM2Code.DAT_CASE_BASEOFFSET:
|
||||
s.add(new Long(offset + operands[i]));
|
||||
s.add(offset + operands[i]);
|
||||
break;
|
||||
case AVM2Code.OPT_CASE_OFFSETS:
|
||||
s.add(new Long(operands[i]));
|
||||
s.add((long) operands[i]);
|
||||
for (int j = i + 1; j < operands.length; j++) {
|
||||
s.add(offset + operands[j]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
s.add(new Long(operands[i]));
|
||||
s.add((long) operands[i]);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException {
|
||||
public AVM2Instruction clone() throws CloneNotSupportedException {
|
||||
AVM2Instruction ret = (AVM2Instruction) super.clone();
|
||||
if (operands != null) {
|
||||
ret.operands = Arrays.copyOf(operands, operands.length);
|
||||
|
||||
@@ -46,7 +46,7 @@ import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MethodBody implements Cloneable {
|
||||
public final class MethodBody implements Cloneable {
|
||||
|
||||
public boolean deleted;
|
||||
boolean debugMode = false;
|
||||
@@ -236,7 +236,7 @@ public class MethodBody implements Cloneable {
|
||||
}
|
||||
|
||||
public MethodBody convertMethodBody(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, Trait trait, AVM2ConstantPool constants, List<MethodInfo> method_info, ScopeStack scopeStack, boolean isStaticInitializer, List<String> fullyQualifiedNames, Traits initTraits) throws InterruptedException {
|
||||
MethodBody b = (MethodBody) clone();
|
||||
MethodBody b = clone();
|
||||
AVM2Code deobfuscated = b.getCode();
|
||||
deobfuscated.markMappedOffsets();
|
||||
if (Configuration.autoDeobfuscate.get()) {
|
||||
@@ -252,25 +252,17 @@ public class MethodBody implements Cloneable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object clone() {
|
||||
public MethodBody clone() {
|
||||
try {
|
||||
MethodBody ret = (MethodBody) super.clone();
|
||||
if (code != null) {
|
||||
ret.code = (AVM2Code) code.clone();
|
||||
ret.code = code.clone();
|
||||
}
|
||||
ret.codeBytes = codeBytes;
|
||||
ret.exceptions = exceptions;
|
||||
ret.max_regs = max_regs;
|
||||
ret.max_scope_depth = max_scope_depth;
|
||||
ret.max_stack = max_stack;
|
||||
ret.method_info = method_info;
|
||||
ret.init_scope_depth = init_scope_depth;
|
||||
ret.traits = traits; //maybe deep clone
|
||||
//maybe deep clone traits
|
||||
return ret;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
Logger.getLogger(MethodBody.class.getName()).log(Level.SEVERE, null, ex);
|
||||
throw new RuntimeException();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean autoFillStats(ABC abc, int initScope, boolean hasThis) {
|
||||
|
||||
@@ -81,7 +81,9 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EmptyStackException;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -164,7 +166,7 @@ public class Action implements GraphSourceItem {
|
||||
*
|
||||
* @param refs list of addresses
|
||||
*/
|
||||
public void getRef(List<Long> refs) {
|
||||
public void getRef(Set<Long> refs) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,8 +175,8 @@ public class Action implements GraphSourceItem {
|
||||
* @param list List of actions
|
||||
* @return List of addresses
|
||||
*/
|
||||
public static List<Long> getActionsAllRefs(List<Action> list) {
|
||||
List<Long> ret = new ArrayList<>();
|
||||
public static Set<Long> getActionsAllRefs(List<Action> list) {
|
||||
Set<Long> ret = new HashSet<>();
|
||||
for (Action a : list) {
|
||||
a.getRef(ret);
|
||||
}
|
||||
@@ -403,7 +405,7 @@ public class Action implements GraphSourceItem {
|
||||
*/
|
||||
public static GraphTextWriter actionsToString(List<DisassemblyListener> listeners, long address, ActionList list, int version, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
long offset;
|
||||
List<Long> importantOffsets = getActionsAllRefs(list);
|
||||
Set<Long> importantOffsets = getActionsAllRefs(list);
|
||||
/*List<ConstantPool> cps = SWFInputStream.getConstantPool(new ArrayList<DisassemblyListener>(), new ActionGraphSource(list, version, new HashMap<Integer, String>(), new HashMap<String, GraphTargetItem>(), new HashMap<String, GraphTargetItem>()), 0, version, path);
|
||||
if (!cps.isEmpty()) {
|
||||
setConstantPool(list, cps.get(cps.size() - 1));
|
||||
@@ -583,7 +585,7 @@ public class Action implements GraphSourceItem {
|
||||
* @param exportMode PCode or hex?
|
||||
* @return String of P-code source
|
||||
*/
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
return toString();
|
||||
}
|
||||
|
||||
@@ -1220,7 +1222,7 @@ public class Action implements GraphSourceItem {
|
||||
}
|
||||
}
|
||||
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
writer.appendNoHilight(getASMSource(container, knownAddreses, exportMode));
|
||||
return writer;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ import com.jpexs.helpers.Helper;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -806,7 +807,7 @@ public class ActionListReader {
|
||||
}
|
||||
|
||||
if (debugMode) {
|
||||
String atos = a.getASMSource(new ActionList(), new ArrayList<Long>(), ScriptExportMode.PCODE);
|
||||
String atos = a.getASMSource(new ActionList(), new HashSet<Long>(), ScriptExportMode.PCODE);
|
||||
if (a instanceof GraphSourceItemContainer) {
|
||||
atos = a.toString();
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActionWaitForFrame extends Action implements ActionStore {
|
||||
|
||||
@@ -56,7 +57,7 @@ public class ActionWaitForFrame extends Action implements ActionStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
String ret = "WaitForFrame " + frame + " " + skipCount;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.jpexs.helpers.Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -57,7 +58,7 @@ public class ActionIf extends Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRef(List<Long> refs) {
|
||||
public void getRef(Set<Long> refs) {
|
||||
refs.add(getAddress() + getTotalActionLength() + offset);
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ public class ActionIf extends Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
long address = getAddress() + getTotalActionLength() + offset;
|
||||
String ofsStr = Helper.formatAddress(address);
|
||||
return "If loc" + ofsStr + (!jumpUsed ? " ;compileTimeIgnore" : (!ignoreUsed ? " ;compileTimeJump" : ""));
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.jpexs.helpers.Helper;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -58,7 +59,7 @@ public class ActionJump extends Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getRef(List<Long> refs) {
|
||||
public void getRef(Set<Long> refs) {
|
||||
refs.add(getAddress() + getTotalActionLength() + offset);
|
||||
}
|
||||
|
||||
@@ -76,7 +77,7 @@ public class ActionJump extends Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
long address = getAddress() + getTotalActionLength() + offset;
|
||||
String ofsStr = Helper.formatAddress(address);
|
||||
return "Jump loc" + ofsStr;
|
||||
|
||||
@@ -43,6 +43,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActionPush extends Action {
|
||||
|
||||
@@ -232,7 +233,7 @@ public class ActionPush extends Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
if (replacement == null || replacement.size() < values.size()) {
|
||||
return toString(writer);
|
||||
}
|
||||
@@ -243,7 +244,7 @@ public class ActionPush extends Action {
|
||||
return writer;
|
||||
}
|
||||
|
||||
public GraphTextWriter paramsToStringReplaced(List<? extends GraphSourceItem> container, List<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
public GraphTextWriter paramsToStringReplaced(List<? extends GraphSourceItem> container, Set<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
if (replacement == null || replacement.size() < values.size()) {
|
||||
return paramsToString(writer);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActionWaitForFrame2 extends Action implements ActionStore {
|
||||
|
||||
@@ -117,7 +118,7 @@ public class ActionWaitForFrame2 extends Action implements ActionStore {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
String ret = "WaitForFrame2 " + skipCount;
|
||||
/*for (int i = 0; i < skipped.size(); i++) {
|
||||
if (skipped.get(i) instanceof ActionEnd) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActionDefineFunction extends Action implements GraphSourceItemContainer {
|
||||
|
||||
@@ -103,7 +104,7 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
StringBuilder paramStr = new StringBuilder();
|
||||
for (int i = 0; i < paramNames.size(); i++) {
|
||||
paramStr.append("\"").append(Helper.escapeString(paramNames.get(i))).append("\" ");
|
||||
@@ -113,7 +114,7 @@ public class ActionDefineFunction extends Action implements GraphSourceItemConta
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
List<String> oldParamNames = paramNames;
|
||||
if (replacedParamNames != null) {
|
||||
paramNames = replacedParamNames;
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
|
||||
@@ -76,7 +77,7 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
return "With {";
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActionDefineFunction2 extends Action implements GraphSourceItemContainer {
|
||||
|
||||
@@ -160,7 +161,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
public GraphTextWriter getASMSourceReplaced(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode, GraphTextWriter writer) {
|
||||
List<String> oldParamNames = paramNames;
|
||||
if (replacedParamNames != null) {
|
||||
paramNames = replacedParamNames;
|
||||
@@ -178,7 +179,7 @@ public class ActionDefineFunction2 extends Action implements GraphSourceItemCont
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
StringBuilder paramStr = new StringBuilder();
|
||||
for (int i = 0; i < paramNames.size(); i++) {
|
||||
paramStr.append(paramRegisters.get(i)).append(" \"").append(Helper.escapeString(paramNames.get(i))).append("\" ");
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
|
||||
@@ -149,7 +150,7 @@ public class ActionTry extends Action implements GraphSourceItemContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getASMSource(ActionList container, List<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
public String getASMSource(ActionList container, Set<Long> knownAddreses, ScriptExportMode exportMode) {
|
||||
StringBuilder ret = new StringBuilder();
|
||||
ret.append("Try ");
|
||||
if (catchBlockFlag) {
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.awt.geom.AffineTransform;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class Matrix {
|
||||
public final class Matrix implements Cloneable {
|
||||
|
||||
public double scaleX = 1;
|
||||
public double scaleY = 1;
|
||||
@@ -82,14 +82,12 @@ public class Matrix {
|
||||
|
||||
@Override
|
||||
public Matrix clone() {
|
||||
Matrix mat = new Matrix();
|
||||
mat.translateX = translateX;
|
||||
mat.translateY = translateY;
|
||||
mat.scaleX = scaleX;
|
||||
mat.scaleY = scaleY;
|
||||
mat.rotateSkew0 = rotateSkew0;
|
||||
mat.rotateSkew1 = rotateSkew1;
|
||||
return mat;
|
||||
try {
|
||||
Matrix mat = (Matrix) super.clone();
|
||||
return mat;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
public Point transform(double x, double y) {
|
||||
|
||||
@@ -833,7 +833,7 @@ public class DefineEditTextTag extends TextTag {
|
||||
if (font != null && font.hasLayout()) {
|
||||
int kerningAdjustment = 0;
|
||||
if (nextChar != null) {
|
||||
kerningAdjustment = font.getGlyphKerningAdjustment(ge.glyphIndex, font.charToGlyph(nextChar));
|
||||
kerningAdjustment = font.getCharKerningAdjustment(c, nextChar);
|
||||
kerningAdjustment /= font.getDivider();
|
||||
}
|
||||
advance = (int) Math.round(Math.round((double) lastStyle.fontHeight * (font.getGlyphAdvance(ge.glyphIndex) + kerningAdjustment) / (font.getDivider() * 1024.0)));
|
||||
|
||||
@@ -448,6 +448,11 @@ public class DefineFont2Tag extends FontTag {
|
||||
public int getGlyphKerningAdjustment(int glyphIndex, int nextGlyphIndex) {
|
||||
char c1 = glyphToChar(glyphIndex);
|
||||
char c2 = glyphToChar(nextGlyphIndex);
|
||||
return getCharKerningAdjustment(c1, c2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharKerningAdjustment(char c1, char c2) {
|
||||
int kerningAdjustment = 0;
|
||||
for (KERNINGRECORD ker : fontKerningTable) {
|
||||
if (ker.fontKerningCode1 == c1 && ker.fontKerningCode2 == c2) {
|
||||
|
||||
@@ -459,6 +459,11 @@ public class DefineFont3Tag extends FontTag {
|
||||
}
|
||||
char c1 = glyphToChar(glyphIndex);
|
||||
char c2 = glyphToChar(nextGlyphIndex);
|
||||
return getCharKerningAdjustment(c1, c2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharKerningAdjustment(char c1, char c2) {
|
||||
int kerningAdjustment = 0;
|
||||
for (KERNINGRECORD ker : fontKerningTable) {
|
||||
if (ker.fontKerningCode1 == c1 && ker.fontKerningCode2 == c2) {
|
||||
|
||||
@@ -339,4 +339,8 @@ public class DefineFontTag extends FontTag {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharKerningAdjustment(char c1, char c2) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag
|
||||
scr2 = new StyleChangeRecord();
|
||||
endIndex--;
|
||||
}
|
||||
StyleChangeRecord scr = (StyleChangeRecord) scr1.clone();
|
||||
StyleChangeRecord scr = scr1.clone();
|
||||
if (scr1.stateMoveTo || scr2.stateMoveTo) {
|
||||
scr.moveDeltaX = startPosX + (endPosX - startPosX) * ratio / 65535;
|
||||
scr.moveDeltaY = startPosY + (endPosY - startPosY) * ratio / 65535;
|
||||
|
||||
@@ -249,7 +249,7 @@ public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag {
|
||||
scr2 = new StyleChangeRecord();
|
||||
endIndex--;
|
||||
}
|
||||
StyleChangeRecord scr = (StyleChangeRecord) scr1.clone();
|
||||
StyleChangeRecord scr = scr1.clone();
|
||||
if (scr1.stateMoveTo || scr2.stateMoveTo) {
|
||||
scr.moveDeltaX = startPosX + (endPosX - startPosX) * ratio / MAX_RATIO;
|
||||
scr.moveDeltaY = startPosY + (endPosY - startPosY) * ratio / MAX_RATIO;
|
||||
|
||||
@@ -387,7 +387,7 @@ public class DefineText2Tag extends TextTag {
|
||||
if (font.hasLayout()) {
|
||||
int kerningAdjustment = 0;
|
||||
if (nextChar != null) {
|
||||
kerningAdjustment = font.getGlyphKerningAdjustment(tr.glyphEntries[i].glyphIndex, font.charToGlyph(nextChar));
|
||||
kerningAdjustment = font.getCharKerningAdjustment(c, nextChar);
|
||||
}
|
||||
advance = (int) Math.round(((double) textHeight * (font.getGlyphAdvance(tr.glyphEntries[i].glyphIndex) + kerningAdjustment)) / (font.getDivider() * 1024.0));
|
||||
} else {
|
||||
|
||||
@@ -393,7 +393,7 @@ public class DefineTextTag extends TextTag {
|
||||
if (font.hasLayout()) {
|
||||
int kerningAdjustment = 0;
|
||||
if (nextChar != null) {
|
||||
kerningAdjustment = font.getGlyphKerningAdjustment(tr.glyphEntries[i].glyphIndex, font.charToGlyph(nextChar));
|
||||
kerningAdjustment = font.getCharKerningAdjustment(c, nextChar);
|
||||
}
|
||||
advance = (int) Math.round(((double) textHeight * (font.getGlyphAdvance(tr.glyphEntries[i].glyphIndex) + kerningAdjustment)) / (font.getDivider() * 1024.0));
|
||||
} else {
|
||||
|
||||
@@ -75,6 +75,8 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
|
||||
|
||||
public abstract int getGlyphKerningAdjustment(int glyphIndex, int nextGlyphIndex);
|
||||
|
||||
public abstract int getCharKerningAdjustment(char c1, char c2);
|
||||
|
||||
public abstract int getGlyphWidth(int glyphIndex);
|
||||
|
||||
public abstract String getFontNameIntag();
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.tags.dynamictext;
|
||||
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
@@ -23,7 +24,7 @@ import com.jpexs.decompiler.flash.types.RGBA;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
*/
|
||||
public final class TextStyle implements Cloneable {
|
||||
|
||||
public FontTag font;
|
||||
|
||||
@@ -41,13 +42,11 @@ public class TextStyle {
|
||||
|
||||
@Override
|
||||
public TextStyle clone() {
|
||||
public TextStyle clone() {
|
||||
TextStyle result = new TextStyle();
|
||||
result.font = font;
|
||||
result.fontHeight = fontHeight;
|
||||
result.bold = bold;
|
||||
result.italic = italic;
|
||||
result.underlined = underlined;
|
||||
result.textColor = textColor;
|
||||
try {
|
||||
TextStyle result = (TextStyle) super.clone();
|
||||
return result;
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StyleChangeRecord;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.MemoryInputStream;
|
||||
import java.awt.Font;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -224,10 +223,15 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag {
|
||||
|
||||
@Override
|
||||
public int getGlyphKerningAdjustment(int glyphIndex, int nextGlyphIndex) {
|
||||
int char1 = glyphToChar(glyphIndex);
|
||||
int char2 = glyphToChar(nextGlyphIndex);
|
||||
char c1 = glyphToChar(glyphIndex);
|
||||
char c2 = glyphToChar(nextGlyphIndex);
|
||||
return getCharKerningAdjustment(c1, c2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharKerningAdjustment(char c1, char c2) {
|
||||
for (KerningPairType kp : fonts.get(0).kerning) {
|
||||
if (kp.char1 == char1 && kp.char2 == char2) {
|
||||
if (kp.char1 == c1 && kp.char2 == c2) {
|
||||
return resize(kp.advance);
|
||||
}
|
||||
}
|
||||
@@ -335,7 +339,7 @@ public final class DefineCompactedFont extends FontTag implements DrawableTag {
|
||||
ret.numLineBits = 0;
|
||||
List<SHAPERECORD> recs = new ArrayList<>();
|
||||
for (SHAPERECORD r : shp.shapeRecords) {
|
||||
SHAPERECORD c = Helper.deepCopy(r);
|
||||
SHAPERECORD c = r.clone();
|
||||
if (c instanceof StyleChangeRecord) {
|
||||
StyleChangeRecord scr = (StyleChangeRecord) c;
|
||||
scr.moveDeltaX = resize(scr.moveDeltaX);
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.annotations.Calculated;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
|
||||
/**
|
||||
* Defines a transform that can be applied to the color space of a graphic
|
||||
@@ -25,7 +25,7 @@ import java.io.Serializable;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
*/
|
||||
public class CXFORM extends ColorTransform {
|
||||
|
||||
/**
|
||||
* Has color addition values
|
||||
@@ -99,4 +99,18 @@ public class CXFORM extends ColorTransform implements Serializable {
|
||||
return hasMultTerms ? blueMultTerm : super.getBlueMulti();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CXFORM clone() {
|
||||
CXFORM ret = (CXFORM) super.clone();
|
||||
ret.hasAddTerms = hasAddTerms;
|
||||
ret.hasMultTerms = hasMultTerms;
|
||||
ret.nbits = nbits;
|
||||
ret.redMultTerm = redMultTerm;
|
||||
ret.greenMultTerm = greenMultTerm;
|
||||
ret.blueMultTerm = blueMultTerm;
|
||||
ret.redAddTerm = redAddTerm;
|
||||
ret.greenAddTerm = greenAddTerm;
|
||||
ret.blueAddTerm = blueAddTerm;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.annotations.Calculated;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
|
||||
/**
|
||||
* Defines a transform that can be applied to the color space of a graphic
|
||||
@@ -26,7 +26,7 @@ import java.io.Serializable;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
*/
|
||||
public class CXFORMWITHALPHA extends ColorTransform {
|
||||
|
||||
/**
|
||||
* Has color addition values
|
||||
@@ -129,4 +129,20 @@ public class CXFORMWITHALPHA extends ColorTransform implements Serializable {
|
||||
return hasMultTerms ? alphaMultTerm : super.getAlphaMulti();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CXFORMWITHALPHA clone() {
|
||||
CXFORMWITHALPHA ret = (CXFORMWITHALPHA) super.clone();
|
||||
ret.hasAddTerms = hasAddTerms;
|
||||
ret.hasMultTerms = hasMultTerms;
|
||||
ret.nbits = nbits;
|
||||
ret.redMultTerm = redMultTerm;
|
||||
ret.greenMultTerm = greenMultTerm;
|
||||
ret.blueMultTerm = blueMultTerm;
|
||||
ret.alphaMultTerm = alphaMultTerm;
|
||||
ret.redAddTerm = redAddTerm;
|
||||
ret.greenAddTerm = greenAddTerm;
|
||||
ret.blueAddTerm = blueAddTerm;
|
||||
ret.alphaAddTerm = alphaAddTerm;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,21 +12,20 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.filters.Filtering;
|
||||
import com.jpexs.decompiler.flash.types.filters.Filtering;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
import java.awt.image.RescaleOp;
|
||||
import java.awt.image.RescaleOp;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
*/
|
||||
public class ColorTransform implements Cloneable {
|
||||
|
||||
public RescaleOp toRescaleOp() {
|
||||
return new RescaleOp(new float[]{getRedMulti() / 255f, getGreenMulti() / 255f, getBlueMulti() / 255f, getAlphaMulti() / 255f},
|
||||
@@ -56,9 +55,14 @@ public class ColorTransform implements Serializable {
|
||||
}
|
||||
|
||||
public GRADRECORD[] apply(GRADRECORD[] gradRecords) {
|
||||
public GRADRECORD[] apply(GRADRECORD[] gradRecords) {
|
||||
GRADRECORD[] ret = Helper.deepCopy(gradRecords);
|
||||
for (GRADRECORD r : ret) {
|
||||
GRADRECORD[] ret = new GRADRECORD[gradRecords.length];
|
||||
for (int i = 0; i < gradRecords.length; i++) {
|
||||
GRADRECORD r = gradRecords[i];
|
||||
GRADRECORD r2 = new GRADRECORD();
|
||||
r2.inShape3 = r.inShape3;
|
||||
r2.ratio = r.ratio;
|
||||
r2.color = apply(r.color);
|
||||
ret[i] = r2;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -147,4 +151,12 @@ public class ColorTransform implements Serializable {
|
||||
+ ", redMulti=" + getRedMulti() + ", greenMulti=" + getGreenMulti() + ", blueMulti=" + getBlueMulti() + ", alphaMulti=" + getAlphaMulti() + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ColorTransform clone() {
|
||||
try {
|
||||
return (ColorTransform) super.clone();
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
*/
|
||||
public class GRADRECORD {
|
||||
|
||||
@SWFType(BasicType.UI8)
|
||||
public int ratio;
|
||||
|
||||
@@ -41,8 +41,9 @@ public class ContourType implements Serializable {
|
||||
int i = 0;
|
||||
int divider = 1;
|
||||
for (; i < records.size(); i++) {
|
||||
if (records.get(i) instanceof StyleChangeRecord) {
|
||||
StyleChangeRecord scr = (StyleChangeRecord) records.get(i);
|
||||
SHAPERECORD rec = records.get(i);
|
||||
if (rec instanceof StyleChangeRecord) {
|
||||
StyleChangeRecord scr = (StyleChangeRecord) rec;
|
||||
if (scr.stateMoveTo) {
|
||||
moveToX = scr.moveDeltaX / divider;
|
||||
moveToY = scr.moveDeltaY / divider;
|
||||
|
||||
@@ -12,17 +12,15 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types.gfx;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.CurvedEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import com.jpexs.decompiler.flash.types.shaperecords.StraightEdgeRecord;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.io.Serializable;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -52,54 +50,28 @@ public class EdgeType implements Serializable {
|
||||
private static final int Edge_Line = 2;
|
||||
private static final int Edge_Quad = 3;
|
||||
public int data[];
|
||||
public int data[];
|
||||
|
||||
public EdgeType(boolean vertical, int v) {
|
||||
data = new int[]{vertical ? Edge_VLine : Edge_HLine, v};
|
||||
data = new int[]{vertical ? Edge_VLine : Edge_HLine, v};
|
||||
}
|
||||
|
||||
public EdgeType(int x, int y) {
|
||||
data = new int[]{Edge_Line, x, y};
|
||||
data = new int[]{Edge_Line, x, y};
|
||||
}
|
||||
|
||||
public EdgeType(int cx, int cy, int ax, int ay) {
|
||||
data = new int[]{Edge_Quad, cx, cy, ax, ay};
|
||||
data = new int[]{Edge_Quad, cx, cy, ax, ay};
|
||||
calcRaw();
|
||||
}
|
||||
|
||||
private void calcRaw() {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
GFxOutputStream sos = new GFxOutputStream(baos);
|
||||
try {
|
||||
write(sos);
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(EdgeType.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String toString() {
|
||||
String ret = "[Edge data:";
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (i > 0) {
|
||||
ret += ", ";
|
||||
}
|
||||
ret += "" + data[i];
|
||||
}
|
||||
}
|
||||
ret += " raw: 0x";
|
||||
for (int i = 0; i < raw.length; i++) {
|
||||
if (i > 0) {
|
||||
ret += "";
|
||||
}
|
||||
String h = Integer.toHexString(raw[i] & 0xff);
|
||||
if (h.length() < 2) {
|
||||
h = "0" + h;
|
||||
}
|
||||
ret += "" + h;
|
||||
ret += "]";
|
||||
return ret;
|
||||
}
|
||||
@@ -118,19 +90,6 @@ public class EdgeType implements Serializable {
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
private byte[] readRawEdge(GFxInputStream sis) throws IOException {
|
||||
int firstByte = sis.readUI8("firstByte");
|
||||
int nb = sizes[firstByte & 0xF];
|
||||
byte ret[] = new byte[1 + nb];
|
||||
ret[0] = (byte) firstByte;
|
||||
int i;
|
||||
for (i = 0; i < nb; i++) {
|
||||
ret[i + 1] = (byte) sis.readUI8("byte");
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
private static int SInt8(int val) {
|
||||
/*boolean sign = (val & 0x80) == 0x80;
|
||||
val = val & 0x7F;
|
||||
@@ -144,7 +103,7 @@ public class EdgeType implements Serializable {
|
||||
public SHAPERECORD toSHAPERECORD() {
|
||||
int multiplier = 1;
|
||||
StraightEdgeRecord ser;
|
||||
StraightEdgeRecord ser;
|
||||
CurvedEdgeRecord cer;
|
||||
switch (data[0]) {
|
||||
case Edge_HLine:
|
||||
ser = new StraightEdgeRecord();
|
||||
@@ -179,116 +138,163 @@ public class EdgeType implements Serializable {
|
||||
}
|
||||
|
||||
private int[] readEdge(GFxInputStream sis) throws IOException {
|
||||
private int[] readEdge(GFxInputStream sis) throws IOException {
|
||||
byte firstByte = (byte) sis.readUI8("firstByte");
|
||||
int nb = sizes[firstByte & 0xF];
|
||||
byte raw1, raw2, raw3, raw4, raw5, raw6, raw7, raw8, raw9;
|
||||
raw1 = (byte) sis.readUI8("byte1");
|
||||
int data[] = new int[5];
|
||||
|
||||
|
||||
switch (firstByte & 0xF) {
|
||||
case Edge_H12:
|
||||
data[0] = Edge_HLine;
|
||||
data[0] = Edge_HLine;
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8(raw1 & 0xff) << 4);
|
||||
break;
|
||||
|
||||
case Edge_H20:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
data[0] = Edge_HLine;
|
||||
data[0] = Edge_HLine;
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8(raw2 & 0xff) << 12);
|
||||
break;
|
||||
|
||||
case Edge_V12:
|
||||
data[0] = Edge_VLine;
|
||||
data[0] = Edge_VLine;
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8(raw1 & 0xff) << 4);
|
||||
break;
|
||||
|
||||
case Edge_V20:
|
||||
data[0] = Edge_VLine;
|
||||
data[0] = Edge_VLine;
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8(raw2 & 0xff) << 12);
|
||||
break;
|
||||
|
||||
case Edge_L6:
|
||||
data[0] = Edge_Line;
|
||||
data[0] = Edge_Line;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 6) >> 2);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8((raw1 & 0xff) << 6) >> 2);
|
||||
data[2] = SInt8(raw1 & 0xff) >> 2;
|
||||
break;
|
||||
|
||||
case Edge_L10:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
data[0] = Edge_Line;
|
||||
data[0] = Edge_Line;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 2) << 2);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8((raw1 & 0xff) << 2) << 2);
|
||||
data[2] = ((raw1 & 0xff) >> 6) | (SInt8((raw2 & 0xff)) << 2);
|
||||
break;
|
||||
|
||||
case Edge_L14:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
data[0] = Edge_Line;
|
||||
data[0] = Edge_Line;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 6) << 6);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8((raw2 & 0xff) << 6) << 6);
|
||||
data[2] = ((raw2 & 0xff) >> 2) | (SInt8((raw3 & 0xff)) << 6);
|
||||
break;
|
||||
|
||||
case Edge_L18:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
raw4 = (byte) sis.readUI8("byte4");
|
||||
data[0] = Edge_Line;
|
||||
data[0] = Edge_Line;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 2) << 10);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8((raw2 & 0xff) << 2) << 10);
|
||||
data[2] = ((raw2 & 0xff) >> 6) | ((raw3 & 0xff) << 2) | (SInt8((raw4 & 0xff)) << 10);
|
||||
break;
|
||||
|
||||
case Edge_C5:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 7) >> 3);
|
||||
data[2] = SInt8((raw[1] & 0xff) << 2) >> 3;
|
||||
data[3] = ((raw[1] & 0xff) >> 6) | (SInt8((raw[2] & 0xff) << 5) >> 3);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8((raw1 & 0xff) << 7) >> 3);
|
||||
data[2] = SInt8((raw1 & 0xff) << 2) >> 3;
|
||||
data[3] = ((raw1 & 0xff) >> 6) | (SInt8((raw2 & 0xff) << 5) >> 3);
|
||||
data[4] = SInt8((raw2 & 0xff)) >> 3;
|
||||
break;
|
||||
|
||||
case Edge_C7:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 5) >> 1);
|
||||
data[2] = ((raw[1] & 0xff) >> 3) | (SInt8((raw[2] & 0xff) << 6) >> 1);
|
||||
data[3] = ((raw[2] & 0xff) >> 2) | (SInt8((raw[3] & 0xff) << 7) >> 1);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8((raw1 & 0xff) << 5) >> 1);
|
||||
data[2] = ((raw1 & 0xff) >> 3) | (SInt8((raw2 & 0xff) << 6) >> 1);
|
||||
data[3] = ((raw2 & 0xff) >> 2) | (SInt8((raw3 & 0xff) << 7) >> 1);
|
||||
data[4] = SInt8(raw3) >> 1;
|
||||
break;
|
||||
|
||||
case Edge_C9:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
raw4 = (byte) sis.readUI8("byte4");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 3) << 1);
|
||||
data[2] = ((raw[1] & 0xff) >> 5) | (SInt8((raw[2] & 0xff) << 2) << 1);
|
||||
data[3] = ((raw[2] & 0xff) >> 6) | (SInt8((raw[3] & 0xff) << 1) << 1);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8((raw1 & 0xff) << 3) << 1);
|
||||
data[2] = ((raw1 & 0xff) >> 5) | (SInt8((raw2 & 0xff) << 2) << 1);
|
||||
data[3] = ((raw2 & 0xff) >> 6) | (SInt8((raw3 & 0xff) << 1) << 1);
|
||||
data[4] = ((raw3 & 0xff) >> 7) | (SInt8(raw4 & 0xff) << 1);
|
||||
break;
|
||||
|
||||
case Edge_C11:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
raw4 = (byte) sis.readUI8("byte4");
|
||||
raw5 = (byte) sis.readUI8("byte5");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | (SInt8((raw[1] & 0xff) << 1) << 3);
|
||||
data[2] = (raw[1] >> 7) | ((raw[2] & 0xff) << 1) | (SInt8((raw[3] & 0xff) << 6) << 3);
|
||||
data[3] = ((raw[3] & 0xff) >> 2) | (SInt8((raw[4] & 0xff) << 3) << 3);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | (SInt8((raw1 & 0xff) << 1) << 3);
|
||||
data[2] = (raw1 >> 7) | ((raw2 & 0xff) << 1) | (SInt8((raw3 & 0xff) << 6) << 3);
|
||||
data[3] = ((raw3 & 0xff) >> 2) | (SInt8((raw4 & 0xff) << 3) << 3);
|
||||
data[4] = ((raw4 & 0xff) >> 5) | (SInt8(raw5 & 0xff) << 3);
|
||||
break;
|
||||
|
||||
case Edge_C13:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
raw4 = (byte) sis.readUI8("byte4");
|
||||
raw5 = (byte) sis.readUI8("byte5");
|
||||
raw6 = (byte) sis.readUI8("byte6");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 7) << 5);
|
||||
data[2] = ((raw[2] & 0xff) >> 1) | (SInt8((raw[3] & 0xff) << 2) << 5);
|
||||
data[3] = ((raw[3] & 0xff) >> 6) | ((raw[4] & 0xff) << 2) | (SInt8((raw[5] & 0xff) << 5) << 5);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8((raw2 & 0xff) << 7) << 5);
|
||||
data[2] = ((raw2 & 0xff) >> 1) | (SInt8((raw3 & 0xff) << 2) << 5);
|
||||
data[3] = ((raw3 & 0xff) >> 6) | ((raw4 & 0xff) << 2) | (SInt8((raw5 & 0xff) << 5) << 5);
|
||||
data[4] = ((raw5 & 0xff) >> 3) | (SInt8(raw6 & 0xff) << 5);
|
||||
break;
|
||||
|
||||
case Edge_C15:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
raw4 = (byte) sis.readUI8("byte4");
|
||||
raw5 = (byte) sis.readUI8("byte5");
|
||||
raw6 = (byte) sis.readUI8("byte6");
|
||||
raw7 = (byte) sis.readUI8("byte7");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 5) << 7);
|
||||
data[2] = ((raw[2] & 0xff) >> 3) | ((raw[3] & 0xff) << 5) | (SInt8((raw[4] & 0xff) << 6) << 7);
|
||||
data[3] = ((raw[4] & 0xff) >> 2) | ((raw[5] & 0xff) << 6) | (SInt8((raw[6] & 0xff) << 7) << 7);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8((raw2 & 0xff) << 5) << 7);
|
||||
data[2] = ((raw2 & 0xff) >> 3) | ((raw3 & 0xff) << 5) | (SInt8((raw4 & 0xff) << 6) << 7);
|
||||
data[3] = ((raw4 & 0xff) >> 2) | ((raw5 & 0xff) << 6) | (SInt8((raw6 & 0xff) << 7) << 7);
|
||||
data[4] = ((raw6 & 0xff) >> 1) | (SInt8((raw7 & 0xff)) << 7);
|
||||
break;
|
||||
|
||||
case Edge_C17:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
raw4 = (byte) sis.readUI8("byte4");
|
||||
raw5 = (byte) sis.readUI8("byte5");
|
||||
raw6 = (byte) sis.readUI8("byte6");
|
||||
raw7 = (byte) sis.readUI8("byte7");
|
||||
raw8 = (byte) sis.readUI8("byte8");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8((raw[2] & 0xff) << 3) << 9);
|
||||
data[2] = ((raw[2] & 0xff) >> 5) | ((raw[3] & 0xff) << 3) | (SInt8((raw[4] & 0xff) << 2) << 9);
|
||||
data[3] = ((raw[4] & 0xff) >> 6) | ((raw[5] & 0xff) << 2) | (SInt8((raw[6] & 0xff) << 1) << 9);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8((raw2 & 0xff) << 3) << 9);
|
||||
data[2] = ((raw2 & 0xff) >> 5) | ((raw3 & 0xff) << 3) | (SInt8((raw4 & 0xff) << 2) << 9);
|
||||
data[3] = ((raw4 & 0xff) >> 6) | ((raw5 & 0xff) << 2) | (SInt8((raw6 & 0xff) << 1) << 9);
|
||||
data[4] = ((raw6 & 0xff) >> 7) | ((raw7 & 0xff) << 1) | (SInt8(raw8 & 0xff) << 9);
|
||||
break;
|
||||
|
||||
case Edge_C19:
|
||||
raw2 = (byte) sis.readUI8("byte2");
|
||||
raw3 = (byte) sis.readUI8("byte3");
|
||||
raw4 = (byte) sis.readUI8("byte4");
|
||||
raw5 = (byte) sis.readUI8("byte5");
|
||||
raw6 = (byte) sis.readUI8("byte6");
|
||||
raw7 = (byte) sis.readUI8("byte7");
|
||||
raw8 = (byte) sis.readUI8("byte8");
|
||||
raw9 = (byte) sis.readUI8("byte9");
|
||||
data[0] = Edge_Quad;
|
||||
data[0] = Edge_Quad;
|
||||
data[1] = ((raw[0] & 0xff) >> 4) | ((raw[1] & 0xff) << 4) | (SInt8(raw[2] << 1) << 11);
|
||||
data[2] = ((raw[2] & 0xff) >> 7) | ((raw[3] & 0xff) << 1) | ((raw[4] & 0xff) << 9) | (SInt8(raw[5] << 6) << 11);
|
||||
data[3] = ((raw[5] & 0xff) >> 2) | ((raw[6] & 0xff) << 6) | (SInt8(raw[7] << 3) << 11);
|
||||
data[1] = ((firstByte & 0xff) >> 4) | ((raw1 & 0xff) << 4) | (SInt8(raw2 << 1) << 11);
|
||||
data[2] = ((raw2 & 0xff) >> 7) | ((raw3 & 0xff) << 1) | ((raw4 & 0xff) << 9) | (SInt8(raw5 << 6) << 11);
|
||||
data[3] = ((raw5 & 0xff) >> 2) | ((raw6 & 0xff) << 6) | (SInt8(raw7 << 3) << 11);
|
||||
data[4] = ((raw7 & 0xff) >> 5) | ((raw8 & 0xff) << 3) | (SInt8(raw9) << 11);
|
||||
break;
|
||||
}
|
||||
return data;
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types.shaperecords;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.RGB;
|
||||
import com.jpexs.decompiler.flash.types.RGBA;
|
||||
import com.jpexs.decompiler.flash.types.SHAPE;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
@@ -423,7 +422,7 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali
|
||||
ret.numLineBits = shp.numLineBits;
|
||||
List<SHAPERECORD> recs = new ArrayList<>();
|
||||
for (SHAPERECORD r : shp.shapeRecords) {
|
||||
SHAPERECORD c = Helper.deepCopy(r);
|
||||
SHAPERECORD c = r.clone();
|
||||
if (c instanceof StyleChangeRecord) {
|
||||
StyleChangeRecord scr = (StyleChangeRecord) c;
|
||||
scr.moveDeltaX = (int) (multiplier * scr.moveDeltaX);
|
||||
@@ -465,4 +464,13 @@ public abstract class SHAPERECORD implements Cloneable, NeedsCharacters, Seriali
|
||||
s = AffineTransform.getTranslateInstance(-dx / SWF.unitDivisor, -dy / SWF.unitDivisor).createTransformedShape(s);
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SHAPERECORD clone() {
|
||||
try {
|
||||
return (SHAPERECORD) super.clone();
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library.
|
||||
* License along with this library.
|
||||
*/
|
||||
package com.jpexs.decompiler.flash.types.shaperecords;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWFOutputStream;
|
||||
@@ -23,14 +24,12 @@ import com.jpexs.decompiler.flash.types.annotations.Calculated;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Conditional;
|
||||
import com.jpexs.decompiler.flash.types.annotations.SWFType;
|
||||
import java.util.Set;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
*/
|
||||
public final class StyleChangeRecord extends SHAPERECORD implements Cloneable {
|
||||
|
||||
public boolean typeFlag = false;
|
||||
public boolean stateNewStyles;
|
||||
@@ -127,13 +126,8 @@ public class StyleChangeRecord extends SHAPERECORD implements Cloneable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException ex) {
|
||||
Logger.getLogger(StyleChangeRecord.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
public StyleChangeRecord clone() {
|
||||
return (StyleChangeRecord) super.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user