From b8b77df0ed04fbb0147322cba172114cfdb2adfc Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 16 Aug 2018 09:42:57 +0100 Subject: [PATCH] SVG: Ensure that transformed images are positioned correctly --- modules/juce_gui_basics/drawables/juce_SVGParser.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp index fa703020ad..395b41c9f3 100644 --- a/modules/juce_gui_basics/drawables/juce_SVGParser.cpp +++ b/modules/juce_gui_basics/drawables/juce_SVGParser.cpp @@ -1203,13 +1203,14 @@ private: setCommonAttributes (*di, xml); di->setImage (image); + di->setTransformToFit ({ (float) xml->getDoubleAttribute ("x", 0.0), (float) xml->getDoubleAttribute ("y", 0.0), + (float) xml->getDoubleAttribute ("width", 0.0), (float) xml->getDoubleAttribute ("height", 0.0) }, + RectanglePlacement (parsePlacementFlags (xml->getStringAttribute ("preserveAspectRatio").trim()))); + if (additionalTransform != nullptr) - di->setTransform (transform.followedBy (*additionalTransform)); + di->setTransform (di->getTransform().followedBy (transform).followedBy (*additionalTransform)); else - di->setTransform (transform); - - di->setBoundingBox ({ (float) xml->getDoubleAttribute ("x", 0.0), (float) xml->getDoubleAttribute ("y", 0.0), - (float) xml->getDoubleAttribute ("width", 0.0), (float) xml->getDoubleAttribute ("height", 0.0) }); + di->setTransform (di->getTransform().followedBy (transform)); return di; }