diff options
author | Rasenkai <rasenkai99@gmail.com> | 2023-02-10 19:25:48 +0530 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2023-02-24 11:49:57 +0000 |
commit | e66940a8d147c1dff14e34c8e9421dcf2429cb4f (patch) | |
tree | b6991433151340cdde1b09f28651d0522f11e73e | |
parent | bd70713132fa92abcf7255ff151ffe8666948b40 (diff) |
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 <rasenkai99@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146778
Tested-by: Jenkins
Reviewed-by: Hossein <hossein@libreoffice.org>
-rw-r--r-- | vcl/source/app/settings.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
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 { |