[Libreoffice-commits] core.git: include/vcl

Noel Grandin noel.grandin at collabora.co.uk
Mon Nov 6 06:13:18 UTC 2017


 include/vcl/salbtype.hxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit d7817c54fc9d2b688e8c5b15935adb06e6f47197
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Nov 3 15:19:50 2017 +0200

    BitmapColor::GetLuminance doesn't need to use unsigned long
    
    Change-Id: Ic0f4c2c7576023a96266116a1237190586e4e816
    Reviewed-on: https://gerrit.libreoffice.org/44316
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index 97ca0cf98493..ed38c9a41b8a 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -470,7 +470,9 @@ inline BitmapColor& BitmapColor::Invert()
 inline sal_uInt8 BitmapColor::GetLuminance() const
 {
     assert( !mbIndex && "Pixel represents index into colortable" );
-    return (static_cast<unsigned long>(mcBlueOrIndex) * 28UL + static_cast<unsigned long>(mcGreen) * 151UL + static_cast<unsigned long>(mcRed) * 77UL) >> 8;
+    return (static_cast<sal_uInt32>(mcBlueOrIndex) * 28
+            + static_cast<sal_uInt32>(mcGreen) * 151
+            + static_cast<sal_uInt32>(mcRed) * 77) >> 8;
 }
 
 


More information about the Libreoffice-commits mailing list