diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2020-04-14 15:49:28 +0300 |
---|---|---|
committer | Gülşah Köse <gulsah.kose@collabora.com> | 2020-04-23 10:07:13 +0200 |
commit | 6454b6336b8de9a4c5899adeab552af6f794cdc4 (patch) | |
tree | efe9ea2e9b0131c4e9143cb1a085586de6f6e91a /svx/source/sdr | |
parent | 0e75f025419f878dc772391cea8d55765bceb9fc (diff) |
tdf#130058 Import shadow size.
Change-Id: Ie1cee377a33567088fb76ea47f0e6fc51d47f0fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92188
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Diffstat (limited to 'svx/source/sdr')
-rw-r--r-- | svx/source/sdr/primitive2d/sdrattributecreator.cxx | 7 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrdecompositiontools.cxx | 18 | ||||
-rw-r--r-- | svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx | 10 |
3 files changed, 28 insertions, 7 deletions
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 18f5aae3e884..55c44f3dc3b2 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -384,9 +384,14 @@ namespace drawinglayer::primitive2d const basegfx::B2DVector aOffset( static_cast<double>(rSet.Get(SDRATTR_SHADOWXDIST).GetValue()), static_cast<double>(rSet.Get(SDRATTR_SHADOWYDIST).GetValue())); + + const basegfx::B2DVector aSize( + static_cast<double>(rSet.Get(SDRATTR_SHADOWSIZEX).GetValue()), + static_cast<double>(rSet.Get(SDRATTR_SHADOWSIZEY).GetValue())); + const Color aColor(rSet.Get(SDRATTR_SHADOWCOLOR).GetColorValue()); - return attribute::SdrShadowAttribute(aOffset, static_cast<double>(nTransparence) * 0.01, aColor.getBColor()); + return attribute::SdrShadowAttribute(aOffset, aSize, static_cast<double>(nTransparence) * 0.01, aColor.getBColor()); } } diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index a6c20dfc9da0..5ce394f8c813 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -482,16 +482,26 @@ namespace drawinglayer::primitive2d Primitive2DContainer createEmbeddedShadowPrimitive( const Primitive2DContainer& rContent, - const attribute::SdrShadowAttribute& rShadow) + const attribute::SdrShadowAttribute& rShadow, + sal_Int32 nGraphicTranslateX, + sal_Int32 nGraphicTranslateY) { if(!rContent.empty()) { Primitive2DContainer aRetval(2); basegfx::B2DHomMatrix aShadowOffset; - // prepare shadow offset - aShadowOffset.set(0, 2, rShadow.getOffset().getX()); - aShadowOffset.set(1, 2, rShadow.getOffset().getY()); + { + if(rShadow.getSize().getX() != 100000) + { + // Scale the shadow + aShadowOffset.translate(-nGraphicTranslateX, -nGraphicTranslateY); + aShadowOffset.scale(rShadow.getSize().getX() * 0.00001, rShadow.getSize().getY() * 0.00001); + aShadowOffset.translate(nGraphicTranslateX, nGraphicTranslateY); + } + + aShadowOffset.translate(rShadow.getOffset().getX(), rShadow.getOffset().getY()); + } // create shadow primitive and add content aRetval[0] = Primitive2DReference( diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 8ded6183a83c..77dc73145e33 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -29,6 +29,7 @@ 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()); @@ -55,7 +56,10 @@ 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); } @@ -116,7 +120,9 @@ namespace drawinglayer::primitive2d { aRetval = createEmbeddedShadowPrimitive( aRetval, - getSdrLFSTAttribute().getShadow()); + getSdrLFSTAttribute().getShadow(), + aTranslateGrf.getX(), + aTranslateGrf.getY()); } rContainer.insert(rContainer.end(), aRetval.begin(), aRetval.end()); |