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/source | |
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/source')
-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 |
5 files changed, 18 insertions, 8 deletions
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; |