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

Unified Diff: cc/base/math_util.cc

Issue 130443005: [#5] Pass gfx structs by const ref (gfx::Vector2dF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated the review comments Created 6 years, 11 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 | « cc/base/math_util.h ('k') | cc/input/input_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/math_util.cc
diff --git a/cc/base/math_util.cc b/cc/base/math_util.cc
index 099a993fedb88132512de741efd33a436c35451e..8abfa90f0b31ca301824859546258fbb8f9074fd 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -492,16 +492,16 @@ gfx::Vector2dF MathUtil::ComputeTransform2dScaleComponents(
return gfx::Vector2dF(x_scale, y_scale);
}
-float MathUtil::SmallestAngleBetweenVectors(gfx::Vector2dF v1,
- gfx::Vector2dF v2) {
+float MathUtil::SmallestAngleBetweenVectors(const gfx::Vector2dF& v1,
+ const gfx::Vector2dF& v2) {
double dot_product = gfx::DotProduct(v1, v2) / v1.Length() / v2.Length();
// Clamp to compensate for rounding errors.
dot_product = std::max(-1.0, std::min(1.0, dot_product));
return static_cast<float>(Rad2Deg(std::acos(dot_product)));
}
-gfx::Vector2dF MathUtil::ProjectVector(gfx::Vector2dF source,
- gfx::Vector2dF destination) {
+gfx::Vector2dF MathUtil::ProjectVector(const gfx::Vector2dF& source,
+ const gfx::Vector2dF& destination) {
float projected_length =
gfx::DotProduct(source, destination) / destination.LengthSquared();
return gfx::Vector2dF(projected_length * destination.x(),
« no previous file with comments | « cc/base/math_util.h ('k') | cc/input/input_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698