canvas/source/cairo/cairo_canvasbitmap.cxx |    6 -
 canvas/source/directx/dx_canvasbitmap.cxx  |  137 +----------------------------
 canvas/source/vcl/canvasbitmap.cxx         |    4 
 cppcanvas/qa/unit/test.cxx                 |    7 -
 include/vcl/BitmapTools.hxx                |    2 
 include/vcl/bitmap.hxx                     |    8 +
 include/vcl/bitmapex.hxx                   |    8 -
 vcl/headless/svpbmp.cxx                    |    2 
 vcl/inc/headless/svpbmp.hxx                |    3 
 vcl/inc/qt5/QtBitmap.hxx                   |    2 
 vcl/inc/quartz/salbmp.h                    |    3 
 vcl/inc/salbmp.hxx                         |    3 
 vcl/inc/skia/salbmp.hxx                    |    2 
 vcl/inc/win/salbmp.h                       |    3 
 vcl/qt5/QtBitmap.cxx                       |    2 
 vcl/quartz/salbmp.cxx                      |    2 
 vcl/skia/salbmp.cxx                        |    2 
 vcl/source/bitmap/BitmapEx.cxx             |   45 ---------
 vcl/source/bitmap/BitmapTools.cxx          |   28 ++---
 vcl/source/bitmap/bitmap.cxx               |   31 ++++++
 vcl/source/gdi/gdimtf.cxx                  |    8 -
 vcl/win/gdi/salbmp.cxx                     |    4 
 22 files changed, 80 insertions(+), 232 deletions(-)

New commits:
commit 4977c89e3e965c7f0c61ee4cd7a094d365ce4a62
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Thu Aug 14 18:00:50 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Aug 15 07:22:01 2025 +0200

    BitmapEx->Bitmap in CreateFromCairoSurface
    
    now that Bitmap supports transparency
    
    Change-Id: I8c890db186c1e37ea535ff515633d083fec8d8c9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189617
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx 
b/canvas/source/cairo/cairo_canvasbitmap.cxx
index 1cd03611166b..376372210c14 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.cxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.cxx
@@ -118,11 +118,11 @@ namespace cairocanvas
                 if ( !mbHasAlpha )
                     break;
 
-                BitmapEx aBitmapEx = vcl::bitmap::CreateFromCairoSurface(
+                Bitmap aBitmap = vcl::bitmap::CreateFromCairoSurface(
                                           ::Size( maSize.getWidth(), 
maSize.getHeight() ),
                                           
getSurface()->getCairoSurface().get());
-                if (!aBitmapEx.IsEmpty())
-                    aRV <<= reinterpret_cast<sal_Int64>( new 
BitmapEx(aBitmapEx) );
+                if (!aBitmap.IsEmpty())
+                    aRV <<= reinterpret_cast<sal_Int64>( new Bitmap(aBitmap) );
 
                 break;
             }
diff --git a/canvas/source/directx/dx_canvasbitmap.cxx 
b/canvas/source/directx/dx_canvasbitmap.cxx
index cfef86a536ec..ec43d031b65a 100644
--- a/canvas/source/directx/dx_canvasbitmap.cxx
+++ b/canvas/source/directx/dx_canvasbitmap.cxx
@@ -92,144 +92,17 @@ namespace dxcanvas
 
             case 1:
             {
-                if(!mpBitmap->hasAlpha())
-                {
-                    HBITMAP aHBmp;
-                    mpBitmap->getBitmap()->GetHBITMAP(Gdiplus::Color(), &aHBmp 
);
+                HBITMAP aHBmp;
+                mpBitmap->getBitmap()->GetHBITMAP(Gdiplus::Color(), &aHBmp );
 
-                    uno::Sequence< uno::Any > args{ 
uno::Any(reinterpret_cast<sal_Int64>(aHBmp)) };
-                    aRes <<= args;
-                }
-                else
-                {
-                    // need to copy&convert the bitmap, since dx
-                    // canvas uses inline alpha channel
-                    HDC hScreenDC=GetDC(nullptr);
-                    const basegfx::B2ISize aSize = mpBitmap->getSize();
-                    HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC,
-                                                                 
aSize.getWidth(),
-                                                                 
aSize.getHeight() );
-                    if( !hBmpBitmap )
-                        return aRes;
-
-                    BITMAPINFOHEADER aBIH;
-
-                    aBIH.biSize = sizeof( BITMAPINFOHEADER );
-                    aBIH.biWidth = aSize.getWidth();
-                    aBIH.biHeight = -aSize.getHeight();
-                    aBIH.biPlanes = 1;
-                    aBIH.biBitCount = 32;
-                    aBIH.biCompression = BI_RGB; // expects pixel in
-                                                 // bbggrrxx format
-                                                 // (little endian)
-                    aBIH.biSizeImage = 0;
-                    aBIH.biXPelsPerMeter = 0;
-                    aBIH.biYPelsPerMeter = 0;
-                    aBIH.biClrUsed = 0;
-                    aBIH.biClrImportant = 0;
-
-                    Gdiplus::BitmapData aBmpData;
-                    aBmpData.Width       = aSize.getWidth();
-                    aBmpData.Height      = aSize.getHeight();
-                    aBmpData.Stride      = 4*aBmpData.Width;
-                    aBmpData.PixelFormat = PixelFormat32bppARGB;
-                    aBmpData.Scan0       = nullptr;
-                    const Gdiplus::Rect aRect( 
0,0,aSize.getWidth(),aSize.getHeight() );
-                    BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap();
-                    if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect,
-                                                                 
Gdiplus::ImageLockModeRead,
-                                                                 
PixelFormat32bppARGB, // outputs ARGB (big endian)
-                                                                 &aBmpData ) )
-                    {
-                        // failed to lock, bail out
-                        return aRes;
-                    }
-
-                    // now aBmpData.Scan0 contains our bits - push
-                    // them into HBITMAP, ignoring alpha
-                    SetDIBits( hScreenDC, hBmpBitmap, 0, aSize.getHeight(), 
aBmpData.Scan0, reinterpret_cast<PBITMAPINFO>(&aBIH), DIB_RGB_COLORS );
-
-                    pGDIPlusBitmap->UnlockBits( &aBmpData );
-
-                    uno::Sequence< uno::Any > args{ 
uno::Any(reinterpret_cast<sal_Int64>(hBmpBitmap)) };
-                    aRes <<= args;
-                }
+                uno::Sequence< uno::Any > args{ 
uno::Any(reinterpret_cast<sal_Int64>(aHBmp)) };
+                aRes <<= args;
             }
             break;
 
             case 2:
             {
-                if(!mpBitmap->hasAlpha())
-                {
-                    return aRes;
-                }
-                else
-                {
-                    static AlphaDIB aDIB;
-
-                    // need to copy&convert the bitmap, since dx
-                    // canvas uses inline alpha channel
-                    HDC hScreenDC=GetDC(nullptr);
-                    const basegfx::B2ISize aSize = mpBitmap->getSize();
-                    HBITMAP hBmpBitmap = CreateCompatibleBitmap( hScreenDC, 
aSize.getWidth(), aSize.getHeight() );
-                    if( !hBmpBitmap )
-                        return aRes;
-
-                    aDIB.bmiHeader.biSize = sizeof( BITMAPINFOHEADER );
-                    aDIB.bmiHeader.biWidth = aSize.getWidth();
-                    aDIB.bmiHeader.biHeight = -aSize.getHeight();
-                    aDIB.bmiHeader.biPlanes = 1;
-                    aDIB.bmiHeader.biBitCount = 8;
-                    aDIB.bmiHeader.biCompression = BI_RGB;
-                    aDIB.bmiHeader.biSizeImage = 0;
-                    aDIB.bmiHeader.biXPelsPerMeter = 0;
-                    aDIB.bmiHeader.biYPelsPerMeter = 0;
-                    aDIB.bmiHeader.biClrUsed = 0;
-                    aDIB.bmiHeader.biClrImportant = 0;
-
-                    Gdiplus::BitmapData aBmpData;
-                    aBmpData.Width       = aSize.getWidth();
-                    aBmpData.Height      = aSize.getHeight();
-                    aBmpData.Stride      = 4*aBmpData.Width;
-                    aBmpData.PixelFormat = PixelFormat32bppARGB;
-                    aBmpData.Scan0       = nullptr;
-                    const Gdiplus::Rect aRect( 
0,0,aSize.getWidth(),aSize.getHeight() );
-                    BitmapSharedPtr pGDIPlusBitmap=mpBitmap->getBitmap();
-                    if( Gdiplus::Ok != pGDIPlusBitmap->LockBits( &aRect,
-                                                                 
Gdiplus::ImageLockModeRead,
-                                                                 
PixelFormat32bppARGB, // outputs ARGB (big endian)
-                                                                 &aBmpData ) )
-                    {
-                        // failed to lock, bail out
-                        return aRes;
-                    }
-
-                    // copy only alpha channel to pAlphaBits
-                    const sal_Int32 nScanWidth((aSize.getWidth() + 3) & ~3);
-                    std::unique_ptr<sal_uInt8[]> pAlphaBits( new 
sal_uInt8[nScanWidth*aSize.getHeight()] );
-                    const sal_uInt8* 
pInBits=static_cast<sal_uInt8*>(aBmpData.Scan0);
-                    assert(pInBits);
-                    pInBits+=3;
-                    for( sal_Int32 y=0; y<aSize.getHeight(); ++y )
-                    {
-                        sal_uInt8* pOutBits=pAlphaBits.get()+y*nScanWidth;
-                        for( sal_Int32 x=0; x<aSize.getWidth(); ++x )
-                        {
-                            *pOutBits++ = *pInBits;
-                            pInBits += 4;
-                        }
-                    }
-
-                    pGDIPlusBitmap->UnlockBits( &aBmpData );
-
-                    // set bits to newly create HBITMAP
-                    SetDIBits( hScreenDC, hBmpBitmap, 0,
-                               aSize.getHeight(), pAlphaBits.get(),
-                               reinterpret_cast<PBITMAPINFO>(&aDIB), 
DIB_RGB_COLORS );
-
-                    uno::Sequence< uno::Any > args{ 
uno::Any(reinterpret_cast<sal_Int64>(hBmpBitmap)) };
-                    aRes <<= args;
-                }
+                assert(false && "should not be calling this anymore since the 
relevant code in vcl was removed");
             }
             break;
         }
diff --git a/canvas/source/vcl/canvasbitmap.cxx 
b/canvas/source/vcl/canvasbitmap.cxx
index 2e20ebc534b2..dd6dbc77bc25 100644
--- a/canvas/source/vcl/canvasbitmap.cxx
+++ b/canvas/source/vcl/canvasbitmap.cxx
@@ -110,9 +110,9 @@ namespace vclcanvas
     uno::Any SAL_CALL CanvasBitmap::getFastPropertyValue( sal_Int32 nHandle )
     {
         if( nHandle == 0 ) {
-            BitmapEx* pBitmapEx = new BitmapEx( getBitmap() );
+            Bitmap* pBitmap = new Bitmap( getBitmap() );
 
-            return uno::Any( reinterpret_cast<sal_Int64>( pBitmapEx ) );
+            return uno::Any( reinterpret_cast<sal_Int64>( pBitmap ) );
         }
 
         return uno::Any( sal_Int64(0) );
diff --git a/cppcanvas/qa/unit/test.cxx b/cppcanvas/qa/unit/test.cxx
index 8a2d6af2365b..33b43ddc6359 100644
--- a/cppcanvas/qa/unit/test.cxx
+++ b/cppcanvas/qa/unit/test.cxx
@@ -84,13 +84,12 @@ CPPUNIT_TEST_FIXTURE(CanvasTest, testComposite)
     uno::Reference<rendering::XBitmapCanvas> xBitmapCanvas(xBitmap, 
uno::UNO_QUERY);
     CPPUNIT_ASSERT(xBitmapCanvas.is());
 
-    BitmapEx aBitmapEx;
+    Bitmap aBitmap;
     {
         // clear the canvas and basic sanity check ...
         xBitmapCanvas->clear();
-        CPPUNIT_ASSERT(aBitmapEx.Create(xBitmapCanvas, aSize));
-        CPPUNIT_ASSERT(aBitmapEx.IsAlpha());
-        CPPUNIT_ASSERT(!aBitmapEx.GetAlphaMask().IsEmpty());
+        CPPUNIT_ASSERT(aBitmap.Create(xBitmapCanvas, aSize));
+        CPPUNIT_ASSERT(aBitmap.HasAlpha());
     }
 
     {
diff --git a/include/vcl/BitmapTools.hxx b/include/vcl/BitmapTools.hxx
index b3eb65725b7d..9154c2b03ba8 100644
--- a/include/vcl/BitmapTools.hxx
+++ b/include/vcl/BitmapTools.hxx
@@ -60,7 +60,7 @@ void VCL_DLLPUBLIC fillWithData(sal_uInt8* pData, BitmapEx 
const& rBitmapEx);
 Bitmap VCL_DLLPUBLIC CreateFromData( RawBitmap && data );
 
 #if ENABLE_CAIRO_CANVAS
-VCL_DLLPUBLIC BitmapEx CreateFromCairoSurface(Size size, cairo_surface_t* 
pSurface);
+VCL_DLLPUBLIC Bitmap CreateFromCairoSurface(Size size, cairo_surface_t* 
pSurface);
 #endif
 
 VCL_DLLPUBLIC ::Bitmap CanvasTransformBitmap( const ::Bitmap& rBitmap,
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 33d9d02be8d5..32622e1ed3fd 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -38,6 +38,9 @@
 
 class BitmapEx;
 namespace basegfx { class BColorModifierStack; }
+namespace com::sun::star::rendering {
+    class XBitmapCanvas;
+}
 
 inline sal_uInt8 GAMMA(double _def_cVal, double _def_InvGamma)
 {
@@ -572,6 +575,11 @@ public:
                                 bool bInvert = false,
                                 bool msoBrightness = false );
 
+    /// populate from a canvas implementation
+    bool                Create(
+                            const css::uno::Reference< 
css::rendering::XBitmapCanvas > &xBitmapCanvas,
+                            const Size &rSize );
+
     SAL_DLLPRIVATE void ChangeColorAlpha( sal_uInt8 cIndexFrom, sal_Int8 
nAlphaTo );
 
     /**
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index f3b74479df6a..cf3055d2d607 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -28,9 +28,6 @@
 
 #include <sal/types.h>
 
-namespace com::sun::star::rendering {
-    class XBitmapCanvas;
-}
 namespace com::sun::star::uno { template <class interface_type> class 
Reference; }
 namespace basegfx { class BColorModifierStack; }
 
@@ -426,11 +423,6 @@ public:
     [[nodiscard]]
     static BitmapEx     AutoScaleBitmap( BitmapEx const & aBitmap, const 
tools::Long aStandardSize );
 
-    /// populate from a canvas implementation
-    bool                Create(
-                            const css::uno::Reference< 
css::rendering::XBitmapCanvas > &xBitmapCanvas,
-                            const Size &rSize );
-
     SAL_DLLPRIVATE void ChangeColorAlpha( sal_uInt8 cIndexFrom, sal_Int8 
nAlphaTo );
 
     /**
diff --git a/vcl/headless/svpbmp.cxx b/vcl/headless/svpbmp.cxx
index de034b2d4c7b..b1ef601e80e7 100644
--- a/vcl/headless/svpbmp.cxx
+++ b/vcl/headless/svpbmp.cxx
@@ -196,7 +196,7 @@ bool SvpSalBitmap::Create(const SalBitmap& /*rSalBmp*/,
     return false;
 }
 
-bool SvpSalBitmap::Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& /*xBitmapCanvas*/, Size& /*rSize*/, bool 
/*bMask*/ )
+bool SvpSalBitmap::Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& /*xBitmapCanvas*/, Size& /*rSize*/ )
 {
     return false;
 }
diff --git a/vcl/inc/headless/svpbmp.hxx b/vcl/inc/headless/svpbmp.hxx
index 439f7e626189..53756e25c58e 100644
--- a/vcl/inc/headless/svpbmp.hxx
+++ b/vcl/inc/headless/svpbmp.hxx
@@ -47,8 +47,7 @@ public:
     SAL_DLLPRIVATE virtual bool            Create(const SalBitmap& rSalBmp,
                                    vcl::PixelFormat eNewPixelFormat) override;
     SAL_DLLPRIVATE virtual bool            Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& rBitmapCanvas,
-                                    Size& rSize,
-                                    bool bMask = false ) override;
+                                    Size& rSize ) override;
     SAL_DLLPRIVATE void                    Create(const 
std::optional<BitmapBuffer> & pBuf);
     const BitmapBuffer*     GetBuffer() const
     {
diff --git a/vcl/inc/qt5/QtBitmap.hxx b/vcl/inc/qt5/QtBitmap.hxx
index b2adfe70ca05..1005bfe5f429 100644
--- a/vcl/inc/qt5/QtBitmap.hxx
+++ b/vcl/inc/qt5/QtBitmap.hxx
@@ -42,7 +42,7 @@ public:
     virtual bool Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) 
override;
     virtual bool Create(const SalBitmap& rSalBmp, vcl::PixelFormat 
eNewPixelFormat) override;
     virtual bool Create(const 
css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas,
-                        Size& rSize, bool bMask = false) override;
+                        Size& rSize) override;
     virtual void Destroy() final override;
     virtual Size GetSize() const override;
     virtual sal_uInt16 GetBitCount() const override;
diff --git a/vcl/inc/quartz/salbmp.h b/vcl/inc/quartz/salbmp.h
index 1ab59403cdd3..c0b30184c7c0 100644
--- a/vcl/inc/quartz/salbmp.h
+++ b/vcl/inc/quartz/salbmp.h
@@ -61,8 +61,7 @@ public:
     bool            Create( const SalBitmap& rSalBmp, SalGraphics* pGraphics ) 
override;
     bool            Create( const SalBitmap& rSalBmp, vcl::PixelFormat 
eNewPixelFormat) override;
     virtual bool    Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& rBitmapCanvas,
-                            Size& rSize,
-                            bool bMask = false ) override;
+                            Size& rSize ) override;
 
     void            Destroy() override;
 
diff --git a/vcl/inc/salbmp.hxx b/vcl/inc/salbmp.hxx
index 7ea7f9c3758b..2b1d8e479bf4 100644
--- a/vcl/inc/salbmp.hxx
+++ b/vcl/inc/salbmp.hxx
@@ -68,8 +68,7 @@ public:
     virtual bool            Create( const SalBitmap& rSalBmp,
                                     vcl::PixelFormat eNewPixelFormat) = 0;
     virtual bool            Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& rBitmapCanvas,
-                                    Size& rSize,
-                                    bool bMask = false ) = 0;
+                                    Size& rSize ) = 0;
     virtual void            Destroy() = 0;
     virtual Size            GetSize() const = 0;
     virtual sal_uInt16      GetBitCount() const = 0;
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
index f7a566317f45..f9459dbff2c9 100644
--- a/vcl/inc/skia/salbmp.hxx
+++ b/vcl/inc/skia/salbmp.hxx
@@ -42,7 +42,7 @@ public:
     virtual bool Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) 
override;
     virtual bool Create(const SalBitmap& rSalBmp, vcl::PixelFormat 
eNewPixelFormat) override;
     virtual bool Create(const 
css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas,
-                        Size& rSize, bool bMask = false) override;
+                        Size& rSize) override;
 
     virtual void Destroy() final override;
 
diff --git a/vcl/inc/win/salbmp.h b/vcl/inc/win/salbmp.h
index 685c0ffae73a..b7a5a1947a2b 100644
--- a/vcl/inc/win/salbmp.h
+++ b/vcl/inc/win/salbmp.h
@@ -76,8 +76,7 @@ public:
     virtual bool                Create( const SalBitmap& rSalBmpImpl, 
SalGraphics* pGraphics ) override;
     virtual bool                Create( const SalBitmap& rSalBmpImpl, 
vcl::PixelFormat eNewPixelFormat ) override;
     virtual bool                Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& rBitmapCanvas,
-                                           Size& rSize,
-                                           bool bMask = false ) override;
+                                           Size& rSize ) override;
 
     virtual void                Destroy() override;
 
diff --git a/vcl/qt5/QtBitmap.cxx b/vcl/qt5/QtBitmap.cxx
index 9bf28b1492cc..53277649d774 100644
--- a/vcl/qt5/QtBitmap.cxx
+++ b/vcl/qt5/QtBitmap.cxx
@@ -82,7 +82,7 @@ bool QtBitmap::Create(const SalBitmap& rSalBmp, 
vcl::PixelFormat eNewPixelFormat
 }
 
 bool QtBitmap::Create(const 
css::uno::Reference<css::rendering::XBitmapCanvas>& /*rBitmapCanvas*/,
-                      Size& /*rSize*/, bool /*bMask*/)
+                      Size& /*rSize*/)
 {
     return false;
 }
diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index 7fc4ab50d15c..725aa5574996 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -112,7 +112,7 @@ bool QuartzSalBitmap::Create( const SalBitmap& rSalBmp, 
vcl::PixelFormat eNewPix
 }
 
 bool QuartzSalBitmap::Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& /*xBitmapCanvas*/,
-                              Size& /*rSize*/, bool /*bMask*/ )
+                              Size& /*rSize*/ )
 {
     return false;
 }
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
index 1fe62570feff..ddea043133a4 100644
--- a/vcl/skia/salbmp.cxx
+++ b/vcl/skia/salbmp.cxx
@@ -184,7 +184,7 @@ bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, 
vcl::PixelFormat eNewPixelF
     return true;
 }
 
-bool SkiaSalBitmap::Create(const 
css::uno::Reference<css::rendering::XBitmapCanvas>&, Size&, bool)
+bool SkiaSalBitmap::Create(const 
css::uno::Reference<css::rendering::XBitmapCanvas>&, Size&)
 {
     return false;
 }
diff --git a/vcl/source/bitmap/BitmapEx.cxx b/vcl/source/bitmap/BitmapEx.cxx
index 9c8436ebbd52..dcc349f5734b 100644
--- a/vcl/source/bitmap/BitmapEx.cxx
+++ b/vcl/source/bitmap/BitmapEx.cxx
@@ -43,12 +43,9 @@
 #include <bitmap/BitmapMaskToAlphaFilter.hxx>
 #include <bitmap/BlendFrameCache.hxx>
 
-#include <o3tl/any.hxx>
 #include <tools/stream.hxx>
 #include <vcl/filter/PngImageWriter.hxx>
 
-#include <com/sun/star/beans/XFastPropertySet.hpp>
-
 #include <memory>
 
 using namespace ::com::sun::star;
@@ -565,48 +562,6 @@ Color BitmapEx::GetPixelColor(sal_Int32 nX, sal_Int32 nY) 
const
     return aColor;
 }
 
-// Shift alpha transparent pixels between cppcanvas/ implementations
-// and vcl in a generally grotesque and under-performing fashion
-bool BitmapEx::Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas > &xBitmapCanvas,
-                       const Size &rSize )
-{
-    uno::Reference< beans::XFastPropertySet > xFastPropertySet( xBitmapCanvas, 
uno::UNO_QUERY );
-    if( xFastPropertySet )
-    {
-        // 0 means get BitmapEx
-        uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
-        std::unique_ptr<BitmapEx> 
xBitmapEx(reinterpret_cast<BitmapEx*>(*o3tl::doAccess<sal_Int64>(aAny)));
-        if( xBitmapEx )
-        {
-            *this = *xBitmapEx;
-            return true;
-        }
-    }
-
-    std::shared_ptr<SalBitmap> pSalBmp;
-    std::shared_ptr<SalBitmap> pSalMask;
-
-    pSalBmp = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-
-    Size aLocalSize(rSize);
-    if( pSalBmp->Create( xBitmapCanvas, aLocalSize ) )
-    {
-        pSalMask = ImplGetSVData()->mpDefInst->CreateSalBitmap();
-        if ( pSalMask->Create( xBitmapCanvas, aLocalSize, true ) )
-        {
-            *this = BitmapEx(Bitmap(std::move(pSalBmp)), 
Bitmap(std::move(pSalMask)) );
-            return true;
-        }
-        else
-        {
-            *this = BitmapEx(Bitmap(std::move(pSalBmp)));
-            return true;
-        }
-    }
-
-    return false;
-}
-
 namespace
 {
     Bitmap impTransformBitmap(
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index cc09187b7c99..ea2be0129746 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -310,7 +310,7 @@ void fillWithData(sal_uInt8* pData, BitmapEx const& 
rBitmapEx)
 
 
 #if ENABLE_CAIRO_CANVAS
-BitmapEx CreateFromCairoSurface(Size aSize, cairo_surface_t * pSurface)
+Bitmap CreateFromCairoSurface(Size aSize, cairo_surface_t * pSurface)
 {
     // FIXME: if we could teach VCL/ about cairo handles, life could
     // be significantly better here perhaps.
@@ -319,7 +319,7 @@ BitmapEx CreateFromCairoSurface(Size aSize, cairo_surface_t 
* pSurface)
             CAIRO_FORMAT_ARGB32, aSize.Width(), aSize.Height());
     cairo_t *pCairo = cairo_create( pPixels );
     if( !pPixels || !pCairo || cairo_status(pCairo) != CAIRO_STATUS_SUCCESS )
-        return BitmapEx();
+        return Bitmap();
 
     // suck ourselves from the X server to this buffer so then we can fiddle 
with
     // Alpha to turn it into the ultra-lame vcl required format and then push 
it
@@ -328,18 +328,12 @@ BitmapEx CreateFromCairoSurface(Size aSize, 
cairo_surface_t * pSurface)
     cairo_set_operator( pCairo, CAIRO_OPERATOR_SOURCE );
     cairo_paint( pCairo );
 
-    Bitmap aRGB(aSize, vcl::PixelFormat::N24_BPP);
-    ::AlphaMask aMask( aSize );
-
-    BitmapScopedWriteAccess pRGBWrite(aRGB);
-    assert(pRGBWrite);
-    if (!pRGBWrite)
-        return BitmapEx();
+    Bitmap aRGBA(aSize, vcl::PixelFormat::N32_BPP);
 
-    BitmapScopedWriteAccess pMaskWrite(aMask);
-    assert(pMaskWrite);
-    if (!pMaskWrite)
-        return BitmapEx();
+    BitmapScopedWriteAccess pRGBAWrite(aRGBA);
+    assert(pRGBAWrite);
+    if (!pRGBAWrite)
+        return Bitmap();
 
     cairo_surface_flush(pPixels);
     unsigned char *pSrc = cairo_image_surface_get_data( pPixels );
@@ -376,20 +370,20 @@ BitmapEx CreateFromCairoSurface(Size aSize, 
cairo_surface_t * pSurface)
                 nB = unpremultiply_table[nAlpha][nB];
 #endif
             }
-            pRGBWrite->SetPixel( y, x, BitmapColor( nR, nG, nB ) );
-            pMaskWrite->SetPixelIndex( y, x, nAlpha );
+            pRGBAWrite->SetPixel( y, x, BitmapColor( ColorAlpha, nR, nG, nB, 
nAlpha ) );
             pPix++;
         }
     }
 
+    pRGBAWrite.reset();
+
     // ignore potential errors above. will get caller a
     // uniformly white bitmap, but not that there would
     // be error handling in calling code ...
-    ::BitmapEx aBitmapEx( aRGB, aMask );
 
     cairo_destroy( pCairo );
     cairo_surface_destroy( pPixels );
-    return aBitmapEx;
+    return aRGBA;
 }
 #endif
 
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index d51cfa93e69d..2f90f012967a 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -46,6 +46,8 @@
 #include <vcl/BitmapWriteAccess.hxx>
 #include <bitmap/impoctree.hxx>
 #include <bitmap/Octree.hxx>
+#include <com/sun/star/beans/XFastPropertySet.hpp>
+#include <o3tl/any.hxx>
 
 #include "floyd.hxx"
 
@@ -2192,4 +2194,33 @@ void Bitmap::AdjustTransparency(sal_uInt8 cTrans)
     }
 }
 
+// Shift alpha transparent pixels between cppcanvas/ implementations
+// and vcl in a generally grotesque and under-performing fashion
+bool Bitmap::Create( const css::uno::Reference< css::rendering::XBitmapCanvas 
> &xBitmapCanvas,
+                       const Size &rSize )
+{
+    css::uno::Reference< css::beans::XFastPropertySet > xFastPropertySet( 
xBitmapCanvas, css::uno::UNO_QUERY );
+    if( xFastPropertySet )
+    {
+        // 0 means get Bitmap
+        css::uno::Any aAny = xFastPropertySet->getFastPropertyValue( 0 );
+        std::unique_ptr<Bitmap> 
xBitmap(reinterpret_cast<Bitmap*>(*o3tl::doAccess<sal_Int64>(aAny)));
+        if( xBitmap )
+        {
+            *this = *xBitmap;
+            return true;
+        }
+    }
+
+    std::shared_ptr<SalBitmap> pSalBmp = 
ImplGetSVData()->mpDefInst->CreateSalBitmap();
+    Size aLocalSize(rSize);
+    if( pSalBmp->Create( xBitmapCanvas, aLocalSize ) )
+    {
+        *this = Bitmap(std::move(pSalBmp));
+        return true;
+    }
+
+    return false;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index fb7fd140cea4..0163f4ab92fe 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -430,13 +430,13 @@ bool GDIMetaFile::ImplPlayWithRenderer(OutputDevice& 
rOut, const Point& rPos, Si
 
                 xMtfRenderer->draw( rDestSize.Width(), rDestSize.Height() );
 
-                BitmapEx aBitmapEx;
-                if( aBitmapEx.Create( xBitmapCanvas, aSize ) )
+                Bitmap aBitmap;
+                if( aBitmap.Create( xBitmapCanvas, aSize ) )
                 {
                     if (rOut.GetMapMode().GetMapUnit() == MapUnit::MapPixel)
-                        rOut.DrawBitmapEx( rPos, aBitmapEx );
+                        rOut.DrawBitmapEx( rPos, aBitmap );
                     else
-                        rOut.DrawBitmapEx( rPos, rLogicDestSize, aBitmapEx );
+                        rOut.DrawBitmapEx( rPos, rLogicDestSize, aBitmap );
                     return true;
                 }
             }
diff --git a/vcl/win/gdi/salbmp.cxx b/vcl/win/gdi/salbmp.cxx
index dd3fb6119377..3475377351d1 100644
--- a/vcl/win/gdi/salbmp.cxx
+++ b/vcl/win/gdi/salbmp.cxx
@@ -580,7 +580,7 @@ bool WinSalBitmap::Create(const SalBitmap& rSSalBmp, 
vcl::PixelFormat eNewPixelF
     return bRet;
 }
 
-bool WinSalBitmap::Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& rBitmapCanvas, Size& /*rSize*/, bool bMask )
+bool WinSalBitmap::Create( const css::uno::Reference< 
css::rendering::XBitmapCanvas >& rBitmapCanvas, Size& /*rSize*/ )
 {
     css::uno::Reference< css::beans::XFastPropertySet >
         xFastPropertySet( rBitmapCanvas, css::uno::UNO_QUERY );
@@ -590,7 +590,7 @@ bool WinSalBitmap::Create( const css::uno::Reference< 
css::rendering::XBitmapCan
         return false;
 
     css::uno::Sequence< css::uno::Any > args;
-    if( !(xFastPropertySet->getFastPropertyValue(bMask ? 2 : 1) >>= args) )
+    if( !(xFastPropertySet->getFastPropertyValue(1) >>= args) )
         return false;
 
     sal_Int64 aHBmp64;

Reply via email to