summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-11-19 00:22:31 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-11-19 15:42:03 +0100
commitbc0ab08634f59e1a1814e575fe6ad5e50bf1aee1 (patch)
tree8691eec1adefd9e4def8245898e8a3e5c5542037 /drawinglayer
parent168ae4c00a86b7534dedd303f9ef008e19822b99 (diff)
Drop F_PI1800/F_PI18000, and unify deg2rad/rad2deg conversions
Change-Id: Ib89b00c3dc8cd440e8a88906eea133becd1cef64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125509 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/primitive2d/textlayoutdevice.cxx2
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx4
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx6
-rw-r--r--drawinglayer/source/tools/wmfemfhelper.cxx8
4 files changed, 10 insertions, 10 deletions
diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
index a6e209a577c6..60370e722941 100644
--- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx
+++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx
@@ -395,7 +395,7 @@ vcl::Font getVclFontFromFontAttribute(const attribute::FontAttribute& rFontAttri
// handle FontRotation (if defined)
if (!basegfx::fTools::equalZero(fFontRotation))
{
- sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0 / M_PI)));
+ int aRotate10th(-basegfx::rad2deg<10>(fFontRotation));
aRetval.SetOrientation(Degree10(aRotate10th % 3600));
}
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 7ea03c9afd0c..87ae848b3ca9 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -272,7 +272,7 @@ void VclMetafileProcessor2D::impConvertFillGradientAttributeToVCLGradient(
}
o_rVCLGradient.SetAngle(
- Degree10(static_cast<sal_uInt16>(rFiGrAtt.getAngle() * (1.0 / F_PI1800))));
+ Degree10(static_cast<sal_uInt32>(basegfx::rad2deg<100>(rFiGrAtt.getAngle()))));
o_rVCLGradient.SetBorder(static_cast<sal_uInt16>(rFiGrAtt.getBorder() * 100.0));
o_rVCLGradient.SetOfsX(static_cast<sal_uInt16>(rFiGrAtt.getOffsetX() * 100.0));
o_rVCLGradient.SetOfsY(static_cast<sal_uInt16>(rFiGrAtt.getOffsetY() * 100.0));
@@ -1904,7 +1904,7 @@ void VclMetafileProcessor2D::processPolyPolygonHatchPrimitive2D(
Hatch(aHatchStyle,
Color(maBColorModifierStack.getModifiedColor(rFillHatchAttribute.getColor())),
basegfx::fround(rFillHatchAttribute.getDistance()),
- Degree10(basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800))));
+ Degree10(basegfx::fround(basegfx::rad2deg<10>(rFillHatchAttribute.getAngle())))));
impEndSvtGraphicFill(pSvtGraphicFill.get());
}
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index 967b70aa793e..139bb0ba080a 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -852,8 +852,8 @@ void VclPixelProcessor2D::processFillHatchPrimitive2D(
const basegfx::B2DVector aDiscreteDistance(
maCurrentTransformation * basegfx::B2DVector(rFillHatchAttributes.getDistance(), 0.0));
const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getLength()));
- const sal_uInt16 nAngle10(
- static_cast<sal_uInt16>(basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800)));
+ const sal_uInt32 nAngle10(
+ basegfx::rad2deg<10>(basegfx::fround(rFillHatchAttributes.getAngle())));
::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance,
Degree10(nAngle10));
@@ -1216,7 +1216,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D(
Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()),
Color(rFillGradient.getEndColor()));
- aGradient.SetAngle(Degree10(static_cast<int>(rFillGradient.getAngle() / F_PI1800)));
+ aGradient.SetAngle(Degree10(static_cast<int>(basegfx::rad2deg<10>(rFillGradient.getAngle()))));
aGradient.SetBorder(rFillGradient.getBorder() * 100);
aGradient.SetOfsX(rFillGradient.getOffsetX() * 100.0);
aGradient.SetOfsY(rFillGradient.getOffsetY() * 100.0);
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx
index f9cfbc60cbd3..22b1d4217413 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -737,7 +737,7 @@ namespace wmfemfhelper
static_cast<double>(rGradient.GetBorder()) * 0.01,
static_cast<double>(rGradient.GetOfsX()) * 0.01,
static_cast<double>(rGradient.GetOfsY()) * 0.01,
- static_cast<double>(rGradient.GetAngle().get()) * F_PI1800,
+ toRadians(rGradient.GetAngle()),
aStart,
aEnd,
rGradient.GetSteps());
@@ -772,7 +772,7 @@ namespace wmfemfhelper
return drawinglayer::attribute::FillHatchAttribute(
aHatchStyle,
static_cast<double>(rHatch.GetDistance()),
- static_cast<double>(rHatch.GetAngle().get()) * F_PI1800,
+ toRadians(rHatch.GetAngle()),
rHatch.GetColor().getBColor(),
3, // same default as VCL, a minimum of three discrete units (pixels) offset
false);
@@ -1086,7 +1086,7 @@ namespace wmfemfhelper
// add FontRotation (if used)
if(rFont.GetOrientation())
{
- rTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800);
+ rTextTransform.rotate(-toRadians(rFont.GetOrientation()));
}
}
@@ -1249,7 +1249,7 @@ namespace wmfemfhelper
if(rFont.GetOrientation())
{
- aTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800);
+ aTextTransform.rotate(-toRadians(rFont.GetOrientation()));
}
aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y());