summaryrefslogtreecommitdiff
path: root/filter
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 /filter
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 'filter')
-rw-r--r--filter/source/graphicfilter/ipict/shape.cxx5
-rw-r--r--filter/source/msfilter/msdffimp.cxx6
2 files changed, 6 insertions, 5 deletions
diff --git a/filter/source/graphicfilter/ipict/shape.cxx b/filter/source/graphicfilter/ipict/shape.cxx
index 219c48d4aec3..772632041a51 100644
--- a/filter/source/graphicfilter/ipict/shape.cxx
+++ b/filter/source/graphicfilter/ipict/shape.cxx
@@ -164,10 +164,9 @@ namespace PictReaderShape {
tools::Rectangle arc = PictReaderShapePrivate::contractRectangle(drawFrame, orig, pSize);
using namespace basegfx;
- double const PI2 = M_PI/2.0;
// pict angle are CW with 0 at twelve o'clock (with Y-axis inverted)...
- double angl1 = angle1-PI2;
- double angl2 = angle2-PI2;
+ double angl1 = angle1-M_PI_2;
+ double angl2 = angle2-M_PI_2;
long const X[2] = { arc.Left(), arc.Right() };
long const Y[2] = { arc.Top(), arc.Bottom() };
B2DPoint center(0.5*(X[1]+X[0]), 0.5*(Y[1]+Y[0]));
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index ff3df05d0cd1..9084e1b42638 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -4580,8 +4580,10 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
fNumber = ( aStartPt.Y() >= cent.Y() ) ? 90.0: 270.0;
else
{
- fNumber = atan2( double( aStartPt.X() - cent.X() ),double( aStartPt.Y() - cent.Y() ) )+ F_PI; // 0..2PI
- fNumber /= F_PI180; // 0..360.0
+ fNumber
+ = basegfx::rad2deg(atan2(double(aStartPt.X() - cent.X()),
+ double(aStartPt.Y() - cent.Y()))
+ + F_PI); // 0..360.0
}
nEndAngle = NormAngle36000( - static_cast<sal_Int32>(fNumber) * 100 );
seqAdjustmentValues[ 0 ].Value <<= fNumber;