[Libreoffice-commits] core.git: 2 commits - canvas/source cppcanvas/source cui/source drawinglayer/source emfio/source filter/source include/vcl sc/source sd/source svx/source test/source vcl/qa vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Sat May 12 17:00:07 UTC 2018


 canvas/source/vcl/canvashelper.cxx                             |    2 +-
 cppcanvas/source/mtfrenderer/implrenderer.cxx                  |    6 +++---
 cui/source/dialogs/screenshotannotationdlg.cxx                 |    4 ++--
 cui/source/tabpages/tppattern.cxx                              |    2 +-
 drawinglayer/source/tools/converters.cxx                       |    6 ++++--
 drawinglayer/source/tools/wmfemfhelper.cxx                     |    2 +-
 emfio/source/reader/mtftools.cxx                               |   10 +++++-----
 filter/source/flash/swfwriter1.cxx                             |    8 ++++----
 filter/source/graphicfilter/etiff/etiff.cxx                    |    2 +-
 filter/source/svg/svgwriter.cxx                                |    8 ++++----
 include/vcl/alpha.hxx                                          |    4 ++--
 include/vcl/bitmap.hxx                                         |    2 +-
 include/vcl/bitmapex.hxx                                       |    5 +++--
 include/vcl/image.hxx                                          |    1 +
 sc/source/filter/excel/xiescher.cxx                            |    2 +-
 sc/source/ui/app/transobj.cxx                                  |    2 +-
 sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx         |    2 +-
 sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx |    2 +-
 svx/source/dialog/_bmpmask.cxx                                 |    2 +-
 svx/source/xoutdev/xattrbmp.cxx                                |    2 +-
 test/source/screenshot_test.cxx                                |    2 +-
 vcl/qa/cppunit/canvasbitmaptest.cxx                            |    2 +-
 vcl/source/bitmap/BitmapTools.cxx                              |    4 ++--
 vcl/source/gdi/bitmapex.cxx                                    |    2 +-
 vcl/source/gdi/gdimtf.cxx                                      |    6 +++---
 vcl/source/gdi/pdfwriter_impl.cxx                              |    2 +-
 vcl/source/outdev/bitmap.cxx                                   |    2 +-
 vcl/source/outdev/wallpaper.cxx                                |    2 +-
 28 files changed, 50 insertions(+), 46 deletions(-)

New commits:
commit 203e3099c17bf245f8fcd52c32c58d47bd241c2b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Sat May 12 16:08:12 2018 +0200

    make Bitmap/BitmapEx constructors explicit
    
    and add
    BitmapEx::operator=(Bitmap const &)
    Image::Image(Bitmap const &)
    to lessen the fallout
    
    Change-Id: Iff5fab88d167a7be739c370c9933d36c297bc61c
    Reviewed-on: https://gerrit.libreoffice.org/54162
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/canvas/source/vcl/canvashelper.cxx b/canvas/source/vcl/canvashelper.cxx
index c0dd0717a965..d31a45286dc3 100644
--- a/canvas/source/vcl/canvashelper.cxx
+++ b/canvas/source/vcl/canvashelper.cxx
@@ -912,7 +912,7 @@ namespace vclcanvas
                        beFast ? BmpScaleFlag::Default : BmpScaleFlag::BestQuality );
 
         return uno::Reference< rendering::XBitmap >(
-            new CanvasBitmap( aBitmap, *mpDevice, mpOutDevProvider ) );
+            new CanvasBitmap( BitmapEx(aBitmap), *mpDevice, mpOutDevProvider ) );
     }
 
     uno::Sequence< sal_Int8 > CanvasHelper::getData( rendering::IntegerBitmapLayout&     rLayout,
diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx
index ce5e4d74d7d0..25e9b1b3f1a3 100644
--- a/cppcanvas/source/mtfrenderer/implrenderer.cxx
+++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx
@@ -2108,7 +2108,7 @@ namespace cppcanvas
 
                         std::shared_ptr<Action> pBmpAction(
                                 internal::BitmapActionFactory::createBitmapAction(
-                                    pAct->GetBitmap(),
+                                    BitmapEx(pAct->GetBitmap()),
                                     rStates.getState().mapModeTransform *
                                     vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
                                     rCanvas,
@@ -2131,7 +2131,7 @@ namespace cppcanvas
 
                         std::shared_ptr<Action> pBmpAction(
                                 internal::BitmapActionFactory::createBitmapAction(
-                                    pAct->GetBitmap(),
+                                    BitmapEx(pAct->GetBitmap()),
                                     rStates.getState().mapModeTransform *
                                     vcl::unotools::b2DPointFromPoint( pAct->GetPoint() ),
                                     rStates.getState().mapModeTransform *
@@ -2163,7 +2163,7 @@ namespace cppcanvas
 
                         std::shared_ptr<Action> pBmpAction(
                                 internal::BitmapActionFactory::createBitmapAction(
-                                    aBmp,
+                                    BitmapEx(aBmp),
                                     rStates.getState().mapModeTransform *
                                     vcl::unotools::b2DPointFromPoint( pAct->GetDestPoint() ),
                                     rStates.getState().mapModeTransform *
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index 01f14fc446dc..5fe3ed3596d9 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -386,8 +386,8 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, Button*, void)
                     RepaintToBuffer();
 
                     // extract Bitmap
-                    const Bitmap aTargetBitmap(
-                        mpVirtualBufferDevice->GetBitmap(
+                    const BitmapEx aTargetBitmap(
+                        mpVirtualBufferDevice->GetBitmapEx(
                         Point(0, 0),
                         mpVirtualBufferDevice->GetOutputSizePixel()));
 
diff --git a/cui/source/tabpages/tppattern.cxx b/cui/source/tabpages/tppattern.cxx
index b073d844bde0..50c2f59b4f18 100644
--- a/cui/source/tabpages/tppattern.cxx
+++ b/cui/source/tabpages/tppattern.cxx
@@ -297,7 +297,7 @@ IMPL_LINK_NOARG(SvxPatternTabPage, ChangePatternHdl_Impl, ValueSet*, void)
     {
         BitmapColor aBack;
         BitmapColor aFront;
-        bool bIs8x8(isHistorical8x8(pGraphicObject->GetGraphic().GetBitmap(), aBack, aFront));
+        bool bIs8x8(isHistorical8x8(pGraphicObject->GetGraphic().GetBitmapEx(), aBack, aFront));
 
         m_pLbColor->SetNoSelection();
         m_pLbBackgroundColor->SetNoSelection();
diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx
index 64810162305e..968b67bef4c0 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -100,7 +100,8 @@ namespace drawinglayer
                 if(bDoSaveForVisualControl)
                 {
                     SvFileStream aNew("c:\\test_content.png", StreamMode::WRITE|StreamMode::TRUNC);
-                    vcl::PNGWriter aPNGWriter(aContent);
+                    BitmapEx aContentEx = BitmapEx(aContent);
+                    vcl::PNGWriter aPNGWriter(aContentEx);
                     aPNGWriter.Write(aNew);
                 }
 #endif
@@ -130,7 +131,8 @@ namespace drawinglayer
                 if(bDoSaveForVisualControl)
                 {
                     SvFileStream aNew("c:\\test_alpha.png", StreamMode::WRITE|StreamMode::TRUNC);
-                    vcl::PNGWriter aPNGWriter(aAlpha);
+                    BitmapEx aAlphaEx = BitmapEx(aAlpha);
+                    vcl::PNGWriter aPNGWriter(aAlphaEx);
                     aPNGWriter.Write(aNew);
                 }
 #endif
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index 9f1d84c0aca8..2cd0d2d230fd 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -2001,7 +2001,7 @@ namespace wmfemfhelper
                 {
                     /** CHECKED, WORKS WELL */
                     const MetaBmpScaleAction* pA = static_cast<const MetaBmpScaleAction*>(pAction);
-                    const Bitmap aBitmapEx(pA->GetBitmap());
+                    const BitmapEx aBitmapEx(pA->GetBitmap());
 
                     createBitmapExPrimitive(aBitmapEx, pA->GetPoint(), pA->GetSize(), rTargetHolders.Current(), rPropertyHolders.Current());
 
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index e231cf00ef04..89ca286a9501 100644
--- a/emfio/source/reader/mtftools.cxx
+++ b/emfio/source/reader/mtftools.cxx
@@ -1756,7 +1756,7 @@ namespace emfio
                                 else
                                 {
                                     SetRasterOp( WMFRasterOp::XorPen );
-                                    ImplDrawBitmap( aPos, aSize, aBitmap );
+                                    ImplDrawBitmap( aPos, aSize, BitmapEx(aBitmap) );
                                     SetRasterOp( WMFRasterOp::CopyPen );
                                     Bitmap  aMask( aBitmap );
                                     aMask.Invert();
@@ -1800,7 +1800,7 @@ namespace emfio
                                 BitmapEx aBmpEx( aBitmap, aMask );
                                 ImplDrawBitmap( aPos, aSize, aBmpEx );
                                 SetRasterOp( WMFRasterOp::XorPen );
-                                ImplDrawBitmap( aPos, aSize, aBitmap );
+                                ImplDrawBitmap( aPos, aSize, BitmapEx(aBitmap) );
                                 if ( nOperation == 0xb )
                                 {
                                     SetRasterOp( WMFRasterOp::Not );
@@ -1817,7 +1817,7 @@ namespace emfio
                                 BitmapEx aBmpEx( aBitmap, aMask );
                                 ImplDrawBitmap( aPos, aSize, aBmpEx );
                                 SetRasterOp( WMFRasterOp::XorPen );
-                                ImplDrawBitmap( aPos, aSize, aBitmap );
+                                ImplDrawBitmap( aPos, aSize, BitmapEx(aBitmap) );
                                 if ( nOperation == 0xd )
                                 {
                                     SetRasterOp( WMFRasterOp::Not );
@@ -1829,7 +1829,7 @@ namespace emfio
                             case 0x9 :
                             {
                                 SetRasterOp( WMFRasterOp::XorPen );
-                                ImplDrawBitmap( aPos, aSize, aBitmap );
+                                ImplDrawBitmap( aPos, aSize, BitmapEx(aBitmap) );
                                 if ( nOperation == 0x9 )
                                 {
                                     SetRasterOp( WMFRasterOp::Not );
@@ -1852,7 +1852,7 @@ namespace emfio
                             {
                                 if ( nRasterOperation == 0x33 )
                                     aBitmap.Invert();
-                                ImplDrawBitmap( aPos, aSize, aBitmap );
+                                ImplDrawBitmap( aPos, aSize, BitmapEx(aBitmap) );
                             }
                             break;
 
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 57923f8dbd13..d1634cce17ff 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -1512,7 +1512,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
                     {
                         bFound = true;
                         const MetaBmpScaleAction* pBmpScaleAction = static_cast<const MetaBmpScaleAction*>(pSubstAct);
-                        Impl_writeImage( pBmpScaleAction->GetBitmap(),
+                        Impl_writeImage( BitmapEx(pBmpScaleAction->GetBitmap()),
                                       pA->GetPoint(), pA->GetSize(),
                                       Point(), pBmpScaleAction->GetBitmap().GetSizePixel(), clipRect, 1 == bMap  );
                     }
@@ -1613,7 +1613,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
             {
                 const MetaBmpScaleAction* pA = static_cast<const MetaBmpScaleAction*>(pAction);
 
-                Impl_writeImage( pA->GetBitmap(),
+                Impl_writeImage( BitmapEx(pA->GetBitmap()),
                           pA->GetPoint(), pA->GetSize(),
                           Point(), pA->GetBitmap().GetSizePixel(), clipRect, 1 == bMap );
             }
@@ -1622,7 +1622,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
             case MetaActionType::BMP:
             {
                 const MetaBmpAction* pA = static_cast<const MetaBmpAction*>(pAction);
-                Impl_writeImage( pA->GetBitmap(),
+                Impl_writeImage( BitmapEx(pA->GetBitmap()),
                           pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel()),
                           Point(), pA->GetBitmap().GetSizePixel(), clipRect, 1 ==bMap );
             }
@@ -1631,7 +1631,7 @@ void Writer::Impl_writeActions( const GDIMetaFile& rMtf )
             case MetaActionType::BMPSCALEPART:
             {
                 const MetaBmpScalePartAction* pA = static_cast<const MetaBmpScalePartAction*>(pAction);
-                Impl_writeImage( pA->GetBitmap(),
+                Impl_writeImage( BitmapEx(pA->GetBitmap()),
                           pA->GetDestPoint(), pA->GetDestSize(),
                           pA->GetSrcPoint(), pA->GetSrcSize(), clipRect, 1 == bMap );
             }
diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx
index 9663cb669abc..17b99eefd52b 100644
--- a/filter/source/graphicfilter/etiff/etiff.cxx
+++ b/filter/source/graphicfilter/etiff/etiff.cxx
@@ -168,7 +168,7 @@ bool TIFFWriter::WriteTIFF( const Graphic& rGraphic, FilterConfigItem const * pF
     {
         Animation aAnimation = rGraphic.IsAnimated() ? rGraphic.GetAnimation() : Animation();
         if (!rGraphic.IsAnimated())
-            aAnimation.Insert(AnimationBitmap(rGraphic.GetBitmap(), Point(), Size()));
+            aAnimation.Insert(AnimationBitmap(rGraphic.GetBitmapEx(), Point(), Size()));
 
         for (size_t i = 0; i < aAnimation.Count(); ++i)
             mnSumOfAllPictHeight += aAnimation.Get(i).aBmpEx.GetSizePixel().Height();
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index b414cc573f46..9cbe2b24e3ee 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3066,7 +3066,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                         {
                             bFound = true;
                             const MetaBmpScaleAction* pBmpScaleAction = static_cast<const MetaBmpScaleAction*>(pSubstAct);
-                            ImplWriteBmp( pBmpScaleAction->GetBitmap(),
+                            ImplWriteBmp( BitmapEx(pBmpScaleAction->GetBitmap()),
                                           pA->GetPoint(), pA->GetSize(),
                                           Point(), pBmpScaleAction->GetBitmap().GetSizePixel() );
                         }
@@ -3448,7 +3448,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                 {
                     const MetaBmpAction* pA = static_cast<const MetaBmpAction*>(pAction);
 
-                    ImplWriteBmp( pA->GetBitmap(),
+                    ImplWriteBmp( BitmapEx(pA->GetBitmap()),
                                   pA->GetPoint(), mpVDev->PixelToLogic( pA->GetBitmap().GetSizePixel() ),
                                   Point(), pA->GetBitmap().GetSizePixel() );
                 }
@@ -3468,7 +3468,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                     }
                     else
                     {
-                        ImplWriteBmp( pA->GetBitmap(),
+                        ImplWriteBmp( BitmapEx(pA->GetBitmap()),
                                       pA->GetPoint(), pA->GetSize(),
                                       Point(), pA->GetBitmap().GetSizePixel() );
                     }
@@ -3482,7 +3482,7 @@ void SVGActionWriter::ImplWriteActions( const GDIMetaFile& rMtf,
                 {
                     const MetaBmpScalePartAction* pA = static_cast<const MetaBmpScalePartAction*>(pAction);
 
-                    ImplWriteBmp( pA->GetBitmap(),
+                    ImplWriteBmp( BitmapEx(pA->GetBitmap()),
                                   pA->GetDestPoint(), pA->GetDestSize(),
                                   pA->GetSrcPoint(), pA->GetSrcSize() );
                 }
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 9dfca1de0af1..6ba6dd43378c 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -124,7 +124,7 @@ public:
                             Bitmap();
                             Bitmap( const Bitmap& rBitmap );
                             Bitmap( const Size& rSizePixel, sal_uInt16 nBitCount, const BitmapPalette* pPal = nullptr );
-                            Bitmap( SalBitmap* pSalBitmap );
+    explicit                Bitmap( SalBitmap* pSalBitmap );
     virtual                 ~Bitmap();
 
     Bitmap&                 operator=( const Bitmap& rBitmap );
diff --git a/include/vcl/bitmapex.hxx b/include/vcl/bitmapex.hxx
index f52a8dba5fb0..b62c3cb5a2fa 100644
--- a/include/vcl/bitmapex.hxx
+++ b/include/vcl/bitmapex.hxx
@@ -45,15 +45,16 @@ class SAL_WARN_UNUSED VCL_DLLPUBLIC BitmapEx
 public:
 
                         BitmapEx();
-                        BitmapEx( const OUString& rIconName );
+    explicit            BitmapEx( const OUString& rIconName );
                         BitmapEx( const BitmapEx& rBitmapEx );
                         BitmapEx( const BitmapEx& rBitmapEx, Point aSrc, Size aSize );
-                        BitmapEx( const Bitmap& rBmp );
+    explicit            BitmapEx( const Bitmap& rBmp );
                         BitmapEx( const Bitmap& rBmp, const Bitmap& rMask );
                         BitmapEx( const Bitmap& rBmp, const AlphaMask& rAlphaMask );
                         BitmapEx( const Bitmap& rBmp, const Color& rTransparentColor );
 
     BitmapEx&           operator=( const BitmapEx& rBitmapEx );
+    BitmapEx&           operator=( const Bitmap& rBitmap ) { return operator=(BitmapEx(rBitmap)); }
     bool                operator==( const BitmapEx& rBitmapEx ) const;
     bool                operator!=( const BitmapEx& rBitmapEx ) const { return !(*this==rBitmapEx); }
     bool                operator!() const { return !maBitmap; }
diff --git a/include/vcl/image.hxx b/include/vcl/image.hxx
index 526243bcf382..6f324c25b852 100644
--- a/include/vcl/image.hxx
+++ b/include/vcl/image.hxx
@@ -56,6 +56,7 @@ class SAL_WARN_UNUSED VCL_DLLPUBLIC Image
 public:
                     Image();
                     explicit Image( const BitmapEx& rBitmapEx );
+                    explicit Image( const Bitmap& rBitmap ) : Image( BitmapEx(rBitmap) ) {}
                     explicit Image( const css::uno::Reference< css::graphic::XGraphic >& rxGraphic );
                     explicit Image( const OUString &rPNGFileUrl );
 
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index c516cb209de7..9e2db5f9b04c 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -712,7 +712,7 @@ void XclImpDrawObjBase::ConvertFillStyle( SdrObject& rSdrObj, const XclObjFillDa
             Bitmap aBitmap;
             ReadDIB(aBitmap, aMemStrm, false);
 
-            XOBitmap aXOBitmap( aBitmap );
+            XOBitmap aXOBitmap(( BitmapEx(aBitmap) ));
             aXOBitmap.Bitmap2Array();
             if( aXOBitmap.GetBackgroundColor() == COL_BLACK )
                 ::std::swap( aPattColor, aBackColor );
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 7a9dc8749eb0..37d37b9fd2e1 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -376,7 +376,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
             PaintToDev( pVirtDev, m_pDoc, 1.0, m_aBlock );
 
             pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) );
-            Bitmap aBmp = pVirtDev->GetBitmap( Point(), pVirtDev->GetOutputSize() );
+            BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), pVirtDev->GetOutputSize() );
             bOK = SetBitmapEx( aBmp, rFlavor );
         }
         else if ( nFormat == SotClipboardFormatId::GDIMETAFILE )
diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
index f811f70960ae..a158b625202e 100644
--- a/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsBitmapCompressor.cxx
@@ -162,7 +162,7 @@ public:
 
 std::shared_ptr<BitmapReplacement> PngCompression::Compress (const Bitmap& rBitmap) const
 {
-    vcl::PNGWriter aWriter (rBitmap);
+    vcl::PNGWriter aWriter ((BitmapEx(rBitmap)));
     SvMemoryStream aStream (32768, 32768);
     aWriter.Write(aStream);
 
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index e93e9d101b0f..8c8988e5224a 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
@@ -183,7 +183,7 @@ Point InsertionIndicatorOverlay::PaintRepresentatives (
         aPageOffset.AdjustY(gnShadowBorder );
 
         // Paint the preview.
-        Bitmap aPreview (rRepresentatives[nIndex].maBitmap);
+        BitmapEx aPreview (rRepresentatives[nIndex].maBitmap);
         aPreview.Scale(rPreviewSize, BmpScaleFlag::BestQuality);
         rContent.DrawBitmapEx(aPageOffset, aPreview);
 
diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx
index 74955710061b..0256b719e9a4 100644
--- a/svx/source/dialog/_bmpmask.cxx
+++ b/svx/source/dialog/_bmpmask.cxx
@@ -908,7 +908,7 @@ BitmapEx SvxBmpMask::ImpReplaceTransparency( const BitmapEx& rBmpEx, const Color
     {
         Bitmap aBmp( rBmpEx.GetBitmap() );
         aBmp.Replace( rBmpEx.GetMask(), rColor );
-        return aBmp;
+        return BitmapEx(aBmp);
     }
     else
         return rBmpEx;
diff --git a/svx/source/xoutdev/xattrbmp.cxx b/svx/source/xoutdev/xattrbmp.cxx
index c4328daef724..a25c5d41faf4 100644
--- a/svx/source/xoutdev/xattrbmp.cxx
+++ b/svx/source/xoutdev/xattrbmp.cxx
@@ -224,7 +224,7 @@ bool XFillBitmapItem::operator==(const SfxPoolItem& rItem) const
 bool XFillBitmapItem::isPattern() const
 {
     BitmapColor aBack, aFront;
-    return isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmap(), aBack, aFront);
+    return isHistorical8x8(GetGraphicObject().GetGraphic().GetBitmapEx(), aBack, aFront);
 }
 
 sal_uInt16 XFillBitmapItem::GetVersion(sal_uInt16 /*nFileFormatVersion*/) const
diff --git a/test/source/screenshot_test.cxx b/test/source/screenshot_test.cxx
index 8ab5d3b1f8eb..9ed30b14d98b 100644
--- a/test/source/screenshot_test.cxx
+++ b/test/source/screenshot_test.cxx
@@ -81,7 +81,7 @@ void ScreenshotTest::implSaveScreenshot(const Bitmap& rScreenshot, const OString
     SvFileStream aNew(pngUrl, StreamMode::WRITE | StreamMode::TRUNC);
     CPPUNIT_ASSERT_MESSAGE(OUStringToOString("Failed to open <" + pngUrl + ">: " + OUString::number(sal_uInt32(aNew.GetErrorCode())), RTL_TEXTENCODING_UTF8).getStr(), aNew.IsOpen());
 
-    vcl::PNGWriter aPNGWriter(rScreenshot);
+    vcl::PNGWriter aPNGWriter((BitmapEx(rScreenshot)));
     aPNGWriter.Write(aNew);
 }
 
diff --git a/vcl/qa/cppunit/canvasbitmaptest.cxx b/vcl/qa/cppunit/canvasbitmaptest.cxx
index c91819a6b391..8b3c210c2f41 100644
--- a/vcl/qa/cppunit/canvasbitmaptest.cxx
+++ b/vcl/qa/cppunit/canvasbitmaptest.cxx
@@ -665,7 +665,7 @@ void CanvasBitmapTest::runTest()
             }
         }
 
-        rtl::Reference<VclCanvasBitmap> xBmp( new VclCanvasBitmap(aBitmap) );
+        rtl::Reference<VclCanvasBitmap> xBmp( new VclCanvasBitmap(BitmapEx(aBitmap)) );
 
         checkCanvasBitmap( xBmp, "single bitmap", nDepth );
 
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index c21d5fd2a369..eab36e467ac5 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -176,7 +176,7 @@ BitmapEx CreateFromData( sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHe
     if (nBitCount == 32)
         return BitmapEx(aBmp, *pAlphaMask);
     else
-        return aBmp;
+        return BitmapEx(aBmp);
 }
 
 /** Copy block of image data into the bitmap.
@@ -227,7 +227,7 @@ BitmapEx CreateFromData( RawBitmap&& rawBitmap )
     if (nBitCount == 32)
         return BitmapEx(aBmp, *pAlphaMask);
     else
-        return aBmp;
+        return BitmapEx(aBmp);
 }
 
 #if ENABLE_CAIRO_CANVAS
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 7955c5608b84..35f19577eb78 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -1766,7 +1766,7 @@ BitmapEx GDIMetaFile::ImplBmpMonoFnc( const BitmapEx& rBmpEx, const void* pBmpPa
     else if( rBmpEx.IsTransparent() )
         return BitmapEx( aBmp, rBmpEx.GetMask() );
     else
-        return aBmp;
+        return BitmapEx( aBmp );
 }
 
 Color GDIMetaFile::ImplColReplaceFnc( const Color& rColor, const void* pColParam )
@@ -1930,7 +1930,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol
             {
                 MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction);
                 aMtf.push_back( new MetaBmpScaleAction( pAct->GetPoint(), pAct->GetSize(),
-                                    pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() ) );
+                                    pFncBmp( BitmapEx(pAct->GetBitmap()), pBmpParam ).GetBitmap() ) );
             }
             break;
 
@@ -1939,7 +1939,7 @@ void GDIMetaFile::ImplExchangeColors( ColorExchangeFnc pFncCol, const void* pCol
                 MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction);
                 aMtf.push_back( new MetaBmpScalePartAction( pAct->GetDestPoint(), pAct->GetDestSize(),
                                                     pAct->GetSrcPoint(), pAct->GetSrcSize(),
-                                                    pFncBmp( pAct->GetBitmap(), pBmpParam ).GetBitmap() )
+                                                    pFncBmp( BitmapEx(pAct->GetBitmap()), pBmpParam ).GetBitmap() )
                                                 );
             }
             break;
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 5ebdda50bace..21ca8d478e5b 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -9780,7 +9780,7 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const
             drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmpEx );
         }
         else
-            drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), aBmp );
+            drawBitmap( rTargetArea.TopLeft(), rTargetArea.GetSize(), BitmapEx(aBmp) );
         return;
     }
 
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 75d6d9120ae7..e924a1f35f58 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -493,7 +493,7 @@ BitmapEx OutputDevice::GetBitmapEx( const Point& rSrcPt, const Size& rSize ) con
         return BitmapEx(GetBitmap( rSrcPt, rSize ), AlphaMask( aAlphaBitmap ) );
     }
     else
-        return GetBitmap( rSrcPt, rSize );
+        return BitmapEx(GetBitmap( rSrcPt, rSize ));
 }
 
 void OutputDevice::DrawDeviceBitmap( const Point& rDestPt, const Size& rDestSize,
diff --git a/vcl/source/outdev/wallpaper.cxx b/vcl/source/outdev/wallpaper.cxx
index 567c5eec24cb..71b75c6c9054 100644
--- a/vcl/source/outdev/wallpaper.cxx
+++ b/vcl/source/outdev/wallpaper.cxx
@@ -146,7 +146,7 @@ void OutputDevice::DrawBitmapWallpaper( long nX, long nY,
                 aVDev->SetBackground( rWallpaper.GetColor() );
                 aVDev->SetOutputSizePixel( Size( nBmpWidth, nBmpHeight ) );
                 aVDev->DrawBitmapEx( Point(), aBmpEx );
-                aBmpEx = aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() );
+                aBmpEx = BitmapEx(aVDev->GetBitmap( Point(), aVDev->GetOutputSizePixel() ));
             }
 
             bDrawColorBackground = true;
commit f4932d61e52d595156af1f63e9fb4bed18b63254
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri May 11 14:48:12 2018 +0200

    make AlphaMask constructors explicit
    
    to reduce surprises in some changes I'm planning
    
    Change-Id: I61cb58d51ab77f57e55159017c7bece5bd99953f
    Reviewed-on: https://gerrit.libreoffice.org/54161
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 1f7876b23d58..a36e4b6b0bfd 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -34,10 +34,10 @@ class VCL_DLLPUBLIC AlphaMask : private Bitmap
 public:
 
                 AlphaMask();
-                AlphaMask( const Bitmap& rBitmap );
+    explicit    AlphaMask( const Bitmap& rBitmap );
                 AlphaMask( const AlphaMask& rAlphaMask );
                 AlphaMask( AlphaMask&& rAlphaMask );
-                AlphaMask( const Size& rSizePixel, const sal_uInt8* pEraseTransparency = nullptr );
+    explicit    AlphaMask( const Size& rSizePixel, const sal_uInt8* pEraseTransparency = nullptr );
     virtual     ~AlphaMask() override;
 
     AlphaMask&  operator=( const Bitmap& rBitmap );
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 2301646974a6..4d31dbb1fa0a 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -265,7 +265,7 @@ AlphaMask BitmapEx::GetAlpha() const
     }
     else
     {
-        return maMask;
+        return AlphaMask(maMask);
     }
 }
 


More information about the Libreoffice-commits mailing list