include/vcl/opengl/OpenGLHelper.hxx |    4 ++--
 vcl/source/opengl/OpenGLHelper.cxx  |   23 ++++++++---------------
 2 files changed, 10 insertions(+), 17 deletions(-)

New commits:
commit 4da7f18468d9a720fe84996b333ab361a51feb27
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Jul 29 16:48:36 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Jul 30 11:51:17 2025 +0200

    BitmapEx->Bitmap in OpenGLHelper::ConvertBufferToBitmap
    
    now that Bitmap can handle transparency
    
    Change-Id: I3f56c333d2f222385630d9699ed96617592e0648
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188538
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/vcl/opengl/OpenGLHelper.hxx 
b/include/vcl/opengl/OpenGLHelper.hxx
index 86e6e766fae3..561bf1475002 100644
--- a/include/vcl/opengl/OpenGLHelper.hxx
+++ b/include/vcl/opengl/OpenGLHelper.hxx
@@ -14,7 +14,7 @@
 #include <epoxy/gl.h>
 #include <sal/detail/log.h>
 #include <vcl/dllapi.h>
-#include <vcl/bitmapex.hxx>
+#include <vcl/bitmap.hxx>
 
 #include <rtl/ustring.hxx>
 #include <sstream>
@@ -63,7 +63,7 @@ public:
      * this method. The buffer size is assumed to be 4*width*height and the 
format
      * to be OptimalBufferFormat().
     **/
-    SAL_DLLPRIVATE static BitmapEx ConvertBufferToBitmapEx(const sal_uInt8* 
const pBuffer, tools::Long nWidth, tools::Long nHeight);
+    SAL_DLLPRIVATE static Bitmap ConvertBufferToBitmap(const sal_uInt8* const 
pBuffer, tools::Long nWidth, tools::Long nHeight);
     /**
      * Returns the optimal buffer format for OpenGL (GL_BGRA or GL_RGBA).
     **/
diff --git a/vcl/source/opengl/OpenGLHelper.cxx 
b/vcl/source/opengl/OpenGLHelper.cxx
index 6e8ea0c95817..efd85ce24f03 100644
--- a/vcl/source/opengl/OpenGLHelper.cxx
+++ b/vcl/source/opengl/OpenGLHelper.cxx
@@ -529,7 +529,7 @@ void OpenGLHelper::renderToFile(tools::Long nWidth, 
tools::Long nHeight, const O
 
     std::unique_ptr<sal_uInt8[]> pBuffer(new sal_uInt8[nWidth*nHeight*4]);
     glReadPixels(0, 0, nWidth, nHeight, OptimalBufferFormat(), 
GL_UNSIGNED_BYTE, pBuffer.get());
-    BitmapEx aBitmap = ConvertBufferToBitmapEx(pBuffer.get(), nWidth, nHeight);
+    Bitmap aBitmap = ConvertBufferToBitmap(pBuffer.get(), nWidth, nHeight);
     try {
         SvFileStream sOutput( rFileName, StreamMode::WRITE );
         vcl::PngImageWriter aWriter( sOutput );
@@ -551,48 +551,41 @@ GLenum OpenGLHelper::OptimalBufferFormat()
 #endif
 }
 
-BitmapEx OpenGLHelper::ConvertBufferToBitmapEx(const sal_uInt8* const pBuffer, 
tools::Long nWidth, tools::Long nHeight)
+Bitmap OpenGLHelper::ConvertBufferToBitmap(const sal_uInt8* const pBuffer, 
tools::Long nWidth, tools::Long nHeight)
 {
     assert(pBuffer);
-    Bitmap aBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
-    AlphaMask aAlpha(Size(nWidth, nHeight));
+    Bitmap aBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N32_BPP);
 
     {
         BitmapScopedWriteAccess pWriteAccess( aBitmap );
-        BitmapScopedWriteAccess pAlphaWriteAccess( aAlpha );
 #ifdef _WIN32
-        assert(pWriteAccess->GetScanlineFormat() == 
ScanlineFormat::N24BitTcBgr);
+        assert(pWriteAccess->GetScanlineFormat() == 
ScanlineFormat::N32BitTcBgra);
         assert(pWriteAccess->IsTopDown());
-        assert(pAlphaWriteAccess->IsTopDown());
 #else
-        assert(pWriteAccess->GetScanlineFormat() == 
ScanlineFormat::N24BitTcRgb);
+        assert(pWriteAccess->GetScanlineFormat() == 
ScanlineFormat::N32BitTcRgba);
         assert(!pWriteAccess->IsTopDown());
-        assert(!pAlphaWriteAccess->IsTopDown());
 #endif
-        assert(pAlphaWriteAccess->GetScanlineFormat() == 
ScanlineFormat::N8BitPal);
 
         size_t nCurPos = 0;
         for( tools::Long y = 0; y < nHeight; ++y)
         {
 #ifdef _WIN32
             Scanline pScan = pWriteAccess->GetScanline(y);
-            Scanline pAlphaScan = pAlphaWriteAccess->GetScanline(y);
 #else
             Scanline pScan = pWriteAccess->GetScanline(nHeight-1-y);
-            Scanline pAlphaScan = pAlphaWriteAccess->GetScanline(nHeight-1-y);
 #endif
             for( tools::Long x = 0; x < nWidth; ++x )
             {
                 *pScan++ = pBuffer[nCurPos];
                 *pScan++ = pBuffer[nCurPos+1];
                 *pScan++ = pBuffer[nCurPos+2];
+                *pScan++ = pBuffer[nCurPos+3];
 
-                nCurPos += 3;
-                *pAlphaScan++ = pBuffer[nCurPos++];
+                nCurPos += 4;
             }
         }
     }
-    return BitmapEx(aBitmap, aAlpha);
+    return aBitmap;
 }
 
 const char* OpenGLHelper::GLErrorString(GLenum errorCode)

Reply via email to