summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-10-20 07:27:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-21 08:13:05 +0200
commit0fb58a1ff168ae122e9c8993a3136658e3b0e3f0 (patch)
tree908983b02f466e0a49599edc70aaa1baaa240371 /tools
parentb84afd2188d6993c91081885dc24664bd3f1cc73 (diff)
new tools::Degree10 strong typedef
partly to flush some use of "long" out the codebase, but also to make it obvious which units are being used for angle values. Change-Id: I1dc22494ca42c4677a63f685d5903f2b89886dc2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104548 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/point.cxx16
-rw-r--r--tools/source/generic/poly.cxx6
-rw-r--r--tools/source/generic/poly2.cxx6
3 files changed, 14 insertions, 14 deletions
diff --git a/tools/source/generic/point.cxx b/tools/source/generic/point.cxx
index c38e0f183451..13171a070228 100644
--- a/tools/source/generic/point.cxx
+++ b/tools/source/generic/point.cxx
@@ -21,7 +21,7 @@
#include <basegfx/numeric/ftools.hxx>
void Point::RotateAround( Point& rPoint,
- short nOrientation ) const
+ Degree10 nOrientation ) const
{
tools::Long nX = rPoint.X();
tools::Long nY = rPoint.Y();
@@ -31,28 +31,28 @@ void Point::RotateAround( Point& rPoint,
}
void Point::RotateAround( tools::Long& rX, tools::Long& rY,
- short nOrientation ) const
+ Degree10 nOrientation ) const
{
const tools::Long nOriginX = X();
const tools::Long nOriginY = Y();
- if ( (nOrientation >= 0) && !(nOrientation % 900) )
+ if ( (nOrientation >= Degree10(0)) && !(nOrientation % Degree10(900)) )
{
- if ( nOrientation >= 3600 )
- nOrientation %= 3600;
+ if ( nOrientation >= Degree10(3600) )
+ nOrientation %= Degree10(3600);
if ( nOrientation )
{
rX -= nOriginX;
rY -= nOriginY;
- if ( nOrientation == 900 )
+ if ( nOrientation == Degree10(900) )
{
tools::Long nTemp = rX;
rX = rY;
rY = -nTemp;
}
- else if ( nOrientation == 1800 )
+ else if ( nOrientation == Degree10(1800) )
{
rX = -rX;
rY = -rY;
@@ -70,7 +70,7 @@ void Point::RotateAround( tools::Long& rX, tools::Long& rY,
}
else
{
- double nRealOrientation = nOrientation*F_PI1800;
+ double nRealOrientation = nOrientation.get() * F_PI1800;
double nCos = cos( nRealOrientation );
double nSin = sin( nRealOrientation );
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 7e972714ad2a..c25783764f27 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1395,13 +1395,13 @@ void Polygon::Scale( double fScaleX, double fScaleY )
}
}
-void Polygon::Rotate( const Point& rCenter, sal_uInt16 nAngle10 )
+void Polygon::Rotate( const Point& rCenter, Degree10 nAngle10 )
{
- nAngle10 %= 3600;
+ nAngle10 %= Degree10(3600);
if( nAngle10 )
{
- const double fAngle = F_PI1800 * nAngle10;
+ const double fAngle = F_PI1800 * nAngle10.get();
Rotate( rCenter, sin( fAngle ), cos( fAngle ) );
}
}
diff --git a/tools/source/generic/poly2.cxx b/tools/source/generic/poly2.cxx
index a1c4fe0cbe69..2534fb63b029 100644
--- a/tools/source/generic/poly2.cxx
+++ b/tools/source/generic/poly2.cxx
@@ -254,13 +254,13 @@ void PolyPolygon::Scale( double fScaleX, double fScaleY )
mpImplPolyPolygon->mvPolyAry[ i ].Scale( fScaleX, fScaleY );
}
-void PolyPolygon::Rotate( const Point& rCenter, sal_uInt16 nAngle10 )
+void PolyPolygon::Rotate( const Point& rCenter, Degree10 nAngle10 )
{
- nAngle10 %= 3600;
+ nAngle10 %= Degree10(3600);
if( nAngle10 )
{
- const double fAngle = F_PI1800 * nAngle10;
+ const double fAngle = F_PI1800 * nAngle10.get();
Rotate( rCenter, sin( fAngle ), cos( fAngle ) );
}
}