[Libreoffice-commits] core.git: svx/inc svx/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon May 11 08:55:21 UTC 2020


 svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx        |    3 +--
 svx/source/sdr/primitive2d/sdrcustomshapeprimitive2d.cxx |    7 +------
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx     |   13 +++++++++----
 svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx        |    8 +-------
 4 files changed, 12 insertions(+), 19 deletions(-)

New commits:
commit 4ba368a3dd793bdc703858f358e1af7112decadd
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon May 11 10:10:34 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon May 11 10:54:46 2020 +0200

    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 at collabora.com>
    Tested-by: Jenkins

diff --git a/svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx b/svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx
index 63af09222a6d..d991eb4ed2f3 100644
--- a/svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx
+++ b/svx/inc/sdr/primitive2d/sdrdecompositiontools.hxx
@@ -72,8 +72,7 @@ namespace drawinglayer
         Primitive2DContainer SVXCORE_DLLPUBLIC createEmbeddedShadowPrimitive(
             const Primitive2DContainer& rContent,
             const attribute::SdrShadowAttribute& rShadow,
-            sal_Int32 nGraphicTranslateX = 0,
-            sal_Int32 nGraphicTranslateY = 0);
+            const basegfx::B2DHomMatrix& rObjectMatrix = basegfx::B2DHomMatrix());
 
         Primitive2DContainer SVXCORE_DLLPUBLIC createEmbeddedGlowPrimitive(
             const Primitive2DContainer& rContent,
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());


More information about the Libreoffice-commits mailing list