[Libreoffice-commits] core.git: drawinglayer/source include/drawinglayer oox/source sd/qa svx/source

A_GAN (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 16:44:32 UTC 2020


 drawinglayer/source/primitive2d/shadowprimitive2d.cxx        |   10 ++++++++--
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx |    1 +
 drawinglayer/source/processor3d/shadow3dextractor.cxx        |    1 +
 include/drawinglayer/primitive2d/shadowprimitive2d.hxx       |   10 ++++++++--
 oox/source/drawingml/effectproperties.cxx                    |    3 ++-
 sd/qa/unit/import-tests.cxx                                  |    2 +-
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx         |    1 +
 7 files changed, 22 insertions(+), 6 deletions(-)

New commits:
commit b90d0a9dc8e7b4e6a683b35939a7ce0c3090e888
Author:     A_GAN <ganzouri97 at gmail.com>
AuthorDate: Wed Jun 3 05:55:46 2020 +0200
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Jun 4 18:43:51 2020 +0200

    Update ShadowPrimitive2D to support shadow blur
    
    Add attribute for the blur radius and get function.
    give more range for the shadow depends on the size of the blur radius.
    update the blur radius to be imported in Hmm and the test function.
    
    Change-Id: I32faaf02884d9a6b2f11a9033178b3b6bb419580
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95388
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
index 8cb8311494a5..e2c0be36ec9e 100644
--- a/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/shadowprimitive2d.cxx
@@ -23,6 +23,8 @@
 #include <drawinglayer/primitive2d/transformprimitive2d.hxx>
 #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
 
+#include <sal/log.hxx>
+#include <memory>
 
 using namespace com::sun::star;
 
@@ -32,10 +34,12 @@ namespace drawinglayer::primitive2d
         ShadowPrimitive2D::ShadowPrimitive2D(
             const basegfx::B2DHomMatrix& rShadowTransform,
             const basegfx::BColor& rShadowColor,
+            double fShadowBlur,
             const Primitive2DContainer& rChildren)
         :   GroupPrimitive2D(rChildren),
             maShadowTransform(rShadowTransform),
-            maShadowColor(rShadowColor)
+            maShadowColor(rShadowColor),
+            mfShadowBlur(fShadowBlur)
         {
         }
 
@@ -46,7 +50,8 @@ namespace drawinglayer::primitive2d
                 const ShadowPrimitive2D& rCompare = static_cast< const ShadowPrimitive2D& >(rPrimitive);
 
                 return (getShadowTransform() == rCompare.getShadowTransform()
-                    && getShadowColor() == rCompare.getShadowColor());
+                    && getShadowColor() == rCompare.getShadowColor()
+                    && getShadowBlur() == rCompare.getShadowBlur());
             }
 
             return false;
@@ -55,6 +60,7 @@ namespace drawinglayer::primitive2d
         basegfx::B2DRange ShadowPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const
         {
             basegfx::B2DRange aRetval(getChildren().getB2DRange(rViewInformation));
+            aRetval.grow(getShadowBlur());
             aRetval.transform(getShadowTransform());
             return aRetval;
         }
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index 28e9eccdacc5..afc841fcf3bd 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -235,6 +235,7 @@ namespace drawinglayer::primitive2d
                         aShadow = new ShadowPrimitive2D(
                             aShadowTransform,
                             aShadowColor,
+                            0,          // fShadowBlur = 0, there's no blur for text shadow yet.
                             aRetval);
                     }
 
diff --git a/drawinglayer/source/processor3d/shadow3dextractor.cxx b/drawinglayer/source/processor3d/shadow3dextractor.cxx
index 45fca6d8dd38..0b653236eb1b 100644
--- a/drawinglayer/source/processor3d/shadow3dextractor.cxx
+++ b/drawinglayer/source/processor3d/shadow3dextractor.cxx
@@ -74,6 +74,7 @@ namespace drawinglayer::processor3d
                     primitive2d::BasePrimitive2D* pNew = new primitive2d::ShadowPrimitive2D(
                         rPrimitive.getShadowTransform(),
                         rPrimitive.getShadowColor(),
+                        0,  // shadow3d doesn't have rPrimitive.getShadowBlur() yet.
                         aNewSubList);
 
                     if(basegfx::fTools::more(rPrimitive.getShadowTransparence(), 0.0))
diff --git a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
index 4bff4c7aa89c..f384049862a9 100644
--- a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx
@@ -24,6 +24,7 @@
 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <basegfx/color/bcolor.hxx>
+#include <tools/color.hxx>
 
 
 namespace drawinglayer::primitive2d
@@ -51,17 +52,22 @@ namespace drawinglayer::primitive2d
             /// the shadow color to which all geometry is to be forced
             basegfx::BColor                         maShadowColor;
 
-        public:
+            /// the blur radius of the shadow
+            double mfShadowBlur;
+
+
+    public:
             /// constructor
             ShadowPrimitive2D(
                 const basegfx::B2DHomMatrix& rShadowTransform,
                 const basegfx::BColor& rShadowColor,
+                double fShadowBlur,
                 const Primitive2DContainer& rChildren);
 
             /// data read access
             const basegfx::B2DHomMatrix& getShadowTransform() const { return maShadowTransform; }
             const basegfx::BColor& getShadowColor() const { return maShadowColor; }
-
+            double getShadowBlur() const { return mfShadowBlur; }
             /// compare operator
             virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
 
diff --git a/oox/source/drawingml/effectproperties.cxx b/oox/source/drawingml/effectproperties.cxx
index d6a1b9a749c6..b97f6b37ff1f 100644
--- a/oox/source/drawingml/effectproperties.cxx
+++ b/oox/source/drawingml/effectproperties.cxx
@@ -93,6 +93,7 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
             sal_Int32 nXDist = cos(nAngle) * nDist;
             sal_Int32 nYDist = sin(nAngle) * nDist;
 
+
             rPropMap.setProperty( PROP_Shadow, true );
             rPropMap.setProperty( PROP_ShadowXDistance, nXDist);
             rPropMap.setProperty( PROP_ShadowYDistance, nYDist);
@@ -100,7 +101,7 @@ void EffectProperties::pushToPropMap( PropertyMap& rPropMap,
             rPropMap.setProperty( PROP_ShadowSizeY, nAttrSizeY);
             rPropMap.setProperty( PROP_ShadowColor, it->moColor.getColor(rGraphicHelper ) );
             rPropMap.setProperty( PROP_ShadowTransparence, it->moColor.getTransparency());
-            rPropMap.setProperty( PROP_ShadowBlur, nAttrBlur);
+            rPropMap.setProperty( PROP_ShadowBlur, convertEmuToHmm(nAttrBlur));
 
         }
     }
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index fb68d4beeb23..1dc8557cfc2a 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -3135,7 +3135,7 @@ void SdImportTest::testShapeBlurPPTXImport()
 
     sal_Int32 nRadius = -1;
     xShape->getPropertyValue("ShadowBlur") >>= nRadius;
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(139700), nRadius); // 584200EMU=46pt - 139700EMU = 11pt
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(388), nRadius); // 584200EMU=46pt - 139700EMU = 388Hmm = 11pt
 
 }
 
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index 59b38300d375..f0f3ec6001ed 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -524,6 +524,7 @@ namespace drawinglayer::primitive2d
                     new ShadowPrimitive2D(
                         aShadowOffset,
                         rShadow.getColor(),
+                        rShadow.getBlur(),
                         rContent));
 
                 if(0.0 != rShadow.getTransparence())


More information about the Libreoffice-commits mailing list