unroll code for early returns, no logic changed intended

Change-Id: Ic1cc63a5fe3ad2c949f91c395c00f5f99bd7602a
This commit is contained in:
Caolán McNamara 2016-12-23 17:53:50 +00:00
parent 6aa482428e
commit 218179ddbf

View File

@ -53,10 +53,11 @@ BitmapBuffer* ImplCreateDIB(
|| nBitCount == 32) || nBitCount == 32)
&& "Unsupported BitCount!"); && "Unsupported BitCount!");
if (!rSize.Width() || !rSize.Height())
return nullptr;
BitmapBuffer* pDIB = nullptr; BitmapBuffer* pDIB = nullptr;
if( rSize.Width() && rSize.Height() )
{
try try
{ {
pDIB = new BitmapBuffer; pDIB = new BitmapBuffer;
@ -66,8 +67,9 @@ BitmapBuffer* ImplCreateDIB(
pDIB = nullptr; pDIB = nullptr;
} }
if( pDIB ) if(!pDIB)
{ return nullptr;
const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0; const sal_uInt16 nColors = ( nBitCount <= 8 ) ? ( 1 << nBitCount ) : 0;
switch (nBitCount) switch (nBitCount)
@ -140,10 +142,6 @@ BitmapBuffer* ImplCreateDIB(
delete pDIB; delete pDIB;
pDIB = nullptr; pDIB = nullptr;
} }
}
}
else
pDIB = nullptr;
return pDIB; return pDIB;
} }