From 37a52d30bbfcf1d073779b50139c4dafa507be4b Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 20 Sep 2021 11:26:53 +0200 Subject: tdf#144091 svx: fix unwanted blur of shadow from table cell fill Initial render support for shadows of table shapes were added in commit a75bf43a8d6c5dec6dcc86908c142ceec541aa8c (tdf#129961 svx: add rendering for table shadow as direct format, 2020-12-02). That already noticed a trick with the shadow of table shapes: the shadow is generate from the cell fill and the border, but not from the text. An additional trick is that when blur is enabled for the table shape's shadow, then only the border should be blurred, not the cell fill. In the bug document's case, the effective cell background was gray, with a semi-transparent red shadow. We used to render cc0000 with blur and cccccc without blur, now we correctly render cca3a3, matching PowerPoint. Change-Id: I7326a5f6254cf19b2d05181084c78e734ff7a7b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122349 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- .../drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx | 7 +++++++ include/drawinglayer/primitive2d/shadowprimitive2d.hxx | 8 ++++++++ 2 files changed, 15 insertions(+) (limited to 'include') diff --git a/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx index fe3c477752a4..66bb9f29af24 100644 --- a/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx +++ b/include/drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx @@ -67,6 +67,9 @@ private: /// a sequence used for buffering the last create2DDecomposition() result Primitive2DContainer maBuffered2DDecomposition; + /// When blur is invoked on a list of primitives, exclude this primitive from the blur effect. + bool mbExcludeFromBlur = false; + protected: /** access methods to maBuffered2DDecomposition. The usage of this methods may allow later thread-safe stuff to be added if needed. Only to be used by getDecomposition() @@ -99,6 +102,10 @@ public: virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; + + void setExcludeFromBlur(bool bExcludeFromBlur) { mbExcludeFromBlur = bExcludeFromBlur; } + + bool getExcludeFromBlur() const { return mbExcludeFromBlur; } }; } // end of namespace drawinglayer::primitive2d diff --git a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx index 7df83a395f19..d388eaf1b90d 100644 --- a/include/drawinglayer/primitive2d/shadowprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/shadowprimitive2d.hxx @@ -76,6 +76,14 @@ namespace drawinglayer::primitive2d /// create decomposition virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; + void get2DDecompositionWithoutBlur( + Primitive2DDecompositionVisitor& rVisitor, + const geometry::ViewInformation2D& rViewInformation) const; + + void + get2DDecompositionWithBlur(Primitive2DDecompositionVisitor& rVisitor, + const geometry::ViewInformation2D& rViewInformation) const; + /// provide unique ID virtual sal_uInt32 getPrimitive2DID() const override; }; -- cgit