mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-15 15:21:54 +00:00
tag bounds fixed
This commit is contained in:
@@ -75,6 +75,8 @@ import com.jpexs.decompiler.flash.helpers.collections.MyEntry;
|
||||
import com.jpexs.decompiler.flash.helpers.hilight.Highlighting;
|
||||
import com.jpexs.decompiler.flash.tags.ABCContainerTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineBinaryDataTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineButton2Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineButtonTag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineSpriteTag;
|
||||
import com.jpexs.decompiler.flash.tags.DoInitActionTag;
|
||||
import com.jpexs.decompiler.flash.tags.EndTag;
|
||||
@@ -1030,6 +1032,11 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
return uniqueAS3Packs(packs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return displayRect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
return displayRect;
|
||||
@@ -2304,6 +2311,9 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
|
||||
public void clearImageCache() {
|
||||
frameCache.clear();
|
||||
DefineSpriteTag.clearCache();
|
||||
DefineButtonTag.clearCache();
|
||||
DefineButton2Tag.clearCache();
|
||||
for (Tag tag : tags) {
|
||||
if (tag instanceof ImageTag) {
|
||||
((ImageTag) tag).clearCache();
|
||||
@@ -2355,6 +2365,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
if (actions == null) {
|
||||
actions = src.getActions();
|
||||
}
|
||||
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), true);
|
||||
Action.actionsToSource(src, actions, src.toString()/*FIXME?*/, writer);
|
||||
List<Highlighting> hilights = writer.instructionHilights;
|
||||
@@ -2694,7 +2705,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
|
||||
String assetName;
|
||||
Tag drawableTag = (Tag) drawable;
|
||||
RECT boundRect = drawable.getRect(new HashSet<BoundedTag>());
|
||||
RECT boundRect = drawable.getRect();
|
||||
if (exporter.exportedTags.containsKey(drawableTag)) {
|
||||
assetName = exporter.exportedTags.get(drawableTag);
|
||||
} else {
|
||||
@@ -2858,7 +2869,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
}
|
||||
}
|
||||
|
||||
RECT boundRect = drawable.getRect(new HashSet<BoundedTag>());
|
||||
RECT boundRect = drawable.getRect();
|
||||
ExportRectangle rect = new ExportRectangle(boundRect);
|
||||
rect = mat.transform(rect);
|
||||
Matrix m = mat.clone();
|
||||
@@ -3006,7 +3017,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
BoundedTag b = (BoundedTag) character;
|
||||
g.setPaint(new Color(255, 255, 255, 128));
|
||||
g.setComposite(BlendComposite.Invert);
|
||||
RECT r = b.getRect(new HashSet<BoundedTag>());
|
||||
RECT r = b.getRect();
|
||||
int div = (int) unzoom;
|
||||
g.drawString(character.toString(), r.Xmin / div + 3, r.Ymin / div + 15);
|
||||
g.draw(new Rectangle(r.Xmin / div, r.Ymin / div, r.getWidth() / div, r.getHeight() / div));
|
||||
|
||||
@@ -702,7 +702,13 @@ public class ABC {
|
||||
if (methodInfo == -1) {
|
||||
return -1;
|
||||
}
|
||||
return getBodyIdxFromMethodIdx().get(methodInfo);
|
||||
|
||||
Integer result = getBodyIdxFromMethodIdx().get(methodInfo);
|
||||
if (result == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public MethodBody findBodyByClassAndName(String className, String methodName) {
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.exporters;
|
||||
|
||||
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
|
||||
@@ -26,7 +27,6 @@ import com.jpexs.decompiler.flash.exporters.morphshape.CanvasMorphShapeExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.MorphShapeExportSettings;
|
||||
import com.jpexs.decompiler.flash.tags.DefineMorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
|
||||
@@ -79,7 +79,7 @@ public class MorphShapeExporter {
|
||||
switch (settings.mode) {
|
||||
case SVG:
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
ExportRectangle rect = new ExportRectangle(mst.getRect());
|
||||
rect.xMax *= settings.zoom;
|
||||
rect.yMax *= settings.zoom;
|
||||
rect.xMin *= settings.zoom;
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.exporters;
|
||||
|
||||
import com.jpexs.decompiler.flash.AbortRetryIgnoreHandler;
|
||||
@@ -28,7 +29,6 @@ import com.jpexs.decompiler.flash.exporters.shape.CanvasShapeExporter;
|
||||
import com.jpexs.decompiler.flash.helpers.BMPFile;
|
||||
import com.jpexs.decompiler.flash.helpers.ImageHelper;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
|
||||
@@ -91,7 +91,7 @@ public class ShapeExporter {
|
||||
switch (settings.mode) {
|
||||
case SVG:
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
ExportRectangle rect = new ExportRectangle(st.getRect());
|
||||
rect.xMax *= settings.zoom;
|
||||
rect.yMax *= settings.zoom;
|
||||
rect.xMin *= settings.zoom;
|
||||
@@ -103,7 +103,7 @@ public class ShapeExporter {
|
||||
break;
|
||||
case PNG:
|
||||
case BMP:
|
||||
case BMP:
|
||||
RECT rect = st.getRect();
|
||||
int newWidth = (int) (rect.getWidth() * settings.zoom / SWF.unitDivisor);
|
||||
int newHeight = (int) (rect.getHeight() * settings.zoom / SWF.unitDivisor);
|
||||
SerializableImage img = new SerializableImage(newWidth, newHeight, SerializableImage.TYPE_INT_ARGB);
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.jpexs.decompiler.flash.exporters.commonshape.SVGExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.modes.TextExportMode;
|
||||
import com.jpexs.decompiler.flash.exporters.settings.TextExportSettings;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.TextTag;
|
||||
import com.jpexs.decompiler.flash.types.CXFORMWITHALPHA;
|
||||
import com.jpexs.helpers.Helper;
|
||||
@@ -35,7 +34,6 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -73,7 +71,7 @@ public class TextExporter {
|
||||
@Override
|
||||
public void run() throws IOException {
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
ExportRectangle rect = new ExportRectangle(textTag.getRect(new HashSet<BoundedTag>()));
|
||||
ExportRectangle rect = new ExportRectangle(textTag.getRect());
|
||||
SVGExporter exporter = new SVGExporter(rect);
|
||||
textTag.toSVG(exporter, -2, new CXFORMWITHALPHA(), 0, settings.zoom);
|
||||
fos.write(Utf8Helper.getBytes(exporter.getSVG()));
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.importers;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
@@ -23,14 +24,12 @@ import com.jpexs.decompiler.flash.tags.DefineShape3Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineShape4Tag;
|
||||
import com.jpexs.decompiler.flash.tags.DefineShapeTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ShapeTag;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -53,7 +52,7 @@ public class ShapeImporter {
|
||||
swf.tags.add(jpeg2Tag);
|
||||
swf.updateCharacters();
|
||||
st.setModified(true);
|
||||
st.setModified(true);
|
||||
SHAPEWITHSTYLE shapes = jpeg2Tag.getShape(st.getRect(), true);
|
||||
|
||||
if (st instanceof DefineShapeTag) {
|
||||
DefineShapeTag dst = (DefineShapeTag) st;
|
||||
|
||||
@@ -42,7 +42,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -87,6 +86,8 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
|
||||
private boolean isSingleFrame;
|
||||
|
||||
private static final Cache<DefineButton2Tag, RECT> rectCache = Cache.getInstance(true, "rect_button2");
|
||||
|
||||
@Override
|
||||
public int getCharacterId() {
|
||||
return buttonId;
|
||||
@@ -198,8 +199,6 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
return modified;
|
||||
}
|
||||
|
||||
private static final Cache<DefineButton2Tag, RECT> rectCache = Cache.getInstance(true, "rect_button2");
|
||||
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
if (rectCache.contains(this)) {
|
||||
@@ -213,6 +212,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
if (!added.contains(bt)) {
|
||||
added.add(bt);
|
||||
RECT r2 = bt.getRect(added);
|
||||
added.remove(bt);
|
||||
MATRIX mat = r.placeMatrix;
|
||||
if (mat != null) {
|
||||
r2 = mat.apply(r2);
|
||||
@@ -228,6 +228,10 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
return rect;
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
rectCache.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trackAsMenu() {
|
||||
return trackAsMenu;
|
||||
@@ -258,7 +262,7 @@ public class DefineButton2Tag extends ButtonTag implements ASMSourceContainer {
|
||||
if (timeline != null) {
|
||||
return timeline;
|
||||
}
|
||||
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect(new HashSet<BoundedTag>()));
|
||||
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect());
|
||||
|
||||
int maxDepth = 0;
|
||||
Frame frameUp = new Frame(timeline, 0);
|
||||
|
||||
@@ -49,7 +49,6 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Level;
|
||||
@@ -93,6 +92,8 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
|
||||
private boolean isSingleFrame;
|
||||
|
||||
private static final Cache<DefineButtonTag, RECT> rectCache = Cache.getInstance(true, "rect_button");
|
||||
|
||||
@Override
|
||||
public List<BUTTONRECORD> getRecords() {
|
||||
return characters;
|
||||
@@ -249,8 +250,6 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
return modified;
|
||||
}
|
||||
|
||||
private static final Cache<DefineButtonTag, RECT> rectCache = Cache.getInstance(true, "rect_button");
|
||||
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
if (rectCache.contains(this)) {
|
||||
@@ -264,6 +263,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
if (!added.contains(bt)) {
|
||||
added.add(bt);
|
||||
RECT r2 = bt.getRect(added);
|
||||
added.remove(bt);
|
||||
MATRIX mat = r.placeMatrix;
|
||||
if (mat != null) {
|
||||
r2 = mat.apply(r2);
|
||||
@@ -280,6 +280,10 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
return rect;
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
rectCache.clear();
|
||||
}
|
||||
|
||||
List<DisassemblyListener> listeners = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
@@ -342,7 +346,7 @@ public class DefineButtonTag extends ButtonTag implements ASMSource {
|
||||
if (timeline != null) {
|
||||
return timeline;
|
||||
}
|
||||
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect(new HashSet<BoundedTag>()));
|
||||
timeline = new Timeline(swf, this, new ArrayList<Tag>(), buttonId, getRect());
|
||||
|
||||
ColorTransform clrTrans = null;
|
||||
for (Tag t : swf.tags) {
|
||||
|
||||
@@ -57,7 +57,6 @@ import java.io.OutputStream;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
@@ -821,7 +820,7 @@ public class DefineEditTextTag extends TextTag {
|
||||
RGB borderColor = new RGBA(Color.black);
|
||||
RGB fillColor = new RGBA(Color.white);
|
||||
if (!canvas) {
|
||||
drawBorder(swf, image, borderColor, fillColor, getRect(new HashSet<BoundedTag>()), getTextMatrix(), transformation, colorTransform);
|
||||
drawBorder(swf, image, borderColor, fillColor, getRect(), getTextMatrix(), transformation, colorTransform);
|
||||
} else {
|
||||
// TODO: draw border
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.BitmapExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
@@ -62,7 +61,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineMorphShape2Tag extends CharacterTag implements MorphShapeTag {
|
||||
public class DefineMorphShape2Tag extends MorphShapeTag {
|
||||
|
||||
@SWFType(BasicType.UI16)
|
||||
public int characterId;
|
||||
|
||||
@@ -26,7 +26,6 @@ import com.jpexs.decompiler.flash.exporters.morphshape.SVGMorphShapeExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.BitmapExporter;
|
||||
import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.MorphShapeTag;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.types.BasicType;
|
||||
@@ -61,7 +60,7 @@ import java.util.Set;
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
public class DefineMorphShapeTag extends CharacterTag implements MorphShapeTag {
|
||||
public class DefineMorphShapeTag extends MorphShapeTag {
|
||||
|
||||
@SWFType(BasicType.UI16)
|
||||
public int characterId;
|
||||
|
||||
@@ -84,10 +84,12 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
|
||||
private boolean isSingleFrame;
|
||||
|
||||
private static final Cache<DefineSpriteTag, RECT> rectCache = Cache.getInstance(true, "rect_sprite");
|
||||
|
||||
@Override
|
||||
public Timeline getTimeline() {
|
||||
if (timeline == null) {
|
||||
timeline = new Timeline(swf, this, subTags, spriteId, getRect(new HashSet<BoundedTag>()));
|
||||
timeline = new Timeline(swf, this, subTags, spriteId, getRect());
|
||||
}
|
||||
return timeline;
|
||||
}
|
||||
@@ -108,6 +110,7 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
if (!added.contains(bt)) {
|
||||
added.add(bt);
|
||||
r = bt.getRect(added);
|
||||
added.remove(bt);
|
||||
}
|
||||
}
|
||||
if (r != null) {
|
||||
@@ -124,7 +127,10 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static final Cache<DefineSpriteTag, RECT> rectCache = Cache.getInstance(true, "rect_sprite");
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(new HashSet<BoundedTag>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
@@ -134,9 +140,7 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
RECT ret = new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE);
|
||||
HashMap<Integer, Integer> depthMap = new HashMap<>();
|
||||
boolean foundSomething = false;
|
||||
int pos = 0;
|
||||
for (Tag t : subTags) {
|
||||
pos++;
|
||||
MATRIX m = null;
|
||||
int characterId = -1;
|
||||
if (t instanceof PlaceObjectTypeTag) {
|
||||
@@ -145,9 +149,9 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
int charId = pot.getCharacterId();
|
||||
if (charId > -1) {
|
||||
depthMap.put(pot.getDepth(), charId);
|
||||
characterId = (charId);
|
||||
characterId = charId;
|
||||
} else {
|
||||
Integer chi = (depthMap.get(pot.getDepth()));
|
||||
Integer chi = depthMap.get(pot.getDepth());
|
||||
if (chi != null) {
|
||||
characterId = chi;
|
||||
}
|
||||
@@ -262,6 +266,10 @@ public class DefineSpriteTag extends CharacterTag implements DrawableTag, Timeli
|
||||
return subTags;
|
||||
}
|
||||
|
||||
public static void clearCache() {
|
||||
rectCache.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getNeededCharacters(Set<Integer> needed) {
|
||||
for (Tag t : subTags) {
|
||||
|
||||
@@ -47,7 +47,6 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -565,7 +564,7 @@ public class DefineText2Tag extends TextTag {
|
||||
|
||||
@Override
|
||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level, double zoom) {
|
||||
staticTextToSVG(swf, textRecords, 2, exporter, getRect(new HashSet<BoundedTag>()), getTextMatrix(), colorTransform, zoom);
|
||||
staticTextToSVG(swf, textRecords, 2, exporter, getRect(), getTextMatrix(), colorTransform, zoom);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -48,7 +48,6 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -584,7 +583,7 @@ public class DefineTextTag extends TextTag {
|
||||
|
||||
@Override
|
||||
public void toSVG(SVGExporter exporter, int ratio, ColorTransform colorTransform, int level, double zoom) {
|
||||
staticTextToSVG(swf, textRecords, 1, exporter, getRect(new HashSet<BoundedTag>()), getTextMatrix(), colorTransform, zoom);
|
||||
staticTextToSVG(swf, textRecords, 1, exporter, getRect(), getTextMatrix(), colorTransform, zoom);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -131,6 +131,11 @@ public class DefineVideoStreamTag extends CharacterTag implements BoundedTag {
|
||||
codecID = sis.readUI8("codecID");
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(null); // parameter not used
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
return new RECT(0, (int) (SWF.unitDivisor * width), 0, (int) (SWF.unitDivisor * height));
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
@@ -24,5 +25,7 @@ import java.util.Set;
|
||||
*/
|
||||
public interface BoundedTag {
|
||||
|
||||
public RECT getRect();
|
||||
|
||||
public RECT getRect(Set<BoundedTag> added);
|
||||
}
|
||||
|
||||
@@ -25,11 +25,13 @@ import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.timeline.Timelined;
|
||||
import com.jpexs.decompiler.flash.types.BUTTONRECORD;
|
||||
import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
import java.awt.Shape;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -54,6 +56,11 @@ public abstract class ButtonTag extends CharacterTag implements DrawableTag, Tim
|
||||
|
||||
public abstract boolean trackAsMenu();
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(new HashSet<BoundedTag>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Shape getOutline(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, Matrix transformation) {
|
||||
return getTimeline().getOutline(frame, time, ratio, stateUnderCursor, mouseButton, transformation);
|
||||
|
||||
@@ -44,7 +44,6 @@ import java.awt.font.GlyphMetrics;
|
||||
import java.awt.font.GlyphVector;
|
||||
import java.awt.geom.Area;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -315,10 +314,15 @@ public abstract class FontTag extends CharacterTag implements AloneTag, Drawable
|
||||
|
||||
@Override
|
||||
public Shape getOutline(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, Matrix transformation) {
|
||||
RECT r = getRect(new HashSet<BoundedTag>());
|
||||
RECT r = getRect();
|
||||
return new Area(new Rectangle(r.Xmin, r.Ymin, r.getWidth(), r.getHeight()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(null); // parameter not used
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
return new RECT(0, (int) (PREVIEWSIZE * SWF.unitDivisor), 0, (int) (PREVIEWSIZE * SWF.unitDivisor));
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
@@ -40,7 +41,6 @@ import java.awt.Shape;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ public abstract class ImageTag extends CharacterTag implements DrawableTag {
|
||||
}
|
||||
|
||||
private SHAPEWITHSTYLE getShape() {
|
||||
private SHAPEWITHSTYLE getShape() {
|
||||
RECT rect = getRect();
|
||||
return getShape(rect, false);
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public abstract class ImageTag extends CharacterTag implements DrawableTag {
|
||||
MATRIX matrix = new MATRIX();
|
||||
matrix.hasScale = true;
|
||||
if (fill) {
|
||||
if (fill) {
|
||||
RECT imageRect = getRect();
|
||||
matrix.scaleX = (int) ((((long) SWF.unitDivisor) << 16) * rect.getWidth() / imageRect.getWidth());
|
||||
matrix.scaleY = (int) ((((long) SWF.unitDivisor) << 16) * rect.getHeight() / imageRect.getHeight());
|
||||
} else {
|
||||
@@ -170,6 +170,11 @@ public abstract class ImageTag extends CharacterTag implements DrawableTag {
|
||||
return shape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(null); // parameter not used
|
||||
}
|
||||
|
||||
@Override
|
||||
public RECT getRect(Set<BoundedTag> added) {
|
||||
SerializableImage image = getImage();
|
||||
|
||||
@@ -1,45 +1,58 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2015 JPEXS, All rights reserved.
|
||||
*
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3.0 of the License, or (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* 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.base;
|
||||
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.types.MORPHFILLSTYLEARRAY;
|
||||
import com.jpexs.decompiler.flash.types.MORPHLINESTYLEARRAY;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPE;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author JPEXS
|
||||
*/
|
||||
*/
|
||||
public abstract class MorphShapeTag extends CharacterTag implements DrawableTag {
|
||||
|
||||
|
||||
public MorphShapeTag(SWF swf, int id, String name, ByteArrayRange data) {
|
||||
super(swf, id, name, data);
|
||||
}
|
||||
|
||||
|
||||
public abstract RECT getStartBounds();
|
||||
|
||||
|
||||
public abstract RECT getEndBounds();
|
||||
|
||||
|
||||
public abstract MORPHFILLSTYLEARRAY getFillStyles();
|
||||
|
||||
|
||||
public abstract MORPHLINESTYLEARRAY getLineStyles();
|
||||
|
||||
|
||||
public abstract SHAPE getStartEdges();
|
||||
|
||||
|
||||
public abstract SHAPE getEndEdges();
|
||||
|
||||
|
||||
public abstract int getShapeNum();
|
||||
|
||||
public abstract SHAPEWITHSTYLE getShapeAtRatio(int ratio);
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(new HashSet<BoundedTag>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.exporters.shape.SVGShapeExporter;
|
||||
import com.jpexs.decompiler.flash.helpers.LazyObject;
|
||||
import com.jpexs.decompiler.flash.timeline.DepthState;
|
||||
import com.jpexs.decompiler.flash.types.ColorTransform;
|
||||
import com.jpexs.decompiler.flash.types.RECT;
|
||||
import com.jpexs.decompiler.flash.types.SHAPEWITHSTYLE;
|
||||
import com.jpexs.helpers.ByteArrayRange;
|
||||
import com.jpexs.helpers.SerializableImage;
|
||||
@@ -61,6 +62,11 @@ public abstract class ShapeTag extends CharacterTag implements DrawableTag, Lazy
|
||||
|
||||
public abstract int getShapeNum();
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(null); // parameter not used
|
||||
}
|
||||
|
||||
@Override
|
||||
public Shape getOutline(int frame, int time, int ratio, DepthState stateUnderCursor, int mouseButton, Matrix transformation) {
|
||||
return transformation.toTransform().createTransformedShape(getShapes().getOutline());
|
||||
|
||||
@@ -95,6 +95,11 @@ public abstract class TextTag extends CharacterTag implements DrawableTag {
|
||||
|
||||
public abstract ExportRectangle calculateTextBounds();
|
||||
|
||||
@Override
|
||||
public RECT getRect() {
|
||||
return getRect(null); // parameter not used
|
||||
}
|
||||
|
||||
private static void updateRect(RECT ret, int x, int y) {
|
||||
if (x < ret.Xmin) {
|
||||
ret.Xmin = x;
|
||||
|
||||
@@ -55,7 +55,6 @@ import com.jpexs.decompiler.flash.tags.StartSoundTag;
|
||||
import com.jpexs.decompiler.flash.tags.SymbolClassTag;
|
||||
import com.jpexs.decompiler.flash.tags.Tag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ASMSource;
|
||||
import com.jpexs.decompiler.flash.tags.base.BoundedTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.ButtonTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.CharacterTag;
|
||||
import com.jpexs.decompiler.flash.tags.base.FontTag;
|
||||
@@ -116,7 +115,6 @@ import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@@ -1080,7 +1078,7 @@ public class XFLConverter {
|
||||
ret.append(" symbolType=\"graphic\" loop=\"loop\"");
|
||||
} else if (tag instanceof DefineSpriteTag) {
|
||||
DefineSpriteTag sprite = (DefineSpriteTag) tag;
|
||||
RECT spriteRect = sprite.getRect(new HashSet<BoundedTag>());
|
||||
RECT spriteRect = sprite.getRect();
|
||||
double centerPoint3DX = twipToPixel(matrix.translateX + spriteRect.getWidth() / 2);
|
||||
double centerPoint3DY = twipToPixel(matrix.translateY + spriteRect.getHeight() / 2);
|
||||
ret.append(" centerPoint3DX=\"").append(centerPoint3DX).append("\" centerPoint3DY=\"").append(centerPoint3DY).append("\"");
|
||||
|
||||
Reference in New Issue
Block a user