diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-10-20 07:27:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-21 08:13:05 +0200 |
commit | 0fb58a1ff168ae122e9c8993a3136658e3b0e3f0 (patch) | |
tree | 908983b02f466e0a49599edc70aaa1baaa240371 /drawinglayer | |
parent | b84afd2188d6993c91081885dc24664bd3f1cc73 (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 'drawinglayer')
5 files changed, 13 insertions, 11 deletions
diff --git a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx index f86b1585b13f..9de4b8a80e64 100644 --- a/drawinglayer/source/primitive2d/graphicprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitive2d.cxx @@ -68,7 +68,7 @@ void GraphicPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, GraphicAttr aSuppressGraphicAttr(getGraphicAttr()); aSuppressGraphicAttr.SetCrop(0, 0, 0, 0); - aSuppressGraphicAttr.SetRotation(0); + aSuppressGraphicAttr.SetRotation(Degree10(0)); aSuppressGraphicAttr.SetMirrorFlags(BmpMirrorFlags::NONE); aSuppressGraphicAttr.SetTransparency(0); diff --git a/drawinglayer/source/primitive2d/textlayoutdevice.cxx b/drawinglayer/source/primitive2d/textlayoutdevice.cxx index b8ac0bf73c85..e34fe1822fa4 100644 --- a/drawinglayer/source/primitive2d/textlayoutdevice.cxx +++ b/drawinglayer/source/primitive2d/textlayoutdevice.cxx @@ -431,7 +431,7 @@ namespace drawinglayer::primitive2d if(!basegfx::fTools::equalZero(fFontRotation)) { sal_Int16 aRotate10th(static_cast<sal_Int16>(fFontRotation * (-1800.0/F_PI))); - aRetval.SetOrientation(aRotate10th % 3600); + aRetval.SetOrientation(Degree10(aRotate10th % 3600)); } return aRetval; diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 70c4f2ab561e..13883b50412f 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -276,7 +276,8 @@ void VclMetafileProcessor2D::impConvertFillGradientAttributeToVCLGradient( Color(maBColorModifierStack.getModifiedColor(rFiGrAtt.getEndColor()))); } - o_rVCLGradient.SetAngle(static_cast<sal_uInt16>(rFiGrAtt.getAngle() * (1.0 / F_PI1800))); + o_rVCLGradient.SetAngle( + Degree10(static_cast<sal_uInt16>(rFiGrAtt.getAngle() * (1.0 / F_PI1800)))); 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)); @@ -1860,7 +1861,7 @@ void VclMetafileProcessor2D::processPolyPolygonHatchPrimitive2D( Hatch(aHatchStyle, Color(maBColorModifierStack.getModifiedColor(rFillHatchAttribute.getColor())), basegfx::fround(rFillHatchAttribute.getDistance()), - basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800))); + Degree10(basegfx::fround(rFillHatchAttribute.getAngle() / F_PI1800)))); impEndSvtGraphicFill(pSvtGraphicFill.get()); } @@ -2131,7 +2132,7 @@ void VclMetafileProcessor2D::processUnifiedTransparencePrimitive2D( aVCLGradient.SetStyle(GradientStyle::Linear); aVCLGradient.SetStartColor(aTransColor); aVCLGradient.SetEndColor(aTransColor); - aVCLGradient.SetAngle(0); + aVCLGradient.SetAngle(Degree10(0)); aVCLGradient.SetBorder(0); aVCLGradient.SetOfsX(0); aVCLGradient.SetOfsY(0); diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index ac1efe4d95b3..1e5a04baf30d 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -840,7 +840,8 @@ void VclPixelProcessor2D::processFillHatchPrimitive2D( const sal_uInt32 nDistance(basegfx::fround(aDiscreteDistance.getLength())); const sal_uInt16 nAngle10( static_cast<sal_uInt16>(basegfx::fround(rFillHatchAttributes.getAngle() / F_PI1800))); - ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, nAngle10); + ::Hatch aVCLHatch(eHatchStyle, Color(rFillHatchAttributes.getColor()), nDistance, + Degree10(nAngle10)); // draw hatch using VCL mpOutputDevice->DrawHatch(::tools::PolyPolygon(::tools::Polygon(aHatchPolygon)), aVCLHatch); @@ -1206,7 +1207,7 @@ void VclPixelProcessor2D::processFillGradientPrimitive2D( Gradient aGradient(eGradientStyle, Color(rFillGradient.getStartColor()), Color(rFillGradient.getEndColor())); - aGradient.SetAngle(rFillGradient.getAngle() / F_PI1800); + aGradient.SetAngle(Degree10(static_cast<int>(rFillGradient.getAngle() / F_PI1800))); 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 7fd3d8c9a2a8..60bf9ea6ae9f 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -753,7 +753,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()) * F_PI1800, + static_cast<double>(rGradient.GetAngle().get()) * F_PI1800, aStart, aEnd, rGradient.GetSteps()); @@ -788,7 +788,7 @@ namespace wmfemfhelper return drawinglayer::attribute::FillHatchAttribute( aHatchStyle, static_cast<double>(rHatch.GetDistance()), - static_cast<double>(rHatch.GetAngle()) * F_PI1800, + static_cast<double>(rHatch.GetAngle().get()) * F_PI1800, rHatch.GetColor().getBColor(), 3, // same default as VCL, a minimum of three discrete units (pixels) offset false); @@ -1102,7 +1102,7 @@ namespace wmfemfhelper // add FontRotation (if used) if(rFont.GetOrientation()) { - rTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + rTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800); } } @@ -1265,7 +1265,7 @@ namespace wmfemfhelper if(rFont.GetOrientation()) { - aTextTransform.rotate(-rFont.GetOrientation() * F_PI1800); + aTextTransform.rotate(-rFont.GetOrientation().get() * F_PI1800); } aTextTransform.translate(rTextStartPosition.X(), rTextStartPosition.Y()); |