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

Reuse FRound from tools/helpers.hxx

Change-Id: I74ec4fc6a685c59dbc79978bf8a9afff0a1f9501
üst 7b3e0aa8
......@@ -32,11 +32,6 @@
#include <tools/helpers.hxx>
#include <basegfx/color/bcolortools.hxx>
static inline long _FRound( double fVal )
{
return( fVal > 0.0 ? (long) ( fVal + 0.5 ) : -(long) ( -fVal + 0.5 ) );
}
Color::Color( const ResId& rResId )
{
rResId.SetRT( RSC_COLOR );
......@@ -68,7 +63,7 @@ sal_uInt8 Color::GetColorError( const Color& rCompareColor ) const
labs( (long) rCompareColor.GetGreen() - GetGreen() ) +
labs( (long) rCompareColor.GetBlue() - GetBlue() );
return (sal_uInt8) _FRound( nErrAbs * 0.3333333333 );
return (sal_uInt8) FRound( nErrAbs * 0.3333333333 );
}
void Color::IncreaseLuminance( sal_uInt8 cLumInc )
......@@ -92,9 +87,9 @@ void Color::DecreaseContrast( sal_uInt8 cContDec )
const double fM = ( 128.0 - 0.4985 * cContDec ) / 128.0;
const double fOff = 128.0 - fM * 128.0;
SetRed( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) );
SetGreen( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) );
SetBlue( (sal_uInt8) SAL_BOUND( _FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) );
SetRed( (sal_uInt8) SAL_BOUND( FRound( COLORDATA_RED( mnColor ) * fM + fOff ), 0L, 255L ) );
SetGreen( (sal_uInt8) SAL_BOUND( FRound( COLORDATA_GREEN( mnColor ) * fM + fOff ), 0L, 255L ) );
SetBlue( (sal_uInt8) SAL_BOUND( FRound( COLORDATA_BLUE( mnColor ) * fM + fOff ), 0L, 255L ) );
}
}
......
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