Kaydet (Commit) eb002da9 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove obsolete "explicit operator bool" hack

...and fix the call sites that exploited the hack's internals being non-
transparent.

Change-Id: Ib3b06c3945e303d4088c4e1b65be5beed8613bac
Reviewed-on: https://gerrit.libreoffice.org/46325Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst dcdaca59
......@@ -100,7 +100,7 @@ bool PCXReader::ReadPCX(Graphic & rGraphic)
{
aBmp = Bitmap( Size( nWidth, nHeight ), nDestBitsPerPixel );
Bitmap::ScopedWriteAccess pAcc(aBmp);
if ( pAcc == nullptr )
if ( !pAcc )
return false;
if ( nDestBitsPerPixel <= 8 )
......
......@@ -174,7 +174,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic)
Bitmap aBmp(Size(mnWidth, mnHeight), mnDstBitsPerPix);
Bitmap::ScopedWriteAccess pAcc(aBmp);
if (pAcc == nullptr)
if (!pAcc)
return false;
if (bPalette)
......
......@@ -45,9 +45,6 @@ namespace vcl
*/
template < class Access, class Bitmap, Access* (Bitmap::* Acquire)() > class ScopedBitmapAccess
{
typedef ScopedBitmapAccess< Access, Bitmap, Acquire > self_type;
typedef bool (self_type::* unspecified_bool_type)() const;
public:
explicit ScopedBitmapAccess( Bitmap& rBitmap ) :
mpAccess( nullptr ),
......@@ -98,9 +95,9 @@ public:
}
bool operator!() const { return !mpAccess; }
operator unspecified_bool_type() const
explicit operator bool() const
{
return mpAccess ? &self_type::operator! : 0;
return mpAccess;
}
Access* get() { return mpAccess; }
......
......@@ -109,7 +109,7 @@ bool ImplScaleConvolutionHor(Bitmap& rSource, Bitmap& rTarget, const double& rSc
ImplCalculateContributions(nWidth, nNewWidth, aNumberOfContributions, pWeights, pPixels, pCount, aKernel);
rTarget = Bitmap(Size(nNewWidth, nHeight), 24);
Bitmap::ScopedWriteAccess pWriteAcc(rTarget);
bool bResult(nullptr != pWriteAcc);
bool bResult(pWriteAcc);
if(bResult)
{
......@@ -195,7 +195,7 @@ bool ImplScaleConvolutionVer(Bitmap& rSource, Bitmap& rTarget, const double& rSc
ImplCalculateContributions(nHeight, nNewHeight, aNumberOfContributions, pWeights, pPixels, pCount, aKernel);
rTarget = Bitmap(Size(nWidth, nNewHeight), 24);
Bitmap::ScopedWriteAccess pWriteAcc(rTarget);
bool bResult(nullptr != pWriteAcc);
bool bResult(pWriteAcc);
if(pWriteAcc)
{
......
......@@ -222,7 +222,7 @@ void GIFReader::CreateBitmaps( long nWidth, long nHeight, BitmapPalette* pPal,
aBmp8.Erase( Color( COL_WHITE ) );
pAcc8 = Bitmap::ScopedWriteAccess(aBmp8);
bStatus = ( pAcc8 != nullptr );
bStatus = bool(pAcc8);
}
}
......@@ -685,13 +685,13 @@ Graphic GIFReader::GetIntermediateGraphic()
aImGraphic = BitmapEx( aBmp8, aBmp1 );
pAcc1 = Bitmap::ScopedWriteAccess(aBmp1);
bStatus = bStatus && ( pAcc1 != nullptr );
bStatus = bStatus && pAcc1;
}
else
aImGraphic = aBmp8;
pAcc8 = Bitmap::ScopedWriteAccess(aBmp8);
bStatus = bStatus && ( pAcc8 != nullptr );
bStatus = bStatus && pAcc8;
}
return aImGraphic;
......
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