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

@@ -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