diff --git a/trunk/src/com/jpexs/decompiler/flash/SWF.java b/trunk/src/com/jpexs/decompiler/flash/SWF.java index 014e09fec..f02cfbfcb 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWF.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWF.java @@ -2130,7 +2130,7 @@ public final class SWF implements TreeItem { } public static SerializableImage frameToImage(int containerId, int frame, List allTags, List controlTags, RECT displayRect, int totalFrameCount, Stack visited, Matrix transformation) { - String key = "frame_" + frame + "_" + containerId; + String key = "frame_" + frame + "_" + containerId + "_" + allTags.get(0).getSwf().hashCode(); if (frameCache.contains(key)) { SerializableImage ciret = ((SerializableImage) frameCache.get(key)); return ciret; diff --git a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java index aa2262dcf..c2fcd20d8 100644 --- a/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/trunk/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -835,6 +835,7 @@ public class SWFInputStream extends InputStream { * @param parallel * @param skipUnusualTags * @param parseTags + * @param gfx * @return List of tags * @throws IOException * @throws java.lang.InterruptedException @@ -1241,6 +1242,7 @@ public class SWFInputStream extends InputStream { * @param resolve * @param parallel * @param skipUnusualTags + * @param gfx * @return Tag or null when End tag * @throws IOException * @throws java.lang.InterruptedException diff --git a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java index f8721abcf..b07966630 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/model/FunctionActionItem.java @@ -21,10 +21,8 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.parser.script.ActionSourceGenerator; import com.jpexs.decompiler.flash.action.parser.script.VariableActionItem; -import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionDefineFunction; -import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.graph.Graph; @@ -35,11 +33,9 @@ import com.jpexs.decompiler.graph.SourceGenerator; import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.helpers.Helper; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Set; -import java.util.TreeSet; public class FunctionActionItem extends ActionItem { diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java index 0960bfc20..ef9ca9a25 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/ActionScriptParser.java @@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.action.model.CharToAsciiActionItem; import com.jpexs.decompiler.flash.action.model.CloneSpriteActionItem; import com.jpexs.decompiler.flash.action.model.ConstantPool; import com.jpexs.decompiler.flash.action.model.DefineLocalActionItem; -import com.jpexs.decompiler.flash.action.model.DefineRegisterActionItem; import com.jpexs.decompiler.flash.action.model.DeleteActionItem; import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.model.EvalActionItem; @@ -67,7 +66,6 @@ import com.jpexs.decompiler.flash.action.model.StartDragActionItem; import com.jpexs.decompiler.flash.action.model.StopActionItem; import com.jpexs.decompiler.flash.action.model.StopAllSoundsActionItem; import com.jpexs.decompiler.flash.action.model.StopDragActionItem; -import com.jpexs.decompiler.flash.action.model.StoreRegisterActionItem; import com.jpexs.decompiler.flash.action.model.StringExtractActionItem; import com.jpexs.decompiler.flash.action.model.StringLengthActionItem; import com.jpexs.decompiler.flash.action.model.ThrowActionItem; diff --git a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java index 379a092a3..30924da2d 100644 --- a/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java +++ b/trunk/src/com/jpexs/decompiler/flash/action/parser/script/VariableActionItem.java @@ -35,9 +35,9 @@ public class VariableActionItem extends ActionItem { private ActionItem it; - private String variableName; + private final String variableName; private GraphTargetItem storeValue; - private boolean definition; + private final boolean definition; public void setStoreValue(GraphTargetItem storeValue) { this.storeValue = storeValue; diff --git a/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java b/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java index 5945f0dc3..6b0f1ce1c 100644 --- a/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java +++ b/trunk/src/com/jpexs/decompiler/flash/exporters/Matrix.java @@ -38,6 +38,12 @@ public class Matrix { return mat; } + public static Matrix getTranslateInstance(double x, double y) { + Matrix mat = new Matrix(); + mat.translate(x, y); + return mat; + } + public Matrix() { scaleX = 1; scaleY = 1; diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java index 48aed6bbc..b231a0c5f 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineEditTextTag.java @@ -668,7 +668,7 @@ public class DefineEditTextTag extends TextTag implements DrawableTag { tr.glyphEntries[i].glyphAdvance = advance; } textRecords.add(tr); - staticTextToImage(swf, characters, textRecords, bounds, 1, image, transformation); + staticTextToImage(swf, characters, textRecords, bounds, 1, image, getTextMatrix(), transformation); } } diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java index 4fbe5449e..9fe5378d4 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineText2Tag.java @@ -498,7 +498,7 @@ public class DefineText2Tag extends TextTag implements DrawableTag { @Override public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { - staticTextToImage(swf, characters, textRecords, textBounds, 2, image, transformation); + staticTextToImage(swf, characters, textRecords, textBounds, 2, image, getTextMatrix(), transformation); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java index 397c58416..4b11db6c6 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/DefineTextTag.java @@ -514,7 +514,7 @@ public class DefineTextTag extends TextTag implements DrawableTag { @Override public void toImage(int frame, List tags, Map characters, Stack visited, SerializableImage image, Matrix transformation) { - staticTextToImage(swf, characters, textRecords, textBounds, 1, image, transformation); + staticTextToImage(swf, characters, textRecords, textBounds, 1, image, getTextMatrix(), transformation); } @Override diff --git a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java index 7d0a94f8e..c04591283 100644 --- a/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java +++ b/trunk/src/com/jpexs/decompiler/flash/tags/base/TextTag.java @@ -192,7 +192,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag { return att; } - public static void staticTextToImage(SWF swf, Map characters, List textRecords, RECT textBounds, int numText, SerializableImage image, Matrix transformation) { + public static void staticTextToImage(SWF swf, Map characters, List textRecords, RECT textBounds, int numText, SerializableImage image, MATRIX textMatrix, Matrix transformation) { Color textColor = new Color(0, 0, 0); FontTag font = null; int textHeight = 12; @@ -223,15 +223,18 @@ public abstract class TextTag extends CharacterTag implements BoundedTag { y = rec.yOffset; } - Matrix mat = transformation.clone(); double rat = textHeight / 1024.0 / font.getDivider(); - mat = mat.preConcatenate(Matrix.getScaleInstance(rat)); - mat.translate(x - textBounds.Xmin, y - textBounds.Ymin); + for (GLYPHENTRY entry : rec.glyphEntries) { + Matrix mat = transformation.clone(); + mat = mat.concatenate(new Matrix(textMatrix)); + Matrix matTr = Matrix.getTranslateInstance(x, y); + mat = mat.concatenate(matTr); + mat = mat.concatenate(Matrix.getScaleInstance(rat)); // shapeNum: 1 SHAPE shape = glyphs.get(entry.glyphIndex); BitmapExporter.exportTo(swf, shape, textColor, image, mat); - mat.translate(entry.glyphAdvance, 0); + x += entry.glyphAdvance; } } } diff --git a/trunk/src/com/jpexs/helpers/SerializableImage.java b/trunk/src/com/jpexs/helpers/SerializableImage.java index d1a795153..2f4972293 100644 --- a/trunk/src/com/jpexs/helpers/SerializableImage.java +++ b/trunk/src/com/jpexs/helpers/SerializableImage.java @@ -71,8 +71,8 @@ public class SerializableImage implements Serializable { public BufferedImage getBufferedImage() { /*try { ImageIO.write(image, "png", new File("c:\\10\\x\\imageid" + String.format("%03d", imageid++) + ".png")); - } catch (IOException ex) { - }*/ + } catch (IOException ex) { + }*/ return image; }