diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-05-11 10:10:34 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-05-11 10:54:46 +0200 |
commit | 4ba368a3dd793bdc703858f358e1af7112decadd (patch) | |
tree | 751cad4c860c17db8d92760adb578eebf1bf93e3 /svx/source | |
parent | 0b0de876bad66c84a8dd0d8d19944109e59cf21a (diff) |
Related: tdf#129916 svx: clean up duplicated matrix decompose for shadow size
Pass the object's transform matrix to createEmbeddedShadowPrimitive(),
this allows decomposing it only at a single place. Also, this will allow
creating the shadow based on the object size.
Change-Id: I8d8bf59934b00e13cda1da0398910aa9f1ce3c59
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93950
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx | 7 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrdecompositiontools.cxx | 13 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 8 |
3 files changed, 11 insertions, 17 deletions
diff --git a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx index eac5278ada2d..87f564e8dd6f 100644 --- a/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx @@ -74,13 +74,8 @@ namespace drawinglayer::primitive2d // shadow will be correct (using ColorModifierStack), but expensive. if(!get3DShape()) { - basegfx::B2DTuple aScale; - basegfx::B2DTuple aTranslate; - double fRotate = 0; - double fShearX = 0; - maTransform.decompose(aScale, aTranslate, fRotate, fShearX); aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow(), - aTranslate.getX(), aTranslate.getY()); + maTransform); } } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index e4f67c0ed665..ca26a45f826b 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -48,6 +48,7 @@ #include <drawinglayer/attribute/sdrlinestartendattribute.hxx> #include <drawinglayer/attribute/sdrshadowattribute.hxx> #include <drawinglayer/attribute/sdrglowattribute.hxx> +#include <sal/log.hxx> using namespace com::sun::star; @@ -483,8 +484,7 @@ namespace drawinglayer::primitive2d Primitive2DContainer createEmbeddedShadowPrimitive( const Primitive2DContainer& rContent, const attribute::SdrShadowAttribute& rShadow, - sal_Int32 nGraphicTranslateX, - sal_Int32 nGraphicTranslateY) + const basegfx::B2DHomMatrix& rObjectMatrix) { if(!rContent.empty()) { @@ -494,10 +494,15 @@ namespace drawinglayer::primitive2d { if(rShadow.getSize().getX() != 100000) { + basegfx::B2DTuple aScale; + basegfx::B2DTuple aTranslate; + double fRotate = 0; + double fShearX = 0; + rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX); // Scale the shadow - aShadowOffset.translate(-nGraphicTranslateX, -nGraphicTranslateY); + aShadowOffset.translate(-aTranslate.getX(), -aTranslate.getY()); aShadowOffset.scale(rShadow.getSize().getX() * 0.00001, rShadow.getSize().getY() * 0.00001); - aShadowOffset.translate(nGraphicTranslateX, nGraphicTranslateY); + aShadowOffset.translate(aTranslate.getX(), aTranslate.getY()); } aShadowOffset.translate(rShadow.getOffset().getX(), rShadow.getOffset().getY()); diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 2a83e5b6aeed..a06d3967ae1a 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -29,7 +29,6 @@ namespace drawinglayer::primitive2d void SdrGrafPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const { Primitive2DContainer aRetval; - basegfx::B2DTuple aTranslateGrf; // create unit outline polygon const basegfx::B2DPolygon& aUnitOutline(basegfx::utils::createUnitPolygon()); @@ -56,10 +55,6 @@ namespace drawinglayer::primitive2d getTransform(), getGraphicObject(), getGraphicAttr())); - double fRotate = 0; - double fShearX = 0; - basegfx::B2DTuple aScaleGrf; - getTransform().decompose(aScaleGrf, aTranslateGrf, fRotate, fShearX); aRetval.push_back(xGraphicContentPrimitive); } @@ -128,8 +123,7 @@ namespace drawinglayer::primitive2d aRetval = createEmbeddedShadowPrimitive( aRetval, getSdrLFSTAttribute().getShadow(), - aTranslateGrf.getX(), - aTranslateGrf.getY()); + getTransform()); } rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); |