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 00f776ba53975fea14faa78ffa7b06e7bf5fbf6b Author: Noel Grandin <noel.gran...@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 <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit 404630c6052919c1a0b5dab405084c2a39fc2f5c) Reviewed-on: https://gerrit.libreoffice.org/45455 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 6f5d72bab35a..59dd2a215d5b 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -713,7 +713,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 9e3f49784bd5..275d4f87526c 100644 --- a/include/vcl/alpha.hxx +++ b/include/vcl/alpha.hxx @@ -46,8 +46,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 bc17cbc70c13..74932051bcc4 100644 --- a/include/vcl/bitmap.hxx +++ b/include/vcl/bitmap.hxx @@ -229,8 +229,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; @@ -751,16 +751,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 c0ab50050668..15e2b0a15c95 100644 --- a/vcl/source/gdi/bitmap.cxx +++ b/vcl/source/gdi/bitmap.cxx @@ -786,7 +786,7 @@ bool Bitmap::CopyPixel( const 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() ); @@ -965,7 +965,7 @@ bool Bitmap::CopyPixel_AlphaOptimized( const Rectangle& rRectDst, const Rectangl 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 f8def3cdc1b8..4d7bb0a8bc55 100644 --- a/vcl/source/gdi/bitmapex.cxx +++ b/vcl/source/gdi/bitmapex.cxx @@ -206,7 +206,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 ) @@ -218,7 +218,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 _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits