basic/source/runtime/methods.cxx                    |    3 +--
 cui/source/dialogs/screenshotannotationdlg.cxx      |    2 +-
 emfio/source/reader/mtftools.cxx                    |    2 +-
 filter/source/msfilter/msdffimp.cxx                 |    2 +-
 fpicker/source/office/iodlg.cxx                     |    2 +-
 framework/source/fwe/helper/actiontriggerhelper.cxx |    2 +-
 reportdesign/qa/unit/data/roundTrip.odb             |binary
 sc/source/filter/excel/xiescher.cxx                 |    2 +-
 sd/source/core/drawdoc4.cxx                         |    2 +-
 sd/source/ui/view/drviews8.cxx                      |    2 +-
 sd/source/ui/view/sdview3.cxx                       |    2 +-
 sfx2/source/appl/linkmgr2.cxx                       |    2 +-
 svx/source/svdraw/svdfmtf.cxx                       |    4 ++--
 svx/source/svdraw/svdpdf.cxx                        |    2 +-
 svx/source/tbxctrls/linectrl.cxx                    |    2 +-
 svx/source/xoutdev/_xoutbmp.cxx                     |    2 +-
 svx/source/xoutdev/xtabptrn.cxx                     |    2 +-
 sw/source/filter/html/htmlreqifreader.cxx           |    3 +--
 sw/source/uibase/uiview/view.cxx                    |    2 +-
 sw/source/uibase/wrtsh/wrtsh1.cxx                   |    2 +-
 vcl/source/filter/webp/reader.cxx                   |    2 +-
 vcl/source/graphic/UnoGraphicProvider.cxx           |    8 ++++----
 22 files changed, 25 insertions(+), 27 deletions(-)

New commits:
commit 36a4d7daa635696cc6a0399b1da56b1c6c8d3f59
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Aug 27 21:13:11 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Aug 28 08:00:13 2025 +0200

    BitmapEx->Bitmap in various
    
    places where we are constructing a Graphic by first
    converting to BitmapEx, which is unnecessary, rather pass a
    Bitmap to Graphic.
    
    Change-Id: I386f68e7f5bc6ef9509352187dbe9a0774defaac
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190307
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 1082c2e7be6e..33bd72e61e3f 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4112,8 +4112,7 @@ void SbRtl_LoadPicture(StarBASIC *, SbxArray & rPar, bool)
     {
         Bitmap aBmp;
         ReadDIB(aBmp, *pStream, true);
-        BitmapEx aBitmapEx(aBmp);
-        Graphic aGraphic(aBitmapEx);
+        Graphic aGraphic(aBmp);
 
         SbxObjectRef xRef = new SbStdPicture;
         static_cast<SbStdPicture*>(xRef.get())->SetGraphic( aGraphic );
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx 
b/cui/source/dialogs/screenshotannotationdlg.cxx
index c818762d3770..5b10b75a3ce6 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -335,7 +335,7 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, 
saveButtonHandler, weld::Button&,
     RepaintToBuffer();
 
     // extract Bitmap
-    const BitmapEx aTargetBitmap(
+    const Bitmap aTargetBitmap(
         mxVirtualBufferDevice->GetBitmap(
         Point(0, 0),
         mxVirtualBufferDevice->GetOutputSizePixel()));
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 78b0f3fc5475..145a3911fd64 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1561,7 +1561,7 @@ namespace emfio
                                               Color(),
                                               Color(),
                                               0,
-                                              Graphic 
(BitmapEx(maLatestFillStyle.aBmp)));
+                                              Graphic(maLatestFillStyle.aBmp));
 
                         SvMemoryStream  aMemStm;
 
diff --git a/filter/source/msfilter/msdffimp.cxx 
b/filter/source/msfilter/msdffimp.cxx
index c39c865abb3a..32d98128983b 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -6639,7 +6639,7 @@ bool SvxMSDffManager::GetBLIPDirect( SvStream& 
rBLIPStream, Graphic& rData, tool
             Bitmap aNew;
             if( ReadDIB(aNew, *pGrStream, false) )
             {
-                rData = Graphic(BitmapEx(aNew));
+                rData = Graphic(aNew);
                 nRes = ERRCODE_NONE;
             }
         }
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index 25db81b4f78a..fdb6c8fd17ce 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -2127,7 +2127,7 @@ void SvtFileDialog::setImage(const Any& rImage)
 
     if ( rImage >>= aBmpSequence )
     {
-        BitmapEx        aBmp;
+        Bitmap          aBmp;
         SvMemoryStream  aData( aBmpSequence.getArray(),
                                aBmpSequence.getLength(),
                                StreamMode::READ );
diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx 
b/framework/source/fwe/helper/actiontriggerhelper.cxx
index e1ae01a4da28..c1f22b24420d 100644
--- a/framework/source/fwe/helper/actiontriggerhelper.cxx
+++ b/framework/source/fwe/helper/actiontriggerhelper.cxx
@@ -150,7 +150,7 @@ static void InsertSubMenuItems(const Reference<XPopupMenu>& 
rSubMenu, sal_uInt16
                         else
                         {
                             // Support add-on images for context menu 
interceptors
-                            BitmapEx 
aBitmap(aAddonOptions.GetImageFromURL(aCommandURL, false, true));
+                            Bitmap 
aBitmap(aAddonOptions.GetImageFromURL(aCommandURL, false, true));
                             if (!aBitmap.IsEmpty())
                                 rSubMenu->setItemImage(nNewItemId, 
Graphic(aBitmap).GetXGraphic(), false);
                         }
diff --git a/reportdesign/qa/unit/data/roundTrip.odb 
b/reportdesign/qa/unit/data/roundTrip.odb
index ee8585d4bed6..a5a4f653b9d6 100644
Binary files a/reportdesign/qa/unit/data/roundTrip.odb and 
b/reportdesign/qa/unit/data/roundTrip.odb differ
diff --git a/sc/source/filter/excel/xiescher.cxx 
b/sc/source/filter/excel/xiescher.cxx
index 4889ed08ea01..b4bcf61451e2 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -4221,7 +4221,7 @@ void XclImpDrawing::ReadBmp( Graphic& rGraphic, const 
XclImpRoot& rRoot, XclImpS
     aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
     Bitmap aBitmap;
     if( ReadDIB(aBitmap, aMemStrm, false) )   // read DIB without file header
-        rGraphic = BitmapEx(aBitmap);
+        rGraphic = aBitmap;
 }
 
 void XclImpDrawing::ReadDffRecord( XclImpStream& rStrm )
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index de0005098693..795561d8eb36 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -182,7 +182,7 @@ void SdDrawDocument::CreateLayoutTemplates()
     Size    aNullSize( 32, 32 );
     Bitmap aNullBmp(aNullSize, vcl::PixelFormat::N8_BPP);
     aNullBmp.Erase( COL_WHITE );
-    rISet.Put(XFillBitmapItem(Graphic(BitmapEx(aNullBmp))));
+    rISet.Put(XFillBitmapItem(Graphic(aNullBmp)));
 
                     // Shadow attributes (Drawing Engine)
     rISet.Put(makeSdrShadowItem(false));
diff --git a/sd/source/ui/view/drviews8.cxx b/sd/source/ui/view/drviews8.cxx
index 0ca9af3e536a..16e500d03492 100644
--- a/sd/source/ui/view/drviews8.cxx
+++ b/sd/source/ui/view/drviews8.cxx
@@ -47,7 +47,7 @@ void DrawViewShell::ScannerEvent()
 
             if( xBitmap.is() )
             {
-                const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
+                const Bitmap aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
 
                 if( !aScanBmp.IsEmpty() )
                 {
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 9717291d08c1..c655c0acfa8d 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -207,7 +207,7 @@ bool View::InsertMetaFile( const TransferableDataHelper& 
rDataHelper, const Poin
                             {
                                 MetaBmpScaleAction* pBmpScaleAction = 
dynamic_cast< MetaBmpScaleAction* >( pAction );
                                 if( pBmpScaleAction )
-                                    aGraphic = 
Graphic(BitmapEx(pBmpScaleAction->GetBitmap()));
+                                    aGraphic = 
Graphic(pBmpScaleAction->GetBitmap());
                             }
                             break;
                         case MetaActionType::BMPEX:
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 01febae9df5f..ad80f12fea57 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -588,7 +588,7 @@ bool LinkManager::GetGraphicFromAny(std::u16string_view 
rMimeType,
             {
                 Bitmap aBmp;
                 ReadDIB(aBmp, aMemStm, true);
-                rGraphic = BitmapEx(aBmp);
+                rGraphic = aBmp;
                 bRet = true;
             }
             break;
diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index f44abd480016..03a950a89f6f 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -1103,7 +1103,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpAction 
const & rAct)
     aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
     rtl::Reference<SdrGrafObj> pGraf = new SdrGrafObj(
         *mpModel,
-        Graphic(BitmapEx(rAct.GetBitmap())),
+        Graphic(rAct.GetBitmap()),
         aRect);
 
     // This action is not creating line and fill, set directly, do not use 
SetAttributes(..)
@@ -1118,7 +1118,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScaleAction 
const & rAct)
     aRect.AdjustRight( 1 ); aRect.AdjustBottom( 1 );
     rtl::Reference<SdrGrafObj> pGraf = new SdrGrafObj(
         *mpModel,
-        Graphic(BitmapEx(rAct.GetBitmap())),
+        Graphic(rAct.GetBitmap()),
         aRect);
 
     // This action is not creating line and fill, set directly, do not use 
SetAttributes(..)
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index fe5e0d917258..56a9edf79f50 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -875,7 +875,7 @@ void 
ImpSdrPdfImport::ImportImage(std::unique_ptr<vcl::pdf::PDFiumPageObject> co
     const int nWidth = bitmap->getWidth();
     const int nHeight = bitmap->getHeight();
     const int nStride = bitmap->getStride();
-    BitmapEx aBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
+    Bitmap aBitmap(Size(nWidth, nHeight), vcl::PixelFormat::N24_BPP);
 
     switch (format)
     {
diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index d07793005469..02e412350c86 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -101,7 +101,7 @@ void SAL_CALL SvxLineStyleToolBoxControl::statusChanged( 
const frame::FeatureSta
         case -1:
         case 0:
         {
-            BitmapEx aEmpty(xList->GetBitmapForUISolidLine());
+            Bitmap aEmpty(xList->GetBitmapForUISolidLine());
             
aEmpty.Erase(Application::GetSettings().GetStyleSettings().GetFieldColor());
             if (m_pToolbar)
             {
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index 7c6dc7441568..ba0924e33179 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -321,7 +321,7 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, 
OUString& rFileName,
                 else
                 {
                     rGraphic.Draw(*pVDev, Point(), aSize);
-                    aGraphic = BitmapEx(pVDev->GetBitmap(Point(), aSize));
+                    aGraphic = pVDev->GetBitmap(Point(), aSize);
                 }
             }
             else
diff --git a/svx/source/xoutdev/xtabptrn.cxx b/svx/source/xoutdev/xtabptrn.cxx
index c17a0e67f5bc..bd39bf2c5cd2 100644
--- a/svx/source/xoutdev/xtabptrn.cxx
+++ b/svx/source/xoutdev/xtabptrn.cxx
@@ -44,7 +44,7 @@ bool XPatternList::Create()
 {
     OUStringBuffer aStr(SvxResId(RID_SVXSTR_PATTERN));
     std::array<sal_uInt8,64> aArray;
-    BitmapEx aBitmap;
+    Bitmap aBitmap;
     const sal_Int32 nLen(aStr.getLength() - 1);
 
     aArray.fill(0);
diff --git a/sw/source/filter/html/htmlreqifreader.cxx 
b/sw/source/filter/html/htmlreqifreader.cxx
index d3a51e3911ca..5177808111c0 100644
--- a/sw/source/filter/html/htmlreqifreader.cxx
+++ b/sw/source/filter/html/htmlreqifreader.cxx
@@ -557,8 +557,7 @@ bool WrapGraphicInRtf(const Graphic& rGraphic, const 
SwFrameFormat& rFormat, SvS
         aBitmap.Convert(BmpConversion::N24Bit);
     }
 
-    if (GraphicConverter::Export(aNativeData, BitmapEx(aBitmap), 
ConvertDataFormat::BMP)
-        != ERRCODE_NONE)
+    if (GraphicConverter::Export(aNativeData, aBitmap, ConvertDataFormat::BMP) 
!= ERRCODE_NONE)
     {
         SAL_WARN("sw.html", "WrapGraphicInRtf: bmp conversion failed");
     }
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index bf0329531984..856e12a29f53 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1894,7 +1894,7 @@ void SwView::ScannerEventHdl()
 
             if( xBitmap.is() )
             {
-                const BitmapEx aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
+                const Bitmap aScanBmp( VCLUnoHelper::GetBitmap( xBitmap ) );
 
                 if( !aScanBmp.IsEmpty() )
                 {
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index bf055e729c4e..48228d19f321 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1209,7 +1209,7 @@ void 
SwWrtShell::InsertContentControl(SwContentControlType eType)
             pContentControl->SetPicture(true);
 
             // Create the placeholder bitmap.
-            BitmapEx aBitmap(Size(1, 1), vcl::PixelFormat::N24_BPP);
+            Bitmap aBitmap(Size(1, 1), vcl::PixelFormat::N24_BPP);
             Color aColor = SvtOptionsDrawinglayer::getHilightColor();
             aColor.IncreaseLuminance(255 * 0.75);
             aBitmap.Erase(aColor);
diff --git a/vcl/source/filter/webp/reader.cxx 
b/vcl/source/filter/webp/reader.cxx
index d411a1c384af..59267e959805 100644
--- a/vcl/source/filter/webp/reader.cxx
+++ b/vcl/source/filter/webp/reader.cxx
@@ -229,7 +229,7 @@ static bool readWebp(SvStream& stream, Graphic& graphic)
     }
 
     access.reset(); // Flush BitmapScopedWriteAccess.
-    graphic = BitmapEx(bitmap);
+    graphic = bitmap;
     return success;
 }
 
diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx 
b/vcl/source/graphic/UnoGraphicProvider.cxx
index 6dd5f28a8186..90bb7a9c46b7 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -636,14 +636,14 @@ void ImplApplyFilterData( ::Graphic& rGraphic, const 
uno::Sequence< beans::Prope
                     case MetaActionType::BMPSCALE:
                     case MetaActionType::BMPEXSCALE:
                     {
-                        BitmapEx aBmpEx;
+                        Bitmap aBmp;
                         Point aPos;
                         Size aSize;
                         if ( pAction->GetType() == MetaActionType::BMPSCALE )
                         {
                             MetaBmpScaleAction* pScaleAction = dynamic_cast< 
MetaBmpScaleAction* >( pAction );
                             assert(pScaleAction);
-                            aBmpEx = pScaleAction->GetBitmap();
+                            aBmp = pScaleAction->GetBitmap();
                             aPos = pScaleAction->GetPoint();
                             aSize = pScaleAction->GetSize();
                         }
@@ -651,11 +651,11 @@ void ImplApplyFilterData( ::Graphic& rGraphic, const 
uno::Sequence< beans::Prope
                         {
                             MetaBmpExScaleAction* pScaleAction = dynamic_cast< 
MetaBmpExScaleAction* >( pAction );
                             assert(pScaleAction);
-                            aBmpEx = pScaleAction->GetBitmapEx();
+                            aBmp = Bitmap(pScaleAction->GetBitmapEx());
                             aPos = pScaleAction->GetPoint();
                             aSize = pScaleAction->GetSize();
                         }
-                        ::Graphic aGraphic( aBmpEx );
+                        ::Graphic aGraphic( aBmp );
                         const Size aSize100thmm( aDummyVDev->LogicToPixel( 
aSize ) );
                         Size aSize100thmm2( 
aDummyVDev->PixelToLogic(aSize100thmm, MapMode(MapUnit::Map100thMM)) );
 

Reply via email to