summaryrefslogtreecommitdiff
path: root/sw
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 /sw
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 'sw')
-rw-r--r--sw/source/core/doc/notxtfrm.cxx2
-rw-r--r--sw/source/core/edit/edfcol.cxx2
-rw-r--r--sw/source/uibase/docvw/ShadowOverlayObject.cxx6
3 files changed, 5 insertions, 5 deletions
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 6a18eb351e8d..5755a37472bc 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1292,7 +1292,7 @@ bool SwNoTextFrame::IsTransparent() const
// we can be more specific - rotations of multiples of
// 90 degrees will leave no gaps. Go from [0.0 .. F_2PI]
// to [0 .. 360] and check modulo 90
- const long nRot(static_cast<long>(getLocalFrameRotation() / F_PI180));
+ const long nRot(static_cast<long>(basegfx::rad2deg(getLocalFrameRotation())));
const bool bMultipleOf90(0 == (nRot % 90));
if(!bMultipleOf90)
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index 7a59d2fe7c9b..1de00b60633d 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1525,7 +1525,7 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
basegfx::B2DHomMatrix aTransformation;
aTransformation.identity();
aTransformation.scale(nWidth, nHeight);
- aTransformation.rotate(F_PI180 * -1 * nAngle);
+ aTransformation.rotate(-basegfx::deg2rad(nAngle));
drawing::HomogenMatrix3 aMatrix;
aMatrix.Line1.Column1 = aTransformation.get(0, 0);
aMatrix.Line1.Column2 = aTransformation.get(0, 1);
diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.cxx b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
index 38bffa2218f9..eaafd60febc8 100644
--- a/sw/source/uibase/docvw/ShadowOverlayObject.cxx
+++ b/sw/source/uibase/docvw/ShadowOverlayObject.cxx
@@ -84,7 +84,7 @@ void ShadowPrimitive::create2DDecomposition(
0.0,
0.5,
0.5,
- 1800.0 * F_PI1800,
+ F_PI,
basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
2);
@@ -103,7 +103,7 @@ void ShadowPrimitive::create2DDecomposition(
0.0,
0.5,
0.5,
- 1800.0 * F_PI1800,
+ F_PI,
basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
basegfx::BColor(180.0/255.0,180.0/255.0,180.0/255.0),
4);
@@ -122,7 +122,7 @@ void ShadowPrimitive::create2DDecomposition(
0.0,
0.5,
0.5,
- 1800.0 * F_PI1800,
+ F_PI,
basegfx::BColor(230.0/255.0,230.0/255.0,230.0/255.0),
basegfx::BColor(83.0/255.0,83.0/255.0,83.0/255.0),
4);