[Libreoffice-commits] core.git: tools/source

Stephan Bergmann sbergman at redhat.com
Thu Oct 15 12:43:28 PDT 2015


 tools/source/generic/color.cxx |   13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

New commits:
commit bd2f6ab505a2b76da0b829607a73b5f9a6be3008
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Oct 15 21:42:59 2015 +0200

    Reuse FRound from tools/helpers.hxx
    
    Change-Id: I74ec4fc6a685c59dbc79978bf8a9afff0a1f9501

diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx
index 6d7ebaf..697de7e 100644
--- a/tools/source/generic/color.cxx
+++ b/tools/source/generic/color.cxx
@@ -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 ) );
     }
 }
 


More information about the Libreoffice-commits mailing list