diff --git a/CHANGELOG.md b/CHANGELOG.md index 05f657f6b..79c11441b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file. ### Fixed - GFX - DefineExternalImage2 display and correct handling if standalone +- [#1931] DefineSprite rectange calculation (incorrect export dimensions) ## [18.3.0] - 2023-01-01 ### Added @@ -2839,6 +2840,7 @@ All notable changes to this project will be documented in this file. [alpha 9]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha8...alpha9 [alpha 8]: https://github.com/jindrapetrik/jpexs-decompiler/compare/alpha7...alpha8 [alpha 7]: https://github.com/jindrapetrik/jpexs-decompiler/releases/tag/alpha7 +[#1931]: https://www.free-decompiler.com/flash/issues/1931 [#1913]: https://www.free-decompiler.com/flash/issues/1913 [#1905]: https://www.free-decompiler.com/flash/issues/1905 [#1915]: https://www.free-decompiler.com/flash/issues/1915 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index c02738caf..c3b454bbf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -28,6 +28,7 @@ import com.jpexs.decompiler.flash.tags.base.CharacterIdTag; import com.jpexs.decompiler.flash.tags.base.CharacterTag; import com.jpexs.decompiler.flash.tags.base.DrawableTag; import com.jpexs.decompiler.flash.tags.base.PlaceObjectTypeTag; +import com.jpexs.decompiler.flash.tags.base.RemoveTag; import com.jpexs.decompiler.flash.tags.base.RenderContext; import com.jpexs.decompiler.flash.tags.base.SoundStreamHeadTypeTag; import com.jpexs.decompiler.flash.timeline.Timeline; @@ -224,13 +225,36 @@ public class DefineSpriteTag extends DrawableTag implements Timelined { ret = new RECT(Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE); HashMap depthMap = new HashMap<>(); + HashMap depthMatrixMap = new HashMap<>(); boolean foundSomething = false; for (Tag t : getTags()) { MATRIX m = null; int characterId = -1; + if (t instanceof RemoveTag) { + RemoveTag rt = (RemoveTag)t; + depthMap.remove(rt.getDepth()); + depthMatrixMap.remove(rt.getDepth()); + } if (t instanceof PlaceObjectTypeTag) { PlaceObjectTypeTag pot = (PlaceObjectTypeTag) t; m = pot.getMatrix(); + + if (m == null) { + if (pot.flagMove()) { + if (!depthMatrixMap.containsKey(pot.getDepth())) { + m = null; //?? + } else { + m = depthMatrixMap.get(pot.getDepth()); + } + } + } + + if (!pot.flagMove() && depthMap.containsKey(pot.getDepth())) { + continue; + } + + depthMatrixMap.put(pot.getDepth(), m); + int charId = pot.getCharacterId(); if (charId > -1) { depthMap.put(pot.getDepth(), charId); @@ -240,10 +264,7 @@ public class DefineSpriteTag extends DrawableTag implements Timelined { if (chi != null) { characterId = chi; } - } - if (pot.flagMove() && m == null) { - continue; - } + } } if (characterId == -1) { continue;