diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-11-16 16:07:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-11-16 21:43:09 +0100 |
commit | 50d3ad9127aaf63afcfa299adcea060c9b09faa4 (patch) | |
tree | af3bf48ae8e31e180003c9f998831dd7777d1f5b /vcl | |
parent | cd4a239063a77d49fe178255c20f0558e337a82f (diff) |
Instead of labs, use overloaded abs
...more likely to pick an appropriate version for the involved integer types,
esp. after the recent long -> tools::Long changes
Change-Id: Ia91259ca35aaf74b0e907de6831fc926f30057f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105949
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qa/cppunit/graphicfilter/filters-test.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/bmpacc3.cxx | 8 | ||||
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/regionband.cxx | 8 | ||||
-rw-r--r-- | vcl/source/outdev/bitmap.cxx | 3 | ||||
-rw-r--r-- | vcl/source/outdev/hatch.cxx | 5 | ||||
-rw-r--r-- | vcl/win/gdi/gdiimpl.cxx | 5 |
7 files changed, 26 insertions, 11 deletions
diff --git a/vcl/qa/cppunit/graphicfilter/filters-test.cxx b/vcl/qa/cppunit/graphicfilter/filters-test.cxx index 6c0b4b8dfaf7..8020848b6e38 100644 --- a/vcl/qa/cppunit/graphicfilter/filters-test.cxx +++ b/vcl/qa/cppunit/graphicfilter/filters-test.cxx @@ -7,6 +7,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include <sal/config.h> + +#include <cstdlib> + #include <unotest/filters-test.hxx> #include <test/bootstrapfixture.hxx> @@ -95,7 +99,7 @@ void VclFiltersTest::testScaling() CPPUNIT_ASSERT( aBitmapEx.Scale( 0.1937046, 0.193154, i ) ); Size aAfter( aBitmapEx.GetSizePixel() ); fprintf( stderr, "size %" SAL_PRIdINT64 ", %" SAL_PRIdINT64 "\n", sal_Int64(aAfter.Width()), sal_Int64(aAfter.Height()) ); - CPPUNIT_ASSERT( labs (aAfter.Height() - aAfter.Width()) <= 1 ); + CPPUNIT_ASSERT( std::abs (aAfter.Height() - aAfter.Width()) <= 1 ); } } diff --git a/vcl/source/gdi/bmpacc3.cxx b/vcl/source/gdi/bmpacc3.cxx index bfc9a46ba291..dcd449aa820d 100644 --- a/vcl/source/gdi/bmpacc3.cxx +++ b/vcl/source/gdi/bmpacc3.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <vcl/bitmap.hxx> #include <bmpfast.hxx> @@ -145,8 +149,8 @@ void BitmapWriteAccess::DrawLine( const Point& rStart, const Point& rEnd ) } else { - const tools::Long nDX = labs( rEnd.X() - rStart.X() ); - const tools::Long nDY = labs( rEnd.Y() - rStart.Y() ); + const tools::Long nDX = std::abs( rEnd.X() - rStart.X() ); + const tools::Long nDY = std::abs( rEnd.Y() - rStart.Y() ); tools::Long nX1; tools::Long nY1; tools::Long nX2; diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 454363c6d88c..8ffa24994ebb 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -2790,7 +2790,7 @@ bool GDIMetaFile::CreateThumbnail(BitmapEx& rBitmapEx, BmpConversion eColorConve const Point aTLPix( aVDev->LogicToPixel( aNullPt, GetPrefMapMode() ) ); const Point aBRPix( aVDev->LogicToPixel( Point( GetPrefSize().Width() - 1, GetPrefSize().Height() - 1 ), GetPrefMapMode() ) ); Size aDrawSize( aVDev->LogicToPixel( GetPrefSize(), GetPrefMapMode() ) ); - Size aSizePix( labs( aBRPix.X() - aTLPix.X() ) + 1, labs( aBRPix.Y() - aTLPix.Y() ) + 1 ); + Size aSizePix( std::abs( aBRPix.X() - aTLPix.X() ) + 1, std::abs( aBRPix.Y() - aTLPix.Y() ) + 1 ); sal_uInt32 nMaximumExtent = 256; if (!rBitmapEx.IsEmpty()) diff --git a/vcl/source/gdi/regionband.cxx b/vcl/source/gdi/regionband.cxx index ed309b140edc..31d942735d0b 100644 --- a/vcl/source/gdi/regionband.cxx +++ b/vcl/source/gdi/regionband.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstdlib> + #include <tools/stream.hxx> #include <regionband.hxx> #include <osl/diagnose.h> @@ -480,8 +484,8 @@ void RegionBand::InsertLine(const Point& rStartPt, const Point& rEndPt, tools::L } else if ( rStartPt.Y() != rEndPt.Y() ) { - const tools::Long nDX = labs( rEndPt.X() - rStartPt.X() ); - const tools::Long nDY = labs( rEndPt.Y() - rStartPt.Y() ); + const tools::Long nDX = std::abs( rEndPt.X() - rStartPt.X() ); + const tools::Long nDY = std::abs( rEndPt.Y() - rStartPt.Y() ); const tools::Long nStartX = rStartPt.X(); const tools::Long nStartY = rStartPt.Y(); const tools::Long nEndX = rEndPt.X(); diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 7d3d6485d2e7..519f975a0f12 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -18,6 +18,7 @@ */ #include <cassert> +#include <cstdlib> #include <vcl/bitmap.hxx> #include <vcl/bitmapex.hxx> @@ -203,7 +204,7 @@ Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz, Size aDstSizeTwip( PixelToLogic(LogicToPixel(rDstSz), MapMode(MapUnit::MapTwip)) ); // #103209# Normalize size (mirroring has to happen outside of this method) - aDstSizeTwip = Size( labs(aDstSizeTwip.Width()), labs(aDstSizeTwip.Height()) ); + aDstSizeTwip = Size( std::abs(aDstSizeTwip.Width()), std::abs(aDstSizeTwip.Height()) ); const Size aBmpSize( aBmp.GetSizePixel() ); const double fBmpPixelX = aBmpSize.Width(); diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx index 44cf941149bb..374282c374df 100644 --- a/vcl/source/outdev/hatch.cxx +++ b/vcl/source/outdev/hatch.cxx @@ -18,6 +18,7 @@ */ #include <cassert> +#include <cstdlib> #include <osl/diagnose.h> #include <tools/line.hxx> @@ -255,7 +256,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n } else if( nAngle >= Degree10(-450) && nAngle <= Degree10(450) ) { - const double fAngle = F_PI1800 * labs( nAngle.get() ); + const double fAngle = F_PI1800 * std::abs( nAngle.get() ); const double fTan = tan( fAngle ); const tools::Long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan ); tools::Long nPY; @@ -288,7 +289,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n } else { - const double fAngle = F_PI1800 * labs( nAngle.get() ); + const double fAngle = F_PI1800 * std::abs( nAngle.get() ); const double fTan = tan( fAngle ); const tools::Long nXOff = FRound( ( rRect.Bottom() - rRect.Top() ) / fTan ); tools::Long nPX; diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx index cff1ccb59ad6..de022280c4b2 100644 --- a/vcl/win/gdi/gdiimpl.cxx +++ b/vcl/win/gdi/gdiimpl.cxx @@ -19,6 +19,7 @@ #include <sal/config.h> +#include <cstdlib> #include <memory> #include <numeric> @@ -801,8 +802,8 @@ std::shared_ptr<SalBitmap> WinSalGraphicsImpl::getBitmap( tools::Long nX, tools: std::shared_ptr<WinSalBitmap> pSalBitmap; - nDX = labs( nDX ); - nDY = labs( nDY ); + nDX = std::abs( nDX ); + nDY = std::abs( nDY ); HDC hDC = mrParent.getHDC(); HBITMAP hBmpBitmap = CreateCompatibleBitmap( hDC, nDX, nDY ); |