summaryrefslogtreecommitdiff
path: root/include/vcl/salbtype.hxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-08-17 23:25:53 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-08-21 22:29:40 +0200
commitb6d799b5489918817c1ba7689b305cf21fd654ea (patch)
tree225e9c9d2291896e1ef23c2fa5cc3423210eaae4 /include/vcl/salbtype.hxx
parenta3b3da8d98d56527c6522bfefe1d52e27740e10e (diff)
Improve readability (minor code modification, formatting)
Change-Id: I2ce0087493f53579f155f8c399909cdb542aa8a3
Diffstat (limited to 'include/vcl/salbtype.hxx')
-rw-r--r--include/vcl/salbtype.hxx28
1 files changed, 21 insertions, 7 deletions
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 9528ffaa4db0..11f263f4e090 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -548,15 +548,25 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
for( long j = 0L; ( j < mnCount ) && !bFound; j++ )
if( rCol == mpBitmapColor[ j ] )
- nRetIndex = ( (sal_uInt16) j ), bFound = true;
+ {
+ nRetIndex = ( (sal_uInt16) j );
+ bFound = true;
+ }
if( !bFound )
{
- long nActErr, nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex = mnCount - 1 ] );
+ nRetIndex = mnCount - 1;
+ sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
for( long i = nRetIndex - 1; i >= 0L; i-- )
- if ( ( nActErr = rCol.GetColorError( mpBitmapColor[ i ] ) ) < nLastErr )
- nLastErr = nActErr, nRetIndex = (sal_uInt16) i;
+ {
+ const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
+ if ( nActErr < nLastErr )
+ {
+ nLastErr = nActErr;
+ nRetIndex = (sal_uInt16) i;
+ }
+ }
}
}
@@ -674,7 +684,9 @@ inline void ColorMask::GetColorFor24Bit( BitmapColor& rColor, const sal_uInt8* p
inline void ColorMask::SetColorFor24Bit( const BitmapColor& rColor, sal_uInt8* pPixel ) const
{
const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
- pPixel[ 0 ] = (sal_uInt8) nVal; pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL ); pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL );
+ pPixel[ 0 ] = (sal_uInt8) nVal;
+ pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL );
+ pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL );
}
inline void ColorMask::GetColorFor32Bit( BitmapColor& rColor, const sal_uInt8* pPixel ) const
@@ -697,8 +709,10 @@ inline void ColorMask::GetColorAndAlphaFor32Bit( BitmapColor& rColor, sal_uInt8&
inline void ColorMask::SetColorFor32Bit( const BitmapColor& rColor, sal_uInt8* pPixel ) const
{
const sal_uInt32 nVal = COLOR_TO_MASK( rColor, mnRMask, mnGMask, mnBMask, mnRShift, mnGShift, mnBShift, mnAlphaChannel );
- pPixel[ 0 ] = (sal_uInt8) nVal; pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL );
- pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL ); pPixel[ 3 ] = (sal_uInt8) ( nVal >> 24UL );
+ pPixel[ 0 ] = (sal_uInt8) nVal;
+ pPixel[ 1 ] = (sal_uInt8) ( nVal >> 8UL );
+ pPixel[ 2 ] = (sal_uInt8) ( nVal >> 16UL );
+ pPixel[ 3 ] = (sal_uInt8) ( nVal >> 24UL );
}
#endif // INCLUDED_VCL_SALBTYPE_HXX