vcl/source/app/settings.cxx |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

New commits:
commit e66940a8d147c1dff14e34c8e9421dcf2429cb4f
Author:     Rasenkai <rasenka...@gmail.com>
AuthorDate: Fri Feb 10 19:25:48 2023 +0530
Commit:     Hossein <hoss...@libreoffice.org>
CommitDate: Fri Feb 24 11:49:57 2023 +0000

    tdf#114441 vcl: source: Convert sal_uLong to a better type
    
    * GetRed() , GetGreen()  and GetBlue() member functions return sal_uInt8,
      so the static_cast s are redundant, thus remove them and use sal_uInt8 
instead of sal_uLong.
    
    * Simplified the code and made it more readable
    
    Change-Id: Ia6ac34762f16400c3db6681d6a0cc0469116bb9b
    Signed-off-by: Rasenkai <rasenka...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146778
    Tested-by: Jenkins
    Reviewed-by: Hossein <hoss...@libreoffice.org>

diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 71d58a4aa5a8..4803fab81ce4 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -2274,13 +2274,10 @@ void StyleSettings::Set3DColors( const Color& rColor )
             mxData->maDarkShadowColor.IncreaseLuminance(100);
         }
 
-        sal_uLong   nRed    = mxData->maLightColor.GetRed();
-        sal_uLong   nGreen  = mxData->maLightColor.GetGreen();
-        sal_uLong   nBlue   = mxData->maLightColor.GetBlue();
-        nRed   += static_cast<sal_uLong>(mxData->maShadowColor.GetRed());
-        nGreen += static_cast<sal_uLong>(mxData->maShadowColor.GetGreen());
-        nBlue  += static_cast<sal_uLong>(mxData->maShadowColor.GetBlue());
-        mxData->maCheckedColor = Color( static_cast<sal_uInt8>(nRed/2), 
static_cast<sal_uInt8>(nGreen/2), static_cast<sal_uInt8>(nBlue/2) );
+        sal_uInt8 nRed = (mxData->maLightColor.GetRed() + 
mxData->maShadowColor.GetRed()) / 2;
+        sal_uInt8 nGreen = (mxData->maLightColor.GetGreen() + 
mxData->maShadowColor.GetGreen()) / 2;
+        sal_uInt8 nBlue = (mxData->maLightColor.GetBlue() + 
mxData->maShadowColor.GetBlue()) / 2;
+        mxData->maCheckedColor = Color(nRed, nGreen, nBlue);
     }
     else
     {

Reply via email to