Kaydet (Commit) 404630c6 authored tarafından Noel Grandin's avatar Noel Grandin

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/42846Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst f7445e10
......@@ -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)
{
......
......@@ -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 ); }
......
......@@ -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 );
......
......@@ -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() );
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment