diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-08-04 10:37:17 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-08-04 20:51:27 +0200 |
commit | 8c48d69f06ddb3cb6c807a1e7db62dddb9778ded (patch) | |
tree | 8b6bf137be41ebe93746c4958ab9106bbf5cc339 /svgio | |
parent | c05fbde6c870b7e6bc2f9bf642dc7d76215a496f (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 'svgio')
-rw-r--r-- | svgio/source/svgreader/svgcharacternode.cxx | 6 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtools.cxx | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index b707cc26116a..dbcf95a84f3f 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -604,11 +604,9 @@ namespace svgio // but it seems to be degrees. Convert here to radians if(!maRotate.empty()) { - const double fFactor(F_PI / 180.0); - - for(size_t a(0); a < maRotate.size(); a++) + for (double& f : maRotate) { - maRotate[a] *= fFactor; + f = basegfx::deg2rad(f); } } diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index 76f61f489d95..8fa844ad5b46 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -595,7 +595,7 @@ namespace svgio // convert to radians if(deg == aType) { - fAngle *= F_PI / 180.0; + fAngle = basegfx::deg2rad(fAngle); } else if(grad == aType) { |