emfio/inc/mtftools.hxx                 |   12 +++---------
 emfio/qa/cppunit/emf/EmfImportTest.cxx |    6 +++---
 emfio/source/reader/emfreader.cxx      |    4 ++--
 emfio/source/reader/mtftools.cxx       |   25 +++++++++++++------------
 include/oox/helper/propertymap.hxx     |    2 +-
 oox/source/helper/propertymap.cxx      |    7 +++++--
 vcl/source/bitmap/bitmap.cxx           |    2 +-
 vcl/source/gdi/impgraph.cxx            |    9 +++------
 8 files changed, 31 insertions(+), 36 deletions(-)

New commits:
commit 281aa3db6dbeb9b5609e91c3ea3e3e94385c8a73
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Aug 26 12:46:18 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 26 17:33:40 2025 +0200

    BitmapEx->Bitmap in emfio
    
    Since Bitmap can handle transparency now.
    
    Which flushes out a bug in ImpGraphic::getBitmap - Since we are
    returning a Bitmap capable of handling transparency, drop the code that
    removes transparency
    
    And also flushes out a silly typo in Bitmap::ReplaceTransparency
    
    Change-Id: Ib4fb658e4b4ef6bba70484a1653ff9508859f1b2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190216
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/emfio/inc/mtftools.hxx b/emfio/inc/mtftools.hxx
index 01e5f391099a..88d335219359 100644
--- a/emfio/inc/mtftools.hxx
+++ b/emfio/inc/mtftools.hxx
@@ -594,20 +594,14 @@ namespace emfio
 
     struct BSaveStruct
     {
-        BitmapEx            aBmpEx;
+        Bitmap              aBmp;
         tools::Rectangle    aOutRect;
         sal_uInt32          nWinRop;
         bool m_bForceAlpha = false;
 
-        BSaveStruct(const Bitmap& rBmp, const tools::Rectangle& rOutRect, 
sal_uInt32 nRop)
-            : aBmpEx(rBmp)
-            , aOutRect(rOutRect)
-            , nWinRop(nRop)
-        {}
-
-        BSaveStruct(const BitmapEx& rBmpEx, const tools::Rectangle& rOutRect, 
sal_uInt32 nRop,
+        BSaveStruct(const Bitmap& rBmp, const tools::Rectangle& rOutRect, 
sal_uInt32 nRop,
                     bool bForceAlpha = false)
-            : aBmpEx(rBmpEx)
+            : aBmp(rBmp)
             , aOutRect(rOutRect)
             , nWinRop(nRop)
             , m_bForceAlpha(bForceAlpha)
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx 
b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index a32db251df92..536901272f23 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -1664,10 +1664,10 @@ CPPUNIT_TEST_FIXTURE(Test, testPdfInEmf)
     // - Expected: 0
     // - Actual  : 255
     // i.e. the pixel in the center was entirely opaque, while it should be 
transparent.
-    BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
-    Size size = aBitmapEx.GetSizePixel();
+    Bitmap aBitmap = aGraphic.GetBitmap();
+    Size size = aBitmap.GetSizePixel();
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8>(0),
-                         aBitmapEx.GetAlpha(size.Width() / 2, size.Height() / 
2));
+                         aBitmap.GetPixelColor(size.Width() / 2, size.Height() 
/ 2).GetAlpha());
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testAlignRtlReading)
diff --git a/emfio/source/reader/emfreader.cxx 
b/emfio/source/reader/emfreader.cxx
index 6cb0e8067972..9c5c3fa0ab54 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -536,7 +536,7 @@ namespace emfio
         aGraphic.getVectorGraphicData()->setSizeHint(maSizeHint);
 
         maBmpSaveList.emplace_back(
-            aGraphic.GetBitmapEx(), aOutputRect, SRCCOPY, 
/*bForceAlpha=*/true);
+            aGraphic.GetBitmap(), aOutputRect, SRCCOPY, /*bForceAlpha=*/true);
         const std::shared_ptr<VectorGraphicData> pVectorGraphicData
             = aGraphic.getVectorGraphicData();
         if (!pVectorGraphicData)
@@ -1659,7 +1659,7 @@ namespace emfio
                                         }
                                     }
 #endif
-                                    maBmpSaveList.emplace_back(aBitmapEx, 
aRect, SRCAND|SRCINVERT);
+                                    
maBmpSaveList.emplace_back(Bitmap(aBitmapEx), aRect, SRCAND|SRCINVERT);
                                 }
                             }
                         }
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 74b358e111c2..78b0f3fc5475 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1995,8 +1995,8 @@ namespace emfio
                         if ( nObjectsOfSameSize == 2 )
                         {
                             BSaveStruct* pSave2 = &rSaveList[i + 1];
-                            if ( ( pSave->aBmpEx.GetPrefSize() == 
pSave2->aBmpEx.GetPrefSize() ) &&
-                                 ( pSave->aBmpEx.GetPrefMapMode() == 
pSave2->aBmpEx.GetPrefMapMode() ) )
+                            if ( ( pSave->aBmp.GetPrefSize() == 
pSave2->aBmp.GetPrefSize() ) &&
+                                 ( pSave->aBmp.GetPrefMapMode() == 
pSave2->aBmp.GetPrefMapMode() ) )
                             {
                                 // TODO: Strictly speaking, we should
                                 // check whether mask is monochrome, and
@@ -2006,8 +2006,9 @@ namespace emfio
                                 // bitmap.
                                 if ( ( nWinRop == SRCPAINT ) && ( 
pSave2->nWinRop == SRCAND ) )
                                 {
-                                    Bitmap aMask( pSave->aBmpEx.GetBitmap() ); 
aMask.Invert();
-                                    BitmapEx aBmpEx( 
pSave2->aBmpEx.GetBitmap(), aMask );
+                                    Bitmap aMask( 
pSave->aBmp.CreateColorBitmap() );
+                                    aMask.Invert();
+                                    BitmapEx aBmpEx( 
pSave2->aBmp.CreateColorBitmap(), aMask );
                                     ImplDrawBitmap( aPos, aSize, aBmpEx );
                                     bDrawn = true;
                                     i++;
@@ -2017,8 +2018,8 @@ namespace emfio
                                 // is inverted
                                 else if ( ( nWinRop == SRCAND ) && ( 
pSave2->nWinRop == SRCPAINT ) )
                                 {
-                                    const Bitmap & rMask( 
pSave->aBmpEx.GetBitmap() );
-                                    BitmapEx aBmpEx( 
pSave2->aBmpEx.GetBitmap(), rMask );
+                                    const Bitmap aMask( 
pSave->aBmp.CreateColorBitmap() );
+                                    BitmapEx aBmpEx( 
pSave2->aBmp.CreateColorBitmap(), aMask );
                                     ImplDrawBitmap( aPos, aSize, aBmpEx );
                                     bDrawn = true;
                                     i++;
@@ -2026,8 +2027,8 @@ namespace emfio
                                 // tdf#90539
                                 else if ( ( nWinRop == SRCAND ) && ( 
pSave2->nWinRop == SRCINVERT ) )
                                 {
-                                    const Bitmap & rMask( 
pSave->aBmpEx.GetBitmap() );
-                                    BitmapEx aBmpEx( 
pSave2->aBmpEx.GetBitmap(), rMask );
+                                    const Bitmap aMask( 
pSave->aBmp.CreateColorBitmap() );
+                                    BitmapEx aBmpEx( 
pSave2->aBmp.CreateColorBitmap(), aMask );
                                     ImplDrawBitmap( aPos, aSize, aBmpEx );
                                     bDrawn = true;
                                     i++;
@@ -2040,16 +2041,16 @@ namespace emfio
                     {
                         Push();
                         WMFRasterOp nOldRop = SetRasterOp( 
WMFRasterOp::CopyPen );
-                        Bitmap      aBitmap( pSave->aBmpEx.GetBitmap() );
+                        Bitmap      aBitmap( pSave->aBmp.CreateColorBitmap() );
                         sal_uInt32  nOperation = ( nRasterOperation & 0xf );
                         switch( nOperation )
                         {
                             case 0x1 :
                             case 0xe :
                             {
-                                if(pSave->aBmpEx.IsAlpha())
+                                if(pSave->aBmp.HasAlpha())
                                 {
-                                    ImplDrawBitmap( aPos, aSize, pSave->aBmpEx 
);
+                                    ImplDrawBitmap( aPos, aSize, 
BitmapEx(pSave->aBmp) );
                                 }
                                 else
                                 {
@@ -2152,7 +2153,7 @@ namespace emfio
                                     aBitmap.Invert();
                                 if (pSave->m_bForceAlpha)
                                 {
-                                    ImplDrawBitmap(aPos, aSize, pSave->aBmpEx);
+                                    ImplDrawBitmap(aPos, aSize, 
BitmapEx(pSave->aBmp));
                                 }
                                 else
                                 {
diff --git a/vcl/source/bitmap/bitmap.cxx b/vcl/source/bitmap/bitmap.cxx
index c8a51284df5f..e41c571ce176 100644
--- a/vcl/source/bitmap/bitmap.cxx
+++ b/vcl/source/bitmap/bitmap.cxx
@@ -2287,7 +2287,7 @@ void Bitmap::ReplaceTransparency(const Color& 
rReplaceColor)
         if( !pReadAccess )
             return;
 
-        BitmapScopedWriteAccess pWriteAccess(*this);
+        BitmapScopedWriteAccess pWriteAccess(aNewBmp);
         assert(pWriteAccess);
         if( !pWriteAccess )
             return;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index bf49b579afa7..83682ff12278 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -569,15 +569,12 @@ Bitmap ImpGraphic::getBitmap(const 
GraphicConversionParameters& rParameters) con
         if (!mpAnimationContainer && maVectorGraphicData)
             updateBitmapFromVectorGraphic(rParameters.getSizePixel());
 
-        BitmapEx aRetBmpEx;
         if (mpAnimationContainer)
-            aRetBmpEx = mpAnimationContainer->maAnimation.GetBitmapEx();
+            aRetBmp = Bitmap(mpAnimationContainer->maAnimation.GetBitmapEx());
         else if (mpBitmapContainer)
-            aRetBmpEx = mpBitmapContainer->maBitmap;
+            aRetBmp = mpBitmapContainer->maBitmap;
         else
-            aRetBmpEx = maCachedBitmap;
-
-        aRetBmp = aRetBmpEx.GetBitmap(COL_WHITE);
+            aRetBmp = maCachedBitmap;
 
         if (rParameters.getSizePixel().Width() || 
rParameters.getSizePixel().Height())
             aRetBmp.Scale(rParameters.getSizePixel());
commit ad738f50512db359b26531339b5e25d02e45c909
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Aug 26 11:33:24 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Aug 26 17:33:29 2025 +0200

    reduce log noise
    
    Prevent the "Representation" property begin accidentally inserted
    into the PropertyMap when it is queried for, which means the
    getProperty() method can became const, the way a getter should be.
    
    Change-Id: I13a8d6712a976fca27af82d93bc471d3aa9a77bc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190214
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/oox/helper/propertymap.hxx 
b/include/oox/helper/propertymap.hxx
index cf8031d46dd1..c862a42bdcb3 100644
--- a/include/oox/helper/propertymap.hxx
+++ b/include/oox/helper/propertymap.hxx
@@ -81,7 +81,7 @@ public:
     /** setAnyProperty should be used */
     bool                setProperty( sal_Int32, const css::uno::Any& ) = 
delete;
 
-    css::uno::Any       getProperty( sal_Int32 nPropId );
+    css::uno::Any       getProperty( sal_Int32 nPropId ) const;
 
     void                erase( sal_Int32 nPropId );
 
diff --git a/oox/source/helper/propertymap.cxx 
b/oox/source/helper/propertymap.cxx
index d2db24d75d5a..3cc8119d80d7 100644
--- a/oox/source/helper/propertymap.cxx
+++ b/oox/source/helper/propertymap.cxx
@@ -195,9 +195,12 @@ bool PropertyMap::setAnyProperty( sal_Int32 nPropId, const 
Any& rValue )
     return true;
 }
 
-Any PropertyMap::getProperty( sal_Int32 nPropId )
+Any PropertyMap::getProperty( sal_Int32 nPropId ) const
 {
-    return maProperties[ nPropId ];
+    auto it = maProperties.find(nPropId);
+    if (it != maProperties.end())
+        return it->second;
+    return Any();
 }
 
 void PropertyMap::erase( sal_Int32 nPropId )

Reply via email to