summaryrefslogtreecommitdiffstats
path: root/basegfx
diff options
context:
space:
mode:
authorKunal Pawar <hellokunalpawar@gmail.com>2022-02-10 13:20:06 +0530
committerHossein <hossein@libreoffice.org>2022-02-15 21:00:18 +0100
commit49746f40b06eaf1f61bb54454408a06a49d73c5e (patch)
tree3a94fb222ce0bb001f2340372183a1eec36247a4 /basegfx
parenttdf#146848: sw_uiwriter3: Add unittest (diff)
downloadcore-49746f40b06eaf1f61bb54454408a06a49d73c5e.tar.gz
core-49746f40b06eaf1f61bb54454408a06a49d73c5e.zip
tdf#145759 Use symbolic constants instead of magic numerical constants
1.4142... -> M_SQRT2 0.4142... -> M_SQRT2 - 1 3.1415... -> M_PI 2.7182... -> M_E Change-Id: If5b19aa38d9902b1a4b717f89f18bdf2f73a47cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129745 Tested-by: Hossein <hossein@libreoffice.org> Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/tools/gradienttools.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/basegfx/source/tools/gradienttools.cxx b/basegfx/source/tools/gradienttools.cxx
index 3605d8fe0be0..b4f1f6222f52 100644
--- a/basegfx/source/tools/gradienttools.cxx
+++ b/basegfx/source/tools/gradienttools.cxx
@@ -21,6 +21,7 @@
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/range/b2drange.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <cmath>
namespace basegfx
{
@@ -144,10 +145,10 @@ namespace basegfx
}
else
{
- fTargetOffsetX -= (0.4142 / 2.0 ) * fTargetSizeX;
- fTargetOffsetY -= (0.4142 / 2.0 ) * fTargetSizeY;
- fTargetSizeX = 1.4142 * fTargetSizeX;
- fTargetSizeY = 1.4142 * fTargetSizeY;
+ fTargetOffsetX -= ((M_SQRT2 - 1) / 2.0 ) * fTargetSizeX;
+ fTargetOffsetY -= ((M_SQRT2 - 1) / 2.0 ) * fTargetSizeY;
+ fTargetSizeX = M_SQRT2 * fTargetSizeX;
+ fTargetSizeY = M_SQRT2 * fTargetSizeY;
}
const double fHalfBorder((1.0 - fBorder) * 0.5);