vcl/source/bitmap/BitmapEmbossGreyFilter.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 89367021a4c960b6873370ea9472b36457c51ef3
Author:     Ankit_Jaipuriar <[email protected]>
AuthorDate: Sat Sep 30 11:09:08 2023 +0530
Commit:     Ilmari Lauhakangas <[email protected]>
CommitDate: Tue Oct 3 08:32:22 2023 +0200

    tdf#147906 Use std::hypot for Pythagorean addition
    
    Change-Id: I155cf98404dea83121f95ad3e784bc0e862f46d2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157416
    Tested-by: Jenkins
    Tested-by: Ilmari Lauhakangas <[email protected]>
    Reviewed-by: Ilmari Lauhakangas <[email protected]>

diff --git a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx 
b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
index f8b974a4367f..c1e96c11709a 100644
--- a/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
+++ b/vcl/source/bitmap/BitmapEmbossGreyFilter.cxx
@@ -50,7 +50,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& 
rBitmapEx) const
     const sal_Int32 nLx = FRound(cos(fAzim) * cos(fElev) * 255.0);
     const sal_Int32 nLy = FRound(sin(fAzim) * cos(fElev) * 255.0);
     const sal_Int32 nLz = FRound(sin(fElev) * 255.0);
-    const auto nZ2 = ((6 * 255) / 4) * ((6 * 255) / 4);
+    const auto nZ2 = (6 * 255) / 4;
     const sal_Int32 nNzLz = ((6 * 255) / 4) * nLz;
     const sal_uInt8 cLz = static_cast<sal_uInt8>(std::clamp(nLz, sal_Int32(0), 
sal_Int32(255)));
 
@@ -101,7 +101,7 @@ BitmapEx BitmapEmbossGreyFilter::execute(BitmapEx const& 
rBitmapEx) const
             }
             else
             {
-                const double fGrey = nDotL / sqrt(static_cast<double>(nNx * 
nNx + nNy * nNy + nZ2));
+                const double fGrey = nDotL / std::hypot(nNx, nNy, nZ2);
                 aGrey.SetIndex(static_cast<sal_uInt8>(std::clamp(fGrey, 0.0, 
255.0)));
             }
 

Reply via email to