[Libreoffice-commits] core.git: svgio/inc svgio/source
Armin Le Grand
alg at apache.org
Fri Jul 4 08:14:52 PDT 2014
svgio/inc/svgio/svgreader/svgclippathnode.hxx | 6 ++++--
svgio/inc/svgio/svgreader/svgmasknode.hxx | 6 ++++--
svgio/source/svgreader/svgclippathnode.cxx | 12 +++++++++++-
svgio/source/svgreader/svgmasknode.cxx | 17 ++++++++++++++++-
svgio/source/svgreader/svgstyleattributes.cxx | 6 ++++--
5 files changed, 39 insertions(+), 8 deletions(-)
New commits:
commit 7c4fb287bb1e69725560cd4688e1d1d99d4498e0
Author: Armin Le Grand <alg at apache.org>
Date: Thu Jul 3 15:49:09 2014 +0000
Resolves: #i124852# Corrected mask and clip polygons for userSpaceOnUse
(cherry picked from commit 247d5bc4d13c8ab299f8ca72768946f59815dca4)
Change-Id: I328a55e940db64d3dad04902bf81ede56a0dfe73
diff --git a/svgio/inc/svgio/svgreader/svgclippathnode.hxx b/svgio/inc/svgio/svgreader/svgclippathnode.hxx
index d7fbf9b..36586d8 100644
--- a/svgio/inc/svgio/svgreader/svgclippathnode.hxx
+++ b/svgio/inc/svgio/svgreader/svgclippathnode.hxx
@@ -47,8 +47,10 @@ namespace svgio
virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) SAL_OVERRIDE;
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const SAL_OVERRIDE;
- /// apply contained clipPath to given geometry
- void apply(drawinglayer::primitive2d::Primitive2DSequence& rTarget) const;
+ /// apply contained clipPath to given geometry #i124852# transform may be needed
+ void apply(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const basegfx::B2DHomMatrix* pTransform) const;
/// clipPathUnits content
SvgUnits getClipPathUnits() const { return maClipPathUnits; }
diff --git a/svgio/inc/svgio/svgreader/svgmasknode.hxx b/svgio/inc/svgio/svgreader/svgmasknode.hxx
index e0f66b1..897401f 100644
--- a/svgio/inc/svgio/svgreader/svgmasknode.hxx
+++ b/svgio/inc/svgio/svgreader/svgmasknode.hxx
@@ -52,8 +52,10 @@ namespace svgio
virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) SAL_OVERRIDE;
virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DSequence& rTarget, bool bReferenced) const SAL_OVERRIDE;
- /// apply contained clipPath to given geometry
- void apply(drawinglayer::primitive2d::Primitive2DSequence& rTarget) const;
+ /// apply contained clipPath to given geometry #i124852# transform may be needed
+ void apply(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const basegfx::B2DHomMatrix* pTransform) const;
/// x content, set if found in current context
const SvgNumber& getX() const { return maX; }
diff --git a/svgio/source/svgreader/svgclippathnode.cxx b/svgio/source/svgreader/svgclippathnode.cxx
index c8b7e18..0a7f0f4 100644
--- a/svgio/source/svgreader/svgclippathnode.cxx
+++ b/svgio/source/svgreader/svgclippathnode.cxx
@@ -125,7 +125,9 @@ namespace svgio
}
}
- void SvgClipPathNode::apply(drawinglayer::primitive2d::Primitive2DSequence& rContent) const
+ void SvgClipPathNode::apply(
+ drawinglayer::primitive2d::Primitive2DSequence& rContent,
+ const basegfx::B2DHomMatrix* pTransform) const
{
if(rContent.hasElements() && Display_none != getDisplay())
{
@@ -172,6 +174,14 @@ namespace svgio
aContentRange.getRange(),
aContentRange.getMinimum()));
}
+ else // userSpaceOnUse
+ {
+ // #i124852#
+ if(pTransform)
+ {
+ aClipPolyPolygon.transform(*pTransform);
+ }
+ }
// #i124313# try to avoid creating an embedding to a MaskPrimitive2D if
// possible; MaskPrimitive2D processing is potentially expensive
diff --git a/svgio/source/svgreader/svgmasknode.cxx b/svgio/source/svgreader/svgmasknode.cxx
index 7d3a72b..e80f2e8 100644
--- a/svgio/source/svgreader/svgmasknode.cxx
+++ b/svgio/source/svgreader/svgmasknode.cxx
@@ -190,7 +190,9 @@ namespace svgio
}
}
- void SvgMaskNode::apply(drawinglayer::primitive2d::Primitive2DSequence& rTarget) const
+ void SvgMaskNode::apply(
+ drawinglayer::primitive2d::Primitive2DSequence& rTarget,
+ const basegfx::B2DHomMatrix* pTransform) const
{
if(rTarget.hasElements() && Display_none != getDisplay())
{
@@ -252,6 +254,19 @@ namespace svgio
aMaskTarget = drawinglayer::primitive2d::Primitive2DSequence(&xTransform, 1);
}
+ else // userSpaceOnUse
+ {
+ // #i124852#
+ if(pTransform)
+ {
+ const drawinglayer::primitive2d::Primitive2DReference xTransform(
+ new drawinglayer::primitive2d::TransformPrimitive2D(
+ *pTransform,
+ aMaskTarget));
+
+ aMaskTarget = drawinglayer::primitive2d::Primitive2DSequence(&xTransform, 1);
+ }
+ }
// embed content to a ModifiedColorPrimitive2D since the definitions
// how content is used as alpha is special for Svg
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 5f3edd1..1051e46 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1117,7 +1117,8 @@ namespace svgio
if(mpClip)
{
- mpClip->apply(aSource);
+ // #i124852# transform may be needed when userSpaceOnUse
+ mpClip->apply(aSource, pTransform);
}
}
@@ -1130,7 +1131,8 @@ namespace svgio
if(mpMask)
{
- mpMask->apply(aSource);
+ // #i124852# transform may be needed when userSpaceOnUse
+ mpMask->apply(aSource, pTransform);
}
}
More information about the Libreoffice-commits
mailing list