vcl/source/bitmap/bitmap.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 6d020f728b573c8c33929f8c494f9b748f576fe5
Author:     Noel Grandin <[email protected]>
AuthorDate: Sat Sep 6 09:14:16 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Sep 6 18:43:37 2025 +0200

    fix BmpConversion::N32Bit
    
    otherwise the conversion might be skipped if we currently
    have a scanline format with 32-bits and no alpha
    
    Change-Id: I89e107755e61c1b3fbe8aaabe988f1e6d62992db
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190631
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index ec0863c9bb70..28a25744f756 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -948,7 +948,8 @@ bool Bitmap::Convert( BmpConversion eConversion )
 
         case BmpConversion::N32Bit:
         {
-            if( nBitCount < 32 )
+            // check for alpha, because even if we are a 32-bit format, we 
might not be a 32-bit format with alpha
+            if( !HasAlpha() )
                 bRet = ImplConvertUp(vcl::PixelFormat::N32_BPP);
             else
                 bRet = true;
@@ -1469,7 +1470,9 @@ bool Bitmap::HasFastScale()
 void Bitmap::AdaptBitCount(Bitmap& rNew) const
 {
     // aNew is the result of some operation; adapt it's BitCount to the 
original (this)
-    if (getPixelFormat() == rNew.getPixelFormat())
+    // Also check HasAlpha() in case we are dealing with one of the 32-bit 
formats
+    // without an alpha channel.
+    if (getPixelFormat() == rNew.getPixelFormat() && HasAlpha() == 
rNew.HasAlpha())
         return;
 
     switch (getPixelFormat())

Reply via email to