From 32bb0289bc0867da953a00379a8488cf43662d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Tue, 25 Oct 2022 22:39:38 +0200 Subject: [PATCH] Fixed 1828 Closing path in shape strokes from last moveTo only --- CHANGELOG.md | 1 + .../flash/exporters/shape/ShapeExporterBase.java | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc5e32262..aadcacc3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ All notable changes to this project will be documented in this file. - [#1828] Incorrect stroke scaling (normal/none/vertical/horizontal) - [#1771] DefineShape4 line filled using single color - Minimum stroke width should be 1 px +- [#1828] Closing path in shape strokes from last moveTo only ### Changed - AS3 integer values are internally (e.g. in the lib) handled as java int type instead of long. diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java index a9cc2bea2..c6b7a5d05 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/shape/ShapeExporterBase.java @@ -343,6 +343,8 @@ public abstract class ShapeExporterBase implements IShapeExporter { private void exportLinePath(List path) { int posX = Integer.MAX_VALUE; int posY = Integer.MAX_VALUE; + int lastMoveToX = posX; + int lastMoveToY = posY; int lineStyleIdx = Integer.MAX_VALUE; if (path.size() > 0) { boolean autoClose = true; @@ -434,6 +436,8 @@ public abstract class ShapeExporterBase implements IShapeExporter { } if (posX != e.getFromX() || posY != e.getFromY()) { moveTo(e.getFromX(), e.getFromY()); + lastMoveToX = e.getFromX(); + lastMoveToY = e.getFromY(); } if (e instanceof CurvedEdge) { CurvedEdge c = (CurvedEdge) e; @@ -444,8 +448,7 @@ public abstract class ShapeExporterBase implements IShapeExporter { posX = e.getToX(); posY = e.getToY(); } - IEdge firstEdge = path.get(0); - endLines(autoClose && firstEdge.getFromX() == posX && firstEdge.getFromY() == posY); + endLines(autoClose && lastMoveToX == posX && lastMoveToY == posY); } }