diff options
author | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-18 22:13:36 +0200 |
---|---|---|
committer | Matteo Casalin <matteo.casalin@yahoo.com> | 2015-08-21 22:29:41 +0200 |
commit | aa62086495ecf3d5579ffc72df55698a9c943863 (patch) | |
tree | b8dedf7d03ed1443f609ca8a4ddc072cc828ff9e /include/vcl/salbtype.hxx | |
parent | e28c9ccb014df9616d7a3f3fa1f1b5866d836d94 (diff) |
sal_uLong to sal_uInt16 as return type of BitmapColor::GetColorError
Change-Id: I62c0d073d6b22346b65e3560303d7fc9373bfc7e
Diffstat (limited to 'include/vcl/salbtype.hxx')
-rw-r--r-- | include/vcl/salbtype.hxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx index 15130a636971..dfbc59db49a8 100644 --- a/include/vcl/salbtype.hxx +++ b/include/vcl/salbtype.hxx @@ -138,7 +138,7 @@ public: inline BitmapColor& Merge( const BitmapColor& rColor, sal_uInt8 cTransparency ); - inline sal_uLong GetColorError( const BitmapColor& rBitmapColor ) const; + inline sal_uInt16 GetColorError( const BitmapColor& rBitmapColor ) const; }; // - BitmapPalette - @@ -398,13 +398,14 @@ inline BitmapColor& BitmapColor::Merge( const BitmapColor& rBitmapColor, sal_uIn -inline sal_uLong BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const +inline sal_uInt16 BitmapColor::GetColorError( const BitmapColor& rBitmapColor ) const { DBG_ASSERT( !mbIndex, "Pixel represents index into colortable!" ); DBG_ASSERT( !rBitmapColor.mbIndex, "Pixel represents index into colortable!" ); - return( (sal_uLong) ( labs( mcBlueOrIndex - rBitmapColor.mcBlueOrIndex ) + - labs( mcGreen - rBitmapColor.mcGreen ) + - labs( mcRed - rBitmapColor.mcRed ) ) ); + return static_cast<sal_uInt16>( + abs( static_cast<int>(mcBlueOrIndex) - static_cast<int>(rBitmapColor.mcBlueOrIndex) ) + + abs( static_cast<int>(mcGreen) - static_cast<int>(rBitmapColor.mcGreen) ) + + abs( static_cast<int>(mcRed) - static_cast<int>(rBitmapColor.mcRed) ) ); } inline BitmapPalette::BitmapPalette() : @@ -550,10 +551,10 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const return j; } - sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] ); - for( sal_uInt16 i = 1; i < mnCount; ++i ) + sal_uInt16 nLastErr = SAL_MAX_UINT16; + for( sal_uInt16 i = 0; i < mnCount; ++i ) { - const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] ); + const sal_uInt16 nActErr = rCol.GetColorError( mpBitmapColor[ i ] ); if ( nActErr < nLastErr ) { nLastErr = nActErr; |