Fixed: #1332 Flash viewer - Show directly added images when placeFlagHasImage is true on AS3 swfs

This commit is contained in:
Jindra Petřík
2021-03-07 09:53:41 +01:00
parent 96ca839430
commit c339113f45
9 changed files with 36 additions and 7 deletions

View File

@@ -20,6 +20,7 @@ All notable changes to this project will be documented in this file.
- [#1647] Copying to clipboard - Transparency support
- Incorrect placeobject display (tag selection)
- Generic tag saving problem - timelined exception
- [#1332] Flash viewer - Show directly added images when placeFlagHasImage is true on AS3 swfs
## [14.1.0] - 2021-03-05
### Added
@@ -2092,6 +2093,7 @@ All notable changes to this project will be documented in this file.
[#1254]: https://www.free-decompiler.com/flash/issues/1254
[#1636]: https://www.free-decompiler.com/flash/issues/1636
[#1647]: https://www.free-decompiler.com/flash/issues/1647
[#1332]: https://www.free-decompiler.com/flash/issues/1332
[#1561]: https://www.free-decompiler.com/flash/issues/1561
[#1623]: https://www.free-decompiler.com/flash/issues/1623
[#1622]: https://www.free-decompiler.com/flash/issues/1622

View File

@@ -472,4 +472,9 @@ public class PlaceObject2Tag extends PlaceObjectTypeTag implements ASMSourceCont
public void setPlaceFlagHasMatrix(boolean placeFlagHasMatrix) {
this.placeFlagHasMatrix = placeFlagHasMatrix;
}
@Override
public boolean hasImage() {
return false;
}
}

View File

@@ -240,7 +240,7 @@ public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceCont
super(swf, ID, NAME, null);
}
public PlaceObject3Tag(SWF swf, boolean placeFlagMove, int depth, String className, int characterId, MATRIX matrix, CXFORMWITHALPHA colorTransform, int ratio, String name, int clipDepth, List<FILTER> surfaceFilterList, int blendMode, Integer bitmapCache, int visible, RGBA backgroundColor, CLIPACTIONS clipActions) {
public PlaceObject3Tag(SWF swf, boolean placeFlagMove, int depth, String className, int characterId, MATRIX matrix, CXFORMWITHALPHA colorTransform, int ratio, String name, int clipDepth, List<FILTER> surfaceFilterList, int blendMode, Integer bitmapCache, int visible, RGBA backgroundColor, CLIPACTIONS clipActions, boolean placeFlagHasImage) {
super(swf, ID, NAME, null);
this.placeFlagHasClassName = className != null;
this.placeFlagHasFilterList = surfaceFilterList != null;
@@ -270,6 +270,7 @@ public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceCont
this.visible = visible;
this.backgroundColor = backgroundColor;
this.clipActions = clipActions;
this.placeFlagHasImage = placeFlagHasImage;
}
/**
@@ -657,4 +658,10 @@ public class PlaceObject3Tag extends PlaceObjectTypeTag implements ASMSourceCont
public void setPlaceFlagHasMatrix(boolean placeFlagHasMatrix) {
this.placeFlagHasMatrix = placeFlagHasMatrix;
}
@Override
public boolean hasImage() {
return placeFlagHasImage;
}
}

View File

@@ -245,7 +245,7 @@ public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceCont
super(swf, ID, NAME, null);
}
public PlaceObject4Tag(SWF swf, boolean placeFlagMove, int depth, String className, int characterId, MATRIX matrix, CXFORMWITHALPHA colorTransform, int ratio, String name, int clipDepth, List<FILTER> surfaceFilterList, int blendMode, Integer bitmapCache, Integer visible, RGBA backgroundColor, CLIPACTIONS clipActions, Amf3Value amfData) {
public PlaceObject4Tag(SWF swf, boolean placeFlagMove, int depth, String className, int characterId, MATRIX matrix, CXFORMWITHALPHA colorTransform, int ratio, String name, int clipDepth, List<FILTER> surfaceFilterList, int blendMode, Integer bitmapCache, Integer visible, RGBA backgroundColor, CLIPACTIONS clipActions, Amf3Value amfData, boolean placeFlagHasImage) {
super(swf, ID, NAME, null);
this.placeFlagHasClassName = className != null;
this.placeFlagHasFilterList = surfaceFilterList != null;
@@ -276,6 +276,7 @@ public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceCont
this.backgroundColor = backgroundColor;
this.clipActions = clipActions;
this.amfData = amfData;
this.placeFlagHasImage = placeFlagHasImage;
}
/**
@@ -678,4 +679,9 @@ public class PlaceObject4Tag extends PlaceObjectTypeTag implements ASMSourceCont
public void setPlaceFlagHasMatrix(boolean placeFlagHasMatrix) {
this.placeFlagHasMatrix = placeFlagHasMatrix;
}
@Override
public boolean hasImage() {
return placeFlagHasImage;
}
}

View File

@@ -286,4 +286,9 @@ public class PlaceObjectTag extends PlaceObjectTypeTag {
public void setPlaceFlagHasMatrix(boolean placeFlagHasMatrix) {
}
@Override
public boolean hasImage() {
return false;
}
}

View File

@@ -65,6 +65,8 @@ public abstract class PlaceObjectTypeTag extends Tag implements CharacterIdTag {
public abstract boolean cacheAsBitmap();
public abstract boolean hasImage();
public abstract Integer getBitmapCache();
public abstract boolean isVisible();

View File

@@ -81,6 +81,8 @@ public class DepthState {
public boolean motionTween = false;
public boolean hasImage = false;
private static AtomicLong lastInstanceId = new AtomicLong(0);
public static long getNewInstanceId() {
@@ -138,10 +140,10 @@ public class DepthState {
return new PlaceObject2Tag(swf, false, depth, characterId, matrix, cxForm, ratio, instanceName, clipDepth, clipActions);
} else if (minPlaceObjectNum == 3) {
CXFORMWITHALPHA cxForm = colorTransForm == null ? null : new CXFORMWITHALPHA(colorTransForm);
return new PlaceObject3Tag(swf, false, depth, null/*todo: className*/, characterId, matrix, cxForm, ratio, instanceName, clipDepth, filters, blendMode, cacheAsBitmap ? 1 : 0, isVisible ? 1 : 0, backGroundColor, clipActions);
return new PlaceObject3Tag(swf, false, depth, null/*todo: className*/, characterId, matrix, cxForm, ratio, instanceName, clipDepth, filters, blendMode, cacheAsBitmap ? 1 : 0, isVisible ? 1 : 0, backGroundColor, clipActions, hasImage);
}
CXFORMWITHALPHA cxForm = colorTransForm == null ? null : new CXFORMWITHALPHA(colorTransForm);
return new PlaceObject4Tag(swf, false, depth, null/*todo: className*/, characterId, matrix, cxForm, ratio, instanceName, clipDepth, filters, blendMode, cacheAsBitmap ? 1 : 0, isVisible ? 1 : 0, backGroundColor, clipActions, null);
return new PlaceObject4Tag(swf, false, depth, null/*todo: className*/, characterId, matrix, cxForm, ratio, instanceName, clipDepth, filters, blendMode, cacheAsBitmap ? 1 : 0, isVisible ? 1 : 0, backGroundColor, clipActions, null, hasImage);
}
}

View File

@@ -305,6 +305,7 @@ public class Timeline {
int characterId = po.getCharacterId();
if (characterId != -1) {
fl.characterId = characterId;
fl.hasImage = po.hasImage();
}
CharacterTag character = swf.getCharacter(characterId);
if (character instanceof DefineSpriteTag) {
@@ -701,8 +702,7 @@ public class Timeline {
img = new SerializableImage(newWidth, newHeight, SerializableImage.TYPE_INT_ARGB_PRE);
img.fillTransparent();
if (!(drawable instanceof ImageTag)) {
// image tags are not rendered, they should be embedded in shape tags
if (!(drawable instanceof ImageTag) || (swf.isAS3() && layer.hasImage)) {
drawable.toImage(dframe, time, ratio, renderContext, img, isClip || clipDepth > -1, m, strokeTransform, absMat, clrTrans);
} else {
// todo: show one time warning

View File

@@ -1509,7 +1509,7 @@ public class CommandLineArgumentParser {
} else {
pt4 = new PlaceObject4Tag(
pt.getSwf(), pt.flagMove(), pt.getDepth(), pt.getClassName(), pt.getCharacterId(), pt.getMatrix(), pt.getColorTransform() == null ? null : new CXFORMWITHALPHA(pt.getColorTransform()), pt.getRatio(),
pt.getInstanceName(), pt.getClipDepth(), pt.getFilters(), pt.getBlendMode(), pt.getBitmapCache(), pt.getVisible(), pt.getBackgroundColor(), pt.getClipActions(), pt.getAmfData());
pt.getInstanceName(), pt.getClipDepth(), pt.getFilters(), pt.getBlendMode(), pt.getBitmapCache(), pt.getVisible(), pt.getBackgroundColor(), pt.getClipActions(), pt.getAmfData(), pt.hasImage());
tim.replaceTag(i, pt4);
}