svx/qa/unit/table.cxx                                |   14 ++++++--------
 svx/source/sdr/primitive2d/sdrdecompositiontools.cxx |   13 ++-----------
 2 files changed, 8 insertions(+), 19 deletions(-)

New commits:
commit 98319164284c4a25d6a2313e6b8a35d244d94e91
Author:     Sarper Akdemir <sarper.akdemir.ext...@allotropia.de>
AuthorDate: Mon Sep 4 18:10:22 2023 +0300
Commit:     Sarper Akdemir <sarper.akdemir.ext...@allotropia.de>
CommitDate: Tue Sep 5 13:21:13 2023 +0200

    tdf#150557: svx: don't factor in transparence twice for cell shadows
    
    multiplying child transparence with shadow alpha to get the
    correct shadow alpha has been incorrect maybe since commits:
    7eb4f92ed90e13ce5cbf7286fae623770e71324c,
    e735ad1c57cddaf17d6ffc0cf15b5e14fa63c4ad
    
    In ShadowPrimitive2D::create2DDecomposition the
    shadow-casting primitive's alpha(mask) itself is already
    being taken into account.
    
    Therefore getting cell shadow alpha by multiplying child
    transparence with shadow alpha, has the effect of child
    transparence being applied twice for the table cell.
    
    Change-Id: I78f9bbfcb0694a86eabc061330677784e887b5dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156528
    Tested-by: Jenkins
    Reviewed-by: Sarper Akdemir <sarper.akdemir.ext...@allotropia.de>

diff --git a/svx/qa/unit/table.cxx b/svx/qa/unit/table.cxx
index dc3ad1e2bf67..72359dbc7820 100644
--- a/svx/qa/unit/table.cxx
+++ b/svx/qa/unit/table.cxx
@@ -73,17 +73,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur)
     drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
         = renderPageToPrimitives(xDrawPage);
 
-    // Then make sure that the cell fill part of the shadow is excluded from 
blurring:
+    // Then make sure that the cell fill part of the shadow has the expected 
transparency:
     drawinglayer::Primitive2dXmlDump aDumper;
     xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
     // Without the accompanying fix in place, this test would have failed with:
-    // - number of nodes is incorrect
-    // - Expected: 1
-    // - Actual  : 0
-    // i.e. the shadow itself was not transparent and that resulted in a 
non-transparent rendering
-    // as well, while the rendering transparency should be based on the 
transparency of the shadow
-    // itself and the transparency of the cell fill.
-    assertXPath(pDocument, "//objectinfo/unifiedtransparence[1]", 
"transparence", "80");
+    //- Expected: 0
+    //- Actual  : 2
+    //- In <>, XPath contents of child does not match
+    // i.e. the shadow's transparency was miscalculated.
+    assertXPathContent(pDocument, "count(//objectinfo/unifiedtransparence)", 
"0");
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape)
diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx 
b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
index b5df830d73fe..33e42efc6d23 100644
--- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
+++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx
@@ -850,25 +850,16 @@ sal_uInt32 
SlideBackgroundFillPrimitive2D::getPrimitive2DID() const
             Primitive2DContainer aRetval;
             for (const auto& xChild : rContentForShadow)
             {
-                double fChildTransparence = 0.0;
-                auto pChild = 
dynamic_cast<BufferedDecompositionPrimitive2D*>(xChild.get());
-                if (pChild)
-                {
-                        fChildTransparence = 
pChild->getTransparenceForShadow();
-                        fChildTransparence /= 100;
-                }
                 aRetval.push_back(Primitive2DReference(
                     new ShadowPrimitive2D(aShadowOffset, rShadow.getColor(), 
rShadow.getBlur(),
                                             Primitive2DContainer({ xChild 
}))));
-                if (rShadow.getTransparence() != 0.0 || fChildTransparence != 
0.0)
+                if (rShadow.getTransparence() != 0.0)
                 {
                     Primitive2DContainer aTempContent{ aRetval.back() };
 
-                    double fChildAlpha = 1.0 - fChildTransparence;
                     double fShadowAlpha = 1.0 - rShadow.getTransparence();
-                    double fTransparence = 1.0 - fChildAlpha * fShadowAlpha;
                     aRetval.back() = Primitive2DReference(new 
UnifiedTransparencePrimitive2D(
-                            std::move(aTempContent), fTransparence));
+                            std::move(aTempContent), fShadowAlpha));
                 }
             }
 

Reply via email to