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

Unified Diff: cc/math_util.cc

Issue 11366094: cc: Create a Region class that wraps SkRegion, to replace use of WebCore::Region. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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 | « cc/math_util.h ('k') | cc/occlusion_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/math_util.cc
diff --git a/cc/math_util.cc b/cc/math_util.cc
index 83d156cc333ddb395608c5acda019edd0e7a0457..f18b840146025accc4bbf8541eafcbc38dcf641a 100644
--- a/cc/math_util.cc
+++ b/cc/math_util.cc
@@ -20,6 +20,9 @@ using WebKit::WebTransformationMatrix;
namespace cc {
+const double MathUtil::PI_DOUBLE = 3.14159265358979323846;
+const float MathUtil::PI_FLOAT = 3.14159265358979323846f;
+
static HomogeneousCoordinate projectHomogeneousPoint(const WebTransformationMatrix& transform, const gfx::PointF& p)
{
// In this case, the layer we are trying to project onto is perpendicular to ray
@@ -380,18 +383,12 @@ gfx::Vector2dF MathUtil::computeTransform2dScaleComponents(const WebTransformati
return gfx::Vector2dF(xScale, yScale);
}
-static inline double rad2deg(double r)
-{
- double pi = 3.14159265358979323846;
- return r * 180.0 / pi;
-}
-
float MathUtil::smallestAngleBetweenVectors(gfx::Vector2dF v1, gfx::Vector2dF v2)
{
double dotProduct = gfx::DotProduct(v1, v2) / v1.Length() / v2.Length();
// Clamp to compensate for rounding errors.
dotProduct = std::max(-1.0, std::min(1.0, dotProduct));
- return static_cast<float>(rad2deg(std::acos(dotProduct)));
+ return static_cast<float>(Rad2Deg(std::acos(dotProduct)));
}
gfx::Vector2dF MathUtil::projectVector(gfx::Vector2dF source, gfx::Vector2dF destination)
« no previous file with comments | « cc/math_util.h ('k') | cc/occlusion_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698