include/vcl/bitmap.hxx            |    6 ++++--
 vcl/source/bitmap/bitmappaint.cxx |    8 ++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit a80777836b362c551347cfef3b9cc42b4b1c7388
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Mon Sep 8 07:56:58 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Sep 8 11:41:27 2025 +0200

    tdf#168303 Option button has a rectangular border around it
    
    regression from
        commit 81260259067e706dec84542efaf7c4fc807b9a36
        Author: Noel Grandin <noel.gran...@collabora.co.uk>
        Date:   Sat Aug 9 19:29:08 2025 +0200
        BitmapEx->Bitmap in various icons
    
    The old BitmapEx::Replace methods had the odd behaviour that
    they left the alpha layer alone, so we need to replicate that
    in Bitmap::Replace
    
    Change-Id: Ic304178fb9a45750a887bee2493546bc497eeb06
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190649
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 1ce323000c6e..de1f27a69f84 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -532,7 +532,8 @@ public:
      */
     SAL_DLLPRIVATE bool ReplaceMask( const AlphaMask& rMask, const Color& 
rReplaceColor );
 
-    /** Replace all pixel having the search color with the specified color
+    /** Replace all pixel having the search color with the specified color.
+        Note that, if present, alpha data is not modified.
 
         @param rSearchColor
         Color specifying which pixel should be replaced
@@ -549,7 +550,8 @@ public:
      */
     bool Replace( const Color& rSearchColor, const Color& rReplaceColor, 
sal_uInt8 nTol = 0 );
 
-    /** Replace all pixel having one the search colors with the corresponding 
replace color
+    /** Replace all pixel having one the search colors with the corresponding 
replace color.
+        Note that, if present, alpha data is not modified.
 
         @param pSearchColors
         Array of colors specifying which pixel should be replaced
diff --git a/vcl/source/bitmap/bitmappaint.cxx 
b/vcl/source/bitmap/bitmappaint.cxx
index 8dbcbf563685..3c60d73542be 100644
--- a/vcl/source/bitmap/bitmappaint.cxx
+++ b/vcl/source/bitmap/bitmappaint.cxx
@@ -987,7 +987,9 @@ bool Bitmap::Replace(const Color& rSearchColor, const 
Color& rReplaceColor, sal_
                     && nMaxG >= aCol.GetGreen() && nMinB <= aCol.GetBlue()
                     && nMaxB >= aCol.GetBlue())
                 {
-                    pAcc->SetPixelOnData(pScanline, nX, aReplace);
+                    BitmapColor aNewCol = aReplace;
+                    aNewCol.SetAlpha(aCol.GetAlpha());
+                    pAcc->SetPixelOnData(pScanline, nX, aNewCol);
                 }
             }
         }
@@ -1081,7 +1083,9 @@ bool Bitmap::Replace(const Color* pSearchColors, const 
Color* pReplaceColors, si
                         && aMinG[i] <= aCol.GetGreen() && aMaxG[i] >= 
aCol.GetGreen()
                         && aMinB[i] <= aCol.GetBlue() && aMaxB[i] >= 
aCol.GetBlue())
                     {
-                        pAcc->SetPixelOnData(pScanline, nX, aReplaces[i]);
+                        BitmapColor aNewCol = aReplaces[i];
+                        aNewCol.SetAlpha(aCol.GetAlpha());
+                        pAcc->SetPixelOnData(pScanline, nX, aNewCol);
                         break;
                     }
                 }

Reply via email to