drawinglayer/source/tools/wmfemfhelper.cxx |    6 ++---
 include/vcl/wall.hxx                       |   12 +++++-----
 vcl/source/control/ivctrl.cxx              |    2 -
 vcl/source/filter/eps/eps.cxx              |    2 -
 vcl/source/gdi/gdimtf.cxx                  |    2 -
 vcl/source/gdi/mtfxmldump.cxx              |   20 ++++++++++++------
 vcl/source/gdi/pdfwriter_impl.cxx          |    2 -
 vcl/source/gdi/wall.cxx                    |   10 ++++-----
 vcl/source/outdev/wallpaper.cxx            |   32 ++++++++++++++---------------
 9 files changed, 48 insertions(+), 40 deletions(-)

New commits:
commit 8313486d9bad539b11fa08fcc2c7ff34914208ca
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Tue Aug 12 20:26:36 2025 +0200
Commit:     Noel Grandin <noelgran...@gmail.com>
CommitDate: Wed Aug 13 07:41:48 2025 +0200

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

diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx 
b/drawinglayer/source/tools/wmfemfhelper.cxx
index 4cfa6e0b967b..06f23c9bb702 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -921,12 +921,12 @@ namespace wmfemfhelper
         TargetHolder& rTarget,
         PropertyHolder const & rProperty)
     {
-        const BitmapEx& aBitmapEx(rWallpaper.GetBitmap());
+        const Bitmap& aBitmap(rWallpaper.GetBitmap());
         const WallpaperStyle eWallpaperStyle(rWallpaper.GetStyle());
 
         // if bitmap visualisation is transparent, maybe background
         // needs to be filled. Create background
-        if(aBitmapEx.IsAlpha()
+        if(aBitmap.HasAlpha()
             || (WallpaperStyle::Tile != eWallpaperStyle && 
WallpaperStyle::Scale != eWallpaperStyle))
         {
             if(rWallpaper.IsGradient())
@@ -956,7 +956,7 @@ namespace wmfemfhelper
         rtl::Reference<drawinglayer::primitive2d::BasePrimitive2D> 
pBitmapWallpaperFill =
             new drawinglayer::primitive2d::WallpaperBitmapPrimitive2D(
                 aWallpaperRange,
-                aBitmapEx,
+                BitmapEx(aBitmap),
                 eWallpaperStyle);
 
         if(rProperty.getTransformation().isIdentity())
diff --git a/include/vcl/wall.hxx b/include/vcl/wall.hxx
index 617027cb1fce..c28cbce1c78a 100644
--- a/include/vcl/wall.hxx
+++ b/include/vcl/wall.hxx
@@ -48,8 +48,8 @@ enum class WallpaperStyle
 class VCL_DLLPUBLIC Wallpaper
 {
 public:
-    SAL_DLLPRIVATE void             ImplSetCachedBitmap( const BitmapEx& rBmp 
) const;
-    SAL_DLLPRIVATE const BitmapEx*  ImplGetCachedBitmap() const;
+    SAL_DLLPRIVATE void             ImplSetCachedBitmap( const Bitmap& rBmp ) 
const;
+    SAL_DLLPRIVATE const Bitmap*    ImplGetCachedBitmap() const;
     SAL_DLLPRIVATE void             ImplReleaseCachedBitmap() const;
 
 private:
@@ -70,8 +70,8 @@ public:
     void            SetStyle( WallpaperStyle eStyle );
     WallpaperStyle  GetStyle() const { return meStyle; }
 
-    void            SetBitmap( const BitmapEx& rBitmap );
-    const BitmapEx & GetBitmap() const;
+    void            SetBitmap( const Bitmap& rBitmap );
+    const Bitmap &  GetBitmap() const;
     bool            IsBitmap() const;
 
     void            SetGradient( const Gradient& rGradient );
@@ -100,8 +100,8 @@ public:
     friend SvStream& WriteWallpaper( SvStream& rOStm, const Wallpaper& 
rWallpaper );
 private:
     tools::Rectangle            maRect;
-    BitmapEx                    maBitmap;
-    mutable BitmapEx            maCache;
+    Bitmap                      maBitmap;
+    mutable Bitmap              maCache;
     std::optional<Gradient>     mpGradient;
     Color                       maColor;
     WallpaperStyle              meStyle;
diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx
index b34c3ae36203..58d9bb08bd5d 100644
--- a/vcl/source/control/ivctrl.cxx
+++ b/vcl/source/control/ivctrl.cxx
@@ -278,7 +278,7 @@ void SvtIconChoiceCtrl::SetBackground( const Wallpaper& 
rPaper )
         Color aBack( aBackground.GetColor());
         if( aBack == COL_TRANSPARENT &&
             (!aBackground.IsBitmap() ||
-             aBackground.GetBitmap().IsAlpha() ||
+             aBackground.GetBitmap().HasAlpha() ||
              (eStyle != WallpaperStyle::Tile && eStyle != 
WallpaperStyle::Scale)) )
         {
             aBackground.SetColor( rStyleSettings.GetFieldColor() );
diff --git a/vcl/source/filter/eps/eps.cxx b/vcl/source/filter/eps/eps.cxx
index 314b182acf1e..44f42414a596 100644
--- a/vcl/source/filter/eps/eps.cxx
+++ b/vcl/source/filter/eps/eps.cxx
@@ -897,7 +897,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, 
VirtualDevice& rVDev )
 
                 if ( aWallpaper.IsBitmap() )
                 {
-                    BitmapEx aBitmapEx = aWallpaper.GetBitmap();
+                    BitmapEx aBitmapEx(aWallpaper.GetBitmap());
                     const Bitmap& aBitmap( aBitmapEx.GetBitmap() );
                     if ( aBitmapEx.IsAlpha() )
                     {
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 77bdf0f555b3..fb7fd140cea4 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -1915,7 +1915,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc 
pFncCol, const void* pCol
                 aWall.SetColor( pFncCol( aWall.GetColor(), pColParam ) );
 
                 if( aWall.IsBitmap() )
-                    aWall.SetBitmap( pFncBmp( aWall.GetBitmap(), pBmpParam ) );
+                    aWall.SetBitmap( Bitmap(pFncBmp( 
BitmapEx(aWall.GetBitmap()), pBmpParam )) );
 
                 if( aWall.IsGradient() )
                 {
diff --git a/vcl/source/gdi/mtfxmldump.cxx b/vcl/source/gdi/mtfxmldump.cxx
index 8f490608d1e6..24cd96ce5964 100644
--- a/vcl/source/gdi/mtfxmldump.cxx
+++ b/vcl/source/gdi/mtfxmldump.cxx
@@ -340,6 +340,14 @@ OUString convertBitmapExTransparentType(BitmapEx const & 
rBitmapEx)
         return u"none"_ustr;
 }
 
+OUString convertBitmapTransparentType(Bitmap const & rBitmap)
+{
+    if (rBitmap.HasAlpha())
+        return u"bitmap"_ustr;
+    else
+        return u"none"_ustr;
+}
+
 OUString convertMapUnitToString(MapUnit eUnit)
 {
     switch (eUnit)
@@ -1144,12 +1152,12 @@ void MetafileXmlDump::writeXml(const GDIMetaFile& 
rMetaFile, tools::XmlWriter& r
                 if (rWallpaper.IsBitmap())
                 {
                     rWriter.startElement("bitmap");
-                    BitmapEx const & rBitmapEx = rWallpaper.GetBitmap();
-                    rWriter.attribute("crc", hex32(rBitmapEx.GetChecksum()));
-                    rWriter.attribute("transparenttype", 
convertBitmapExTransparentType(rBitmapEx));
-                    rWriter.attribute("pixelformat", 
convertPixelFormatToString(rBitmapEx.GetBitmap().getPixelFormat()));
-                    rWriter.attribute("width", 
hex32(rBitmapEx.GetSizePixel().Width()));
-                    rWriter.attribute("height", 
hex32(rBitmapEx.GetSizePixel().Height()));
+                    Bitmap const & rBitmap = rWallpaper.GetBitmap();
+                    rWriter.attribute("crc", hex32(rBitmap.GetChecksum()));
+                    rWriter.attribute("transparenttype", 
convertBitmapTransparentType(rBitmap));
+                    rWriter.attribute("pixelformat", 
convertPixelFormatToString(rBitmap.getPixelFormat()));
+                    rWriter.attribute("width", 
hex32(rBitmap.GetSizePixel().Width()));
+                    rWriter.attribute("height", 
hex32(rBitmap.GetSizePixel().Height()));
                     rWriter.endElement();
                 }
 
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index e3419c65d282..20944738d2ed 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -10199,7 +10199,7 @@ void PDFWriterImpl::drawWallpaper( const 
tools::Rectangle& rRect, const Wallpape
     Size aBmpSize;
     if( rWall.IsBitmap() )
     {
-        aBitmap = Bitmap(rWall.GetBitmap());
+        aBitmap = rWall.GetBitmap();
         aBmpSize = lcl_convert( aBitmap.GetPrefMapMode(),
                                 getMapMode(),
                                 this,
diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx
index d797e629c16f..3952452f028c 100644
--- a/vcl/source/gdi/wall.cxx
+++ b/vcl/source/gdi/wall.cxx
@@ -132,7 +132,7 @@ Wallpaper::Wallpaper( const Color& rColor )
 
 Wallpaper::Wallpaper( const BitmapEx& rBmpEx )
 {
-    maBitmap   = rBmpEx;
+    maBitmap   = Bitmap(rBmpEx);
     meStyle    = WallpaperStyle::Tile;
 }
 
@@ -144,12 +144,12 @@ Wallpaper::Wallpaper( const Bitmap& rBmp )
 
 Wallpaper::~Wallpaper() = default;
 
-void Wallpaper::ImplSetCachedBitmap( const BitmapEx& rBmp ) const
+void Wallpaper::ImplSetCachedBitmap( const Bitmap& rBmp ) const
 {
     maCache = rBmp;
 }
 
-const BitmapEx* Wallpaper::ImplGetCachedBitmap() const
+const Bitmap* Wallpaper::ImplGetCachedBitmap() const
 {
     return maCache.IsEmpty() ? nullptr : &maCache;
 }
@@ -178,7 +178,7 @@ void Wallpaper::SetStyle( WallpaperStyle eStyle )
     meStyle = eStyle;
 }
 
-void Wallpaper::SetBitmap( const BitmapEx& rBitmap )
+void Wallpaper::SetBitmap( const Bitmap& rBitmap )
 {
     maCache.SetEmpty();
     maBitmap = rBitmap;
@@ -187,7 +187,7 @@ void Wallpaper::SetBitmap( const BitmapEx& rBitmap )
         meStyle = WallpaperStyle::Tile;
 }
 
-const BitmapEx & Wallpaper::GetBitmap() const
+const Bitmap & Wallpaper::GetBitmap() const
 {
     return maBitmap;
 }
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index 0dc451c2122e..61b4daf03fc7 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -132,20 +132,20 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
 {
     assert(!is_double_buffered_window());
 
-    const BitmapEx* pCached = rWallpaper.ImplGetCachedBitmap();
+    const Bitmap* pCached = rWallpaper.ImplGetCachedBitmap();
 
     GDIMetaFile* pOldMetaFile = mpMetaFile;
     const bool bOldMap = mbMap;
 
-    BitmapEx aBmpEx;
+    Bitmap aBmp;
     if( pCached )
-        aBmpEx = *pCached;
+        aBmp = *pCached;
     else
-        aBmpEx = rWallpaper.GetBitmap();
+        aBmp = rWallpaper.GetBitmap();
 
-    const tools::Long nBmpWidth = aBmpEx.GetSizePixel().Width();
-    const tools::Long nBmpHeight = aBmpEx.GetSizePixel().Height();
-    const bool bTransparent = aBmpEx.IsAlpha();
+    const tools::Long nBmpWidth = aBmp.GetSizePixel().Width();
+    const tools::Long nBmpHeight = aBmp.GetSizePixel().Height();
+    const bool bTransparent = aBmp.HasAlpha();
 
     const WallpaperStyle eStyle = rWallpaper.GetStyle();
 
@@ -164,8 +164,8 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
                 ScopedVclPtrInstance< VirtualDevice > aVDev(  *this  );
                 aVDev->SetBackground( rWallpaper.GetColor() );
                 aVDev->SetOutputSizePixel( Size( nBmpWidth, nBmpHeight ) );
-                aVDev->DrawBitmapEx( Point(), aBmpEx );
-                aBmpEx = aVDev->GetBitmap( Point(), 
aVDev->GetOutputSizePixel() );
+                aVDev->DrawBitmapEx( Point(), aBmp );
+                aBmp = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() 
);
             }
 
             bDrawColorBackground = true;
@@ -221,9 +221,9 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
             if( pCached )
                 rWallpaper.ImplReleaseCachedBitmap();
 
-            aBmpEx = rWallpaper.GetBitmap();
-            aBmpEx.Scale( aSize );
-            aBmpEx = BitmapEx( aBmpEx.GetBitmap().CreateDisplayBitmap( this ), 
aBmpEx.GetAlphaMask() );
+            aBmp = rWallpaper.GetBitmap();
+            aBmp.Scale( aSize );
+            aBmp = aBmp.CreateDisplayBitmap( this );
         }
         break;
 
@@ -299,7 +299,7 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
             {
                 for( tools::Long nBmpX = nStartX; nBmpX <= nRight; nBmpX += 
nBmpWidth )
                 {
-                    DrawBitmapEx( Point( nBmpX, nBmpY ), aBmpEx );
+                    DrawBitmapEx( Point( nBmpX, nBmpY ), aBmp );
                 }
             }
             bDrawn = true;
@@ -312,7 +312,7 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
         // optimized for non-transparent bitmaps
         if( bDrawColorBackground )
         {
-            const Size aBmpSize( aBmpEx.GetSizePixel() );
+            const Size aBmpSize( aBmp.GetSizePixel() );
             const Point aTmpPoint;
             const tools::Rectangle aOutRect( aTmpPoint, GetOutputSizePixel() );
             const tools::Rectangle aColRect( Point( nX, nY ), Size( nWidth, 
nHeight ) );
@@ -360,10 +360,10 @@ void OutputDevice::DrawBitmapWallpaper( tools::Long nX, 
tools::Long nY,
             }
         }
 
-        DrawBitmapEx( aPos, aBmpEx );
+        DrawBitmapEx( aPos, aBmp );
     }
 
-    rWallpaper.ImplSetCachedBitmap( aBmpEx );
+    rWallpaper.ImplSetCachedBitmap( aBmp );
 
     Pop();
     EnableMapMode( bOldMap );

Reply via email to