Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2019)

Unified Diff: Source/wtf/MathExtras.h

Issue 303263008: [SVG2] Add support for the 'turn' unit in <angle>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixups for MathExtras Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/svg/SVGAngleTearOff.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/MathExtras.h
diff --git a/Source/wtf/MathExtras.h b/Source/wtf/MathExtras.h
index 0d26d571dd1f1d6c8efcddb17b47993edf416b8f..5925ca5e89a1d96dfb6fa34b9908ce9d10ee32f2 100644
--- a/Source/wtf/MathExtras.h
+++ b/Source/wtf/MathExtras.h
@@ -208,6 +208,8 @@ inline double turn2deg(double t) { return t * 360.0; }
inline double deg2turn(double d) { return d / 360.0; }
inline double rad2grad(double r) { return r * 200.0 / piDouble; }
inline double grad2rad(double g) { return g * piDouble / 200.0; }
+inline double turn2grad(double t) { return t * 400; }
+inline double grad2turn(double g) { return g / 400; }
inline float deg2rad(float d) { return d * piFloat / 180.0f; }
inline float rad2deg(float r) { return r * 180.0f / piFloat; }
@@ -217,6 +219,8 @@ inline float turn2deg(float t) { return t * 360.0f; }
inline float deg2turn(float d) { return d / 360.0f; }
inline float rad2grad(float r) { return r * 200.0f / piFloat; }
inline float grad2rad(float g) { return g * piFloat / 200.0f; }
+inline float turn2grad(float t) { return t * 400; }
+inline float grad2turn(float g) { return g / 400; }
// std::numeric_limits<T>::min() returns the smallest positive value for floating point types
template<typename T> inline T defaultMinimumForClamp() { return std::numeric_limits<T>::min(); }
« no previous file with comments | « Source/core/svg/SVGAngleTearOff.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698