desktop/source/lib/init.cxx       |    4 ++--
 include/vcl/BitmapTools.hxx       |    2 +-
 vcl/source/bitmap/BitmapTools.cxx |   23 ++++++++---------------
 3 files changed, 11 insertions(+), 18 deletions(-)

New commits:
commit 42a878a5ee854e8bad2364a97ef53fa38b67e6bf
Author:     Noel Grandin <[email protected]>
AuthorDate: Fri Aug 29 12:33:57 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sat Aug 30 13:53:59 2025 +0200

    BitmapEx->Bitmap in fillWithData
    
    now that Bitmap can handle transparency
    
    Change-Id: I8cb62be78af52963b95ec08eb3999c3b327fa777
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190407
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9b7c95c8528e..c53a51014e76 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4327,8 +4327,8 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #ifdef _WIN32
     // pBuffer was not used there
     pDevice->EnableMapMode(false);
-    BitmapEx aBmpEx(pDevice->GetBitmap({ 0, 0 }, { nCanvasWidth, nCanvasHeight 
}));
-    vcl::bitmap::fillWithData(pBuffer, aBmpEx);
+    Bitmap aBmp(pDevice->GetBitmap({ 0, 0 }, { nCanvasWidth, nCanvasHeight }));
+    vcl::bitmap::fillWithData(pBuffer, aBmp);
 #endif
 #endif
 
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index 822c1f984e32..3172218797af 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -55,7 +55,7 @@ Bitmap VCL_DLLPUBLIC CreateFromData(sal_uInt8 const *pData,
                                       sal_Int8 nBitsPerPixel,
                                       bool bReversColors = false, bool 
bReverseAlpha = false);
 
-void VCL_DLLPUBLIC fillWithData(sal_uInt8* pData, BitmapEx const& rBitmapEx);
+void VCL_DLLPUBLIC fillWithData(sal_uInt8* pData, Bitmap const& rBitmap);
 
 Bitmap VCL_DLLPUBLIC CreateFromData( RawBitmap && data );
 
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index 10181b2b33e2..dfeba08ffc6a 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -279,31 +279,24 @@ Bitmap CreateFromData( RawBitmap&& rawBitmap )
     return aBmp;
 }
 
-void fillWithData(sal_uInt8* pData, BitmapEx const& rBitmapEx)
+void fillWithData(sal_uInt8* pData, Bitmap const& rBitmap)
 {
-    const Bitmap& aBitmap = rBitmapEx.GetBitmap();
-    const AlphaMask& aAlphaMask = rBitmapEx.GetAlphaMask();
-    BitmapScopedReadAccess aReadAccessBitmap(aBitmap);
-    BitmapScopedReadAccess aReadAccessAlpha(aAlphaMask);
-
-    assert(!aReadAccessAlpha || aReadAccessBitmap->Height() == 
aReadAccessAlpha->Height());
-    assert(!aReadAccessAlpha || aReadAccessBitmap->Width() == 
aReadAccessAlpha->Width());
+    BitmapScopedReadAccess aReadAccess(rBitmap);
+    assert(aReadAccess);
 
     sal_uInt8* p = pData;
 
-    for (tools::Long y = 0, nHeight = aReadAccessBitmap->Height(); y < 
nHeight; ++y)
+    for (tools::Long y = 0, nHeight = aReadAccess->Height(); y < nHeight; ++y)
     {
-        Scanline dataBitmap = aReadAccessBitmap->GetScanline(y);
-        Scanline dataAlpha = aReadAccessAlpha ? 
aReadAccessAlpha->GetScanline(y) : nullptr;
+        Scanline pScanline = aReadAccess->GetScanline(y);
 
-        for (tools::Long x = 0, nWidth = aReadAccessBitmap->Width(); x < 
nWidth; ++x)
+        for (tools::Long x = 0, nWidth = aReadAccess->Width(); x < nWidth; ++x)
         {
-            BitmapColor aColor = 
aReadAccessBitmap->GetPixelFromData(dataBitmap, x);
-            sal_uInt8 aAlpha = dataAlpha ? 
aReadAccessAlpha->GetPixelFromData(dataAlpha, x).GetBlue() : 255;
+            BitmapColor aColor = aReadAccess->GetPixelFromData(pScanline, x);
             *p++ = aColor.GetBlue();
             *p++ = aColor.GetGreen();
             *p++ = aColor.GetRed();
-            *p++ = aAlpha;
+            *p++ = aColor.GetAlpha();
         }
     }
 }

Reply via email to