summaryrefslogtreecommitdiff
path: root/svx/source/sdr
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-04 10:37:17 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-08-04 20:51:27 +0200
commit8c48d69f06ddb3cb6c807a1e7db62dddb9778ded (patch)
tree8b6bf137be41ebe93746c4958ab9106bbf5cc339 /svx/source/sdr
parentc05fbde6c870b7e6bc2f9bf642dc7d76215a496f (diff)
Use more basegfx deg<->rad functions, instead of direct formulas
Also make the functions constexpr. Due to slight changes in floating-point arithmetics (90.0 instead of 180.0, M_PI2 instead of M_PI resp.), results might differ in last digits (usually 17th decimal digit). This has lead to need to tweak char2dump's PieChartTest unit test. Change-Id: I20323dd7dab27e4deb408ea4181e390cc05e7cd3 Reviewed-on: https://gerrit.libreoffice.org/58583 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx/source/sdr')
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx5
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx2
-rw-r--r--svx/source/sdr/overlay/overlaytools.cxx2
-rw-r--r--svx/source/sdr/primitive2d/sdrattributecreator.cxx3
-rw-r--r--svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx4
5 files changed, 9 insertions, 7 deletions
diff --git a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
index 10089a8b0dd0..c3f8666ad1d9 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx
@@ -173,7 +173,8 @@ namespace sdr
{
basegfx::B2DVector aTranslation(0.5, 0.5);
aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
- aTextBoxMatrix.rotate((360.0 - GetCustomShapeObj().GetExtraTextRotation(true)) * F_PI180);
+ aTextBoxMatrix.rotate(basegfx::deg2rad(
+ 360.0 - GetCustomShapeObj().GetExtraTextRotation(true)));
aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
}
// give text object a size
@@ -199,7 +200,7 @@ namespace sdr
( aTextRange.getWidth() / 2 ) + ( aTextRange.getMinX() - aObjectRange.getMinimum().getX() ),
( aTextRange.getHeight() / 2 ) + ( aTextRange.getMinY() - aObjectRange.getMinimum().getY() ) );
aTextBoxMatrix.translate( -aTranslation.getX(), -aTranslation.getY() );
- aTextBoxMatrix.rotate((360.0 - fExtraTextRotation) * F_PI180);
+ aTextBoxMatrix.rotate(basegfx::deg2rad(360.0 - fExtraTextRotation));
aTextBoxMatrix.translate( aTranslation.getX(), aTranslation.getY() );
}
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index a2ca6ffe7b05..a7af478edc10 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -116,7 +116,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfSdrOle2Obj::c
const drawinglayer::attribute::FillHatchAttribute aFillHatch(
drawinglayer::attribute::HatchStyle::Single, // single hatch
125.0, // 1.25 mm
- 45.0 * F_PI180, // 45 degree diagonal
+ basegfx::deg2rad(45.0), // 45 degree diagonal
COL_BLACK.getBColor(), // black color
3, // same default as VCL, a minimum of three discrete units (pixels) offset
false); // no filling
diff --git a/svx/source/sdr/overlay/overlaytools.cxx b/svx/source/sdr/overlay/overlaytools.cxx
index 367b336a3579..a511bd045276 100644
--- a/svx/source/sdr/overlay/overlaytools.cxx
+++ b/svx/source/sdr/overlay/overlaytools.cxx
@@ -344,7 +344,7 @@ namespace drawinglayer
// for high contrast, use hatch
const basegfx::BColor aHighContrastLineColor(Application::GetSettings().GetStyleSettings().GetFontColor().getBColor());
const basegfx::BColor aEmptyColor(0.0, 0.0, 0.0);
- const double fHatchRotation(45 * F_PI180);
+ const double fHatchRotation(basegfx::deg2rad(45));
const double fDiscreteHatchDistance(3.0);
const drawinglayer::attribute::FillHatchAttribute aFillHatchAttribute(
drawinglayer::attribute::HatchStyle::Single,
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 4ee872eb681e..7dc13f36aa28 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -896,7 +896,8 @@ namespace drawinglayer
const double fDistance(rSet.Get(SDRATTR_3DSCENE_DISTANCE).GetValue());
// get shadow slant
- const double fShadowSlant(F_PI180 * rSet.Get(SDRATTR_3DSCENE_SHADOW_SLANT).GetValue());
+ const double fShadowSlant(
+ basegfx::deg2rad(rSet.Get(SDRATTR_3DSCENE_SHADOW_SLANT).GetValue()));
// get shade mode
css::drawing::ShadeMode aShadeMode(css::drawing::ShadeMode_FLAT);
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index 191d7811f7bd..1fd696ad0d6a 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -104,8 +104,8 @@ namespace drawinglayer
if(getTextRotation())
{
- aTextMatrix.rotate(-90.0 * F_PI180);
- fTestAngle -= (90.0 * F_PI180);
+ aTextMatrix.rotate(-F_PI2);
+ fTestAngle -= (F_PI2);
if(getTextAutoAngle() && fTestAngle < -F_PI)
{