[Libreoffice-commits] core.git: cui/source include/vcl vcl/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Sep 27 10:59:57 UTC 2017


 cui/source/tabpages/backgrnd.cxx |    2 +-
 include/vcl/alpha.hxx            |    5 +++--
 include/vcl/bitmap.hxx           |   14 ++------------
 vcl/source/gdi/bitmap.cxx        |    4 ++--
 vcl/source/gdi/bitmapex.cxx      |    4 ++--
 5 files changed, 10 insertions(+), 19 deletions(-)

New commits:
commit 404630c6052919c1a0b5dab405084c2a39fc2f5c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Sep 27 11:36:18 2017 +0200

    simplify Bitmap operator==/IsEqual (stage1)
    
    It looks like operator== is actually only useful internally. So inline
    that, and rename the other call sites to use IsEqual().
    
    As a second stage, I will rename IsEqual to operator==, the intention
    being to make it obvious how the call sites are modified.
    
    Change-Id: I37f2920a8cafaffb25e8c5c16e6559546206684b
    Reviewed-on: https://gerrit.libreoffice.org/42846
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx
index 6d483aecb0f1..e93ab92180f7 100644
--- a/cui/source/tabpages/backgrnd.cxx
+++ b/cui/source/tabpages/backgrnd.cxx
@@ -683,7 +683,7 @@ bool SvxBackgroundTabPage::FillItemSet( SfxItemSet* rCoreSet )
                 {
                     const Graphic* pGraphic = rOldItem.GetGraphic();
                     if (pGraphic)
-                        bModifyBrush = pGraphic->GetBitmap() != aBgdGraphic.GetBitmap();
+                        bModifyBrush = !pGraphic->GetBitmap().IsEqual(aBgdGraphic.GetBitmap());
                 }
                 if (bModifyBrush)
                 {
diff --git a/include/vcl/alpha.hxx b/include/vcl/alpha.hxx
index 6e6609d8fd31..f4cd32936d63 100644
--- a/include/vcl/alpha.hxx
+++ b/include/vcl/alpha.hxx
@@ -44,8 +44,9 @@ public:
     AlphaMask&  operator=( const AlphaMask& rAlphaMask ) { return static_cast<AlphaMask&>( Bitmap::operator=( rAlphaMask ) ); }
     AlphaMask&  operator=( AlphaMask&& rAlphaMask ) { return static_cast<AlphaMask&>( Bitmap::operator=( std::move(rAlphaMask) ) ); }
     bool        operator!() const { return Bitmap::operator!(); }
-    bool        operator==( const AlphaMask& rAlphaMask ) const { return Bitmap::operator==( rAlphaMask ); }
-    bool        operator!=( const AlphaMask& rAlphaMask ) const { return Bitmap::operator!=( rAlphaMask ); }
+    bool        operator==( const AlphaMask& rAlphaMask ) const = delete;
+    bool        operator!=( const AlphaMask& rAlphaMask ) const = delete;
+    bool        IsEqual( const AlphaMask& rAlphaMask ) const { return Bitmap::IsEqual(rAlphaMask); }
 
     void        SetPrefMapMode( const MapMode& rMapMode ) { Bitmap::SetPrefMapMode( rMapMode ); }
 
diff --git a/include/vcl/bitmap.hxx b/include/vcl/bitmap.hxx
index 98bd21ded439..321c4969e3e7 100644
--- a/include/vcl/bitmap.hxx
+++ b/include/vcl/bitmap.hxx
@@ -224,8 +224,8 @@ public:
     Bitmap&                 operator=( const Bitmap& rBitmap );
     Bitmap&                 operator=( Bitmap&& rBitmap );
     inline bool             operator!() const;
-    inline bool             operator==( const Bitmap& rBitmap ) const;
-    inline bool             operator!=( const Bitmap& rBitmap ) const;
+    bool                    operator==( const Bitmap& rBitmap ) const = delete;
+    bool                    operator!=( const Bitmap& rBitmap ) const = delete;
 
     bool                    IsEqual( const Bitmap& rBmp ) const;
 
@@ -732,16 +732,6 @@ inline bool Bitmap::operator!() const
     return( mxImpBmp == nullptr );
 }
 
-inline bool Bitmap::operator==( const Bitmap& rBitmap ) const
-{
-    return( rBitmap.mxImpBmp == mxImpBmp );
-}
-
-inline bool Bitmap::operator!=( const Bitmap& rBitmap ) const
-{
-    return( rBitmap.mxImpBmp != mxImpBmp );
-}
-
 inline bool Bitmap::IsEmpty() const
 {
     return( mxImpBmp == nullptr );
diff --git a/vcl/source/gdi/bitmap.cxx b/vcl/source/gdi/bitmap.cxx
index bce74703689c..aef5cf4b2428 100644
--- a/vcl/source/gdi/bitmap.cxx
+++ b/vcl/source/gdi/bitmap.cxx
@@ -779,7 +779,7 @@ bool Bitmap::CopyPixel( const tools::Rectangle& rRectDst,
 
     if( !aRectDst.IsEmpty() )
     {
-        if( pBmpSrc && ( *pBmpSrc != *this ) )
+        if( pBmpSrc && ( pBmpSrc->mxImpBmp != mxImpBmp ) )
         {
             Bitmap*         pSrc = const_cast<Bitmap*>(pBmpSrc);
             const Size      aCopySizePix( pSrc->GetSizePixel() );
@@ -958,7 +958,7 @@ bool Bitmap::CopyPixel_AlphaOptimized( const tools::Rectangle& rRectDst, const t
 
     if( !aRectDst.IsEmpty() )
     {
-        if( pBmpSrc && ( *pBmpSrc != *this ) )
+        if( pBmpSrc && ( pBmpSrc->mxImpBmp != mxImpBmp ) )
         {
             Bitmap*         pSrc = const_cast<Bitmap*>(pBmpSrc);
             const Size      aCopySizePix( pSrc->GetSizePixel() );
diff --git a/vcl/source/gdi/bitmapex.cxx b/vcl/source/gdi/bitmapex.cxx
index 99cf6846b243..4a15547435cf 100644
--- a/vcl/source/gdi/bitmapex.cxx
+++ b/vcl/source/gdi/bitmapex.cxx
@@ -193,7 +193,7 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
     if( eTransparent != rBitmapEx.eTransparent )
         return false;
 
-    if( aBitmap != rBitmapEx.aBitmap )
+    if( !aBitmap.IsEqual(rBitmapEx.aBitmap) )
         return false;
 
     if( aBitmapSize != rBitmapEx.aBitmapSize )
@@ -205,7 +205,7 @@ bool BitmapEx::operator==( const BitmapEx& rBitmapEx ) const
     if( eTransparent == TransparentType::Color )
         return aTransparentColor == rBitmapEx.aTransparentColor;
 
-    return( ( aMask == rBitmapEx.aMask ) && ( bAlpha == rBitmapEx.bAlpha ) );
+    return aMask.IsEqual(rBitmapEx.aMask) && bAlpha == rBitmapEx.bAlpha;
 }
 
 bool BitmapEx::IsEmpty() const


More information about the Libreoffice-commits mailing list