From 8c48d69f06ddb3cb6c807a1e7db62dddb9778ded Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 4 Aug 2018 10:37:17 +0300 Subject: Use more basegfx deg<->rad functions, instead of direct formulas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Mike Kaganski --- slideshow/source/engine/shapes/drawinglayeranimation.cxx | 2 +- slideshow/source/engine/tools.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'slideshow') diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx index 05bd61f61f27..899663dedb16 100644 --- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx +++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx @@ -649,7 +649,7 @@ void ActivityImpl::updateShapeAttributes( if( !::basegfx::fTools::equalZero( mfRotationAngle )) { maShapeAttrLayer.get()->setRotationAngle( mfRotationAngle ); - double const fRotate = (mfRotationAngle * M_PI / 180.0); + double const fRotate = basegfx::deg2rad(mfRotationAngle); basegfx::B2DHomMatrix aTransform; // position: aTransform.rotate( fRotate ); diff --git a/slideshow/source/engine/tools.cxx b/slideshow/source/engine/tools.cxx index 77e4160b4644..b0f1491fafac 100644 --- a/slideshow/source/engine/tools.cxx +++ b/slideshow/source/engine/tools.cxx @@ -87,7 +87,7 @@ namespace slideshow pAttr->getShearYAngle() : 0.0 ); const double nRotation( pAttr->isRotationAngleValid() ? - pAttr->getRotationAngle()*M_PI/180.0 : + basegfx::deg2rad(pAttr->getRotationAngle()) : 0.0 ); // scale, shear and rotation pivot point is the shape @@ -492,7 +492,7 @@ namespace slideshow pAttr->getShearYAngle() : 0.0 ); const double nRotation( pAttr->isRotationAngleValid() ? - pAttr->getRotationAngle()*M_PI/180.0 : + basegfx::deg2rad(pAttr->getRotationAngle()) : 0.0 ); // scale, shear and rotation pivot point is the -- cgit