drawinglayer/source/processor2d/vclpixelprocessor2d.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit a658129012f1d183f95f8bf5dd6d7ff6926cd495
Author:     Gülşah Köse <gulsah.k...@collabora.com>
AuthorDate: Thu May 26 11:03:41 2022 +0300
Commit:     Gülşah Köse <gulsah.k...@collabora.com>
CommitDate: Fri Jun 3 10:15:56 2022 +0200

    tdf#136787 Add control to create 1-bit B&W bitmap while creating mask.
    
    Glow effect creates half transparent pixels on shadow. Creating 1-bit
    B&W bitmap mask treates that half transparent pixels as black.
    We control 1-bit B&W bitmap creation when we have half transparent
    pixels.
    
    Change-Id: Iaf298a0e5ffeeb6637fe5d3f56cf4f8e30a203e4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134981
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <gulsah.k...@collabora.com>

diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 70b5331f1f79..362d0ddf9cab 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -981,11 +981,12 @@ namespace
    nTransparency defines minimal transparency level.
 */
 AlphaMask ProcessAndBlurAlphaMask(const Bitmap& rMask, double 
fErodeDilateRadius,
-                                  double fBlurRadius, sal_uInt8 nTransparency)
+                                  double fBlurRadius, sal_uInt8 nTransparency,
+                                  bool bConvertTo1Bit = true)
 {
     // Only completely white pixels on the initial mask must be considered for 
transparency. Any
     // other color must be treated as black. This creates 1-bit B&W bitmap.
-    BitmapEx mask(rMask.CreateMask(COL_WHITE));
+    BitmapEx mask(bConvertTo1Bit ? rMask.CreateMask(COL_WHITE) : rMask);
 
     // Scaling down increases performance without noticeable quality loss. 
Additionally,
     // current blur implementation can only handle blur radius between 2 and 
254.
@@ -1177,7 +1178,7 @@ void VclPixelProcessor2D::processShadowPrimitive2D(const 
primitive2d::ShadowPrim
 
         BitmapEx bitmapEx = mpOutputDevice->GetBitmapEx(aRect.TopLeft(), 
aRect.GetSize());
 
-        AlphaMask mask = ProcessAndBlurAlphaMask(bitmapEx.GetAlpha(), 0, 
fBlurRadius, 0);
+        AlphaMask mask = ProcessAndBlurAlphaMask(bitmapEx.GetAlpha(), 0, 
fBlurRadius, 0, false);
 
         const basegfx::BColor aShadowColor(
             
maBColorModifierStack.getModifiedColor(rCandidate.getShadowColor()));

Reply via email to