summaryrefslogtreecommitdiff
path: root/vcl/source/outdev/hatch.cxx
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 /vcl/source/outdev/hatch.cxx
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 'vcl/source/outdev/hatch.cxx')
-rw-r--r--vcl/source/outdev/hatch.cxx26
1 files changed, 13 insertions, 13 deletions
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 4ee38bff1aa2..bb2cb67cb1ac 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -186,7 +186,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
if( ( rHatch.GetStyle() == HatchStyle::Double ) || ( rHatch.GetStyle() == HatchStyle::Triple ) )
{
// Double hatch
- CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 900, aPt1, aPt2, aInc, aEndPt1 );
+ CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + Degree10(900), aPt1, aPt2, aInc, aEndPt1 );
do
{
DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
@@ -198,7 +198,7 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
if( rHatch.GetStyle() == HatchStyle::Triple )
{
// Triple hatch
- CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + 450, aPt1, aPt2, aInc, aEndPt1 );
+ CalcHatchValues( aRect, nWidth, rHatch.GetAngle() + Degree10(450), aPt1, aPt2, aInc, aEndPt1 );
do
{
DrawHatchLine( tools::Line( aPt1, aPt2 ), rPolyPoly, pPtBuffer.get(), bMtf );
@@ -211,19 +211,19 @@ void OutputDevice::DrawHatch( const tools::PolyPolygon& rPolyPoly, const Hatch&
}
}
-void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, sal_uInt16 nAngle10,
+void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long nDist, Degree10 nAngle10,
Point& rPt1, Point& rPt2, Size& rInc, Point& rEndPt1 )
{
Point aRef;
- tools::Long nAngle = nAngle10 % 1800;
+ Degree10 nAngle = nAngle10 % Degree10(1800);
tools::Long nOffset = 0;
- if( nAngle > 900 )
- nAngle -= 1800;
+ if( nAngle > Degree10(900) )
+ nAngle -= Degree10(1800);
aRef = ( !IsRefPoint() ? rRect.TopLeft() : GetRefPoint() );
- if( 0 == nAngle )
+ if( Degree10(0) == nAngle )
{
rInc = Size( 0, nDist );
rPt1 = rRect.TopLeft();
@@ -238,7 +238,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
rPt1.AdjustY( -nOffset );
rPt2.AdjustY( -nOffset );
}
- else if( 900 == nAngle )
+ else if( Degree10(900) == nAngle )
{
rInc = Size( nDist, 0 );
rPt1 = rRect.TopLeft();
@@ -253,9 +253,9 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
rPt1.AdjustX( -nOffset );
rPt2.AdjustX( -nOffset );
}
- else if( nAngle >= -450 && nAngle <= 450 )
+ else if( nAngle >= Degree10(-450) && nAngle <= Degree10(450) )
{
- const double fAngle = F_PI1800 * labs( nAngle );
+ const double fAngle = F_PI1800 * labs( nAngle.get() );
const double fTan = tan( fAngle );
const tools::Long nYOff = FRound( ( rRect.Right() - rRect.Left() ) * fTan );
tools::Long nPY;
@@ -263,7 +263,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
nDist = FRound( nDist / cos( fAngle ) );
rInc = Size( 0, nDist );
- if( nAngle > 0 )
+ if( nAngle > Degree10(0) )
{
rPt1 = rRect.TopLeft();
rPt2 = Point( rRect.Right(), rRect.Top() - nYOff );
@@ -288,7 +288,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
}
else
{
- const double fAngle = F_PI1800 * labs( nAngle );
+ const double fAngle = F_PI1800 * labs( nAngle.get() );
const double fTan = tan( fAngle );
const tools::Long nXOff = FRound( ( rRect.Bottom() - rRect.Top() ) / fTan );
tools::Long nPX;
@@ -296,7 +296,7 @@ void OutputDevice::CalcHatchValues( const tools::Rectangle& rRect, tools::Long n
nDist = FRound( nDist / sin( fAngle ) );
rInc = Size( nDist, 0 );
- if( nAngle > 0 )
+ if( nAngle > Degree10(0) )
{
rPt1 = rRect.TopLeft();
rPt2 = Point( rRect.Left() - nXOff, rRect.Bottom() );