diff options
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/svggnode.cxx | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/svgio/source/svgreader/svggnode.cxx b/svgio/source/svgreader/svggnode.cxx index aca500af60ab..f49e737daafa 100644 --- a/svgio/source/svgreader/svggnode.cxx +++ b/svgio/source/svgreader/svggnode.cxx @@ -19,6 +19,7 @@ #include <svggnode.hxx> #include <osl/diagnose.h> +#include <drawinglayer/primitive2d/transformprimitive2d.hxx> namespace svgio::svgreader { @@ -85,31 +86,26 @@ namespace svgio::svgreader void SvgGNode::decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const { - if(SVGToken::Defs == getType()) - { - // #i125258# no decompose needed for defs element, call parent for SVGTokenDefs - SvgNode::decomposeSvgNode(rTarget, bReferenced); - } - else - { - // #i125258# for SVGTokenG decompose children - const SvgStyleAttributes* pStyle = getSvgStyleAttributes(); + SvgNode::decomposeSvgNode(rTarget, bReferenced); - if(pStyle) + // if g element has transform, apply it + if(SVGToken::G == getType()) + { + if(getTransform()) { - const double fOpacity(pStyle->getOpacity().getNumber()); - - if(fOpacity > 0.0 && Display::None != getDisplay()) - { - drawinglayer::primitive2d::Primitive2DContainer aContent; + drawinglayer::primitive2d::Primitive2DContainer aSource(std::move(rTarget)); + // create embedding group element with transformation + const drawinglayer::primitive2d::Primitive2DReference xRef( + new drawinglayer::primitive2d::TransformPrimitive2D( + *getTransform(), + std::move(aSource))); - // decompose children - SvgNode::decomposeSvgNode(aContent, bReferenced); + aSource = drawinglayer::primitive2d::Primitive2DContainer { xRef }; - if(!aContent.empty()) - { - pStyle->add_postProcess(rTarget, std::move(aContent), getTransform()); - } + if(!aSource.empty()) + { + // append to current target + rTarget.append(aSource); } } } |