summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/gradient.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/gdi/gradient.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/gdi/gradient.cxx')
-rw-r--r--vcl/source/gdi/gradient.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/vcl/source/gdi/gradient.cxx b/vcl/source/gdi/gradient.cxx
index ac826f985cdd..b5c331e6953c 100644
--- a/vcl/source/gdi/gradient.cxx
+++ b/vcl/source/gdi/gradient.cxx
@@ -26,7 +26,7 @@ public:
GradientStyle meStyle;
Color maStartColor;
Color maEndColor;
- sal_uInt16 mnAngle;
+ Degree10 mnAngle;
sal_uInt16 mnBorder;
sal_uInt16 mnOfsX;
sal_uInt16 mnOfsY;
@@ -125,12 +125,12 @@ void Gradient::SetEndColor( const Color& rColor )
mpImplGradient->maEndColor = rColor;
}
-sal_uInt16 Gradient::GetAngle() const
+Degree10 Gradient::GetAngle() const
{
return mpImplGradient->mnAngle;
}
-void Gradient::SetAngle( sal_uInt16 nAngle )
+void Gradient::SetAngle( Degree10 nAngle )
{
mpImplGradient->mnAngle = nAngle;
}
@@ -198,11 +198,11 @@ void Gradient::SetSteps( sal_uInt16 nSteps )
void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rBoundRect, Point& rCenter ) const
{
tools::Rectangle aRect( rRect );
- sal_uInt16 nAngle = GetAngle() % 3600;
+ Degree10 nAngle = GetAngle() % Degree10(3600);
if( GetStyle() == GradientStyle::Linear || GetStyle() == GradientStyle::Axial )
{
- const double fAngle = nAngle * F_PI1800;
+ const double fAngle = nAngle.get() * F_PI1800;
const double fWidth = aRect.GetWidth();
const double fHeight = aRect.GetHeight();
double fDX = fWidth * fabs( cos( fAngle ) ) +
@@ -223,7 +223,7 @@ void Gradient::GetBoundRect( const tools::Rectangle& rRect, tools::Rectangle& rB
{
if( GetStyle() == GradientStyle::Square || GetStyle() == GradientStyle::Rect )
{
- const double fAngle = nAngle * F_PI1800;
+ const double fAngle = nAngle.get() * F_PI1800;
const double fWidth = aRect.GetWidth();
const double fHeight = aRect.GetHeight();
double fDX = fWidth * fabs( cos( fAngle ) ) + fHeight * fabs( sin( fAngle ) );