summaryrefslogtreecommitdiff
path: root/vcl/workben/svptest.cxx
diff options
context:
space:
mode:
authorpragat-pandya <pragat.pandya@gmail.com>2022-03-29 16:25:15 +0530
committerHossein <hossein@libreoffice.org>2022-03-31 13:51:34 +0200
commita31aadb1ef7dfdd4ae76a15707ab51a82c95d868 (patch)
tree0cf5626a67b7c3a18b546c3e9d4d2c96b62dfbbf /vcl/workben/svptest.cxx
parent9f041e7678521074b09b20f4088996c86bea5cd0 (diff)
tdf#147906 Use std::hypot for Pythagorean addition
Change-Id: I38166d36e9e8518ab86ded7ab630a35f3a0c39d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132268 Tested-by: Jenkins Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'vcl/workben/svptest.cxx')
-rw-r--r--vcl/workben/svptest.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index 37aa0dfa1a55..dde13e256ddd 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -115,13 +115,13 @@ MyWin::MyWin( vcl::Window* pParent, WinBits nWinStyle ) :
{
for( int nY = 0; nY < 256; nY++ )
{
- double fRed = 255.0-1.5*sqrt(static_cast<double>(nX*nX+nY*nY));
+ double fRed = 255.0-1.5*std::hypot(nX, nY);
if( fRed < 0.0 )
fRed = 0.0;
- double fGreen = 255.0-1.5*sqrt(static_cast<double>((255-nX)*(255-nX)+nY*nY));
+ double fGreen = 255.0-1.5*std::hypot(255-nX, nY);
if( fGreen < 0.0 )
fGreen = 0.0;
- double fBlue = 255.0-1.5*sqrt(static_cast<double>((128-nX)*(128-nX)+(255-nY)*(255-nY)));
+ double fBlue = 255.0-1.5*std::hypot(128-nX, 255-nY);
if( fBlue < 0.0 )
fBlue = 0.0;
pAcc->SetPixel( nY, nX, BitmapColor( sal_uInt8(fRed), sal_uInt8(fGreen), sal_uInt8(fBlue) ) );