From 188ca27a2d77de1e3be88182e6269065e8319164 Mon Sep 17 00:00:00 2001 From: "honfika@gmail.com" Date: Sat, 1 Apr 2017 20:20:30 +0200 Subject: [PATCH] SVG import bound fix --- .../decompiler/flash/importers/svg/SvgImporter.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java index 5f6b5adbb..74006cb9f 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/importers/svg/SvgImporter.java @@ -103,10 +103,6 @@ public class SvgImporter { RECT rect = st.getRect(); int origXmin = rect.Xmin; int origYmin = rect.Ymin; - rect.Xmin -= origXmin; - rect.Xmax -= origXmin; - rect.Ymin -= origYmin; - rect.Ymax -= origYmin; shapes.shapeRecords = new ArrayList<>(); @@ -175,6 +171,10 @@ public class SvgImporter { Matrix transform = new Matrix(); if (!fill) { + rect.Xmin -= origXmin; + rect.Xmax -= origXmin; + rect.Ymin -= origYmin; + rect.Ymax -= origYmin; rect.Xmin = (int) Math.round(viewBox.x * SWF.unitDivisor); rect.Ymin = (int) Math.round(viewBox.y * SWF.unitDivisor); rect.Xmax = (int) Math.round((viewBox.x + viewBox.width) * SWF.unitDivisor); @@ -183,6 +183,7 @@ public class SvgImporter { double ratioX = rect.getWidth() / width / SWF.unitDivisor; double ratioY = rect.getHeight() / height / SWF.unitDivisor; transform = Matrix.getScaleInstance(ratioX, ratioY); + transform.translate(origXmin / SWF.unitDivisor, origYmin / SWF.unitDivisor); } processSvgObject(idMap, shapeNum, shapes, rootElement, transform, style);