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

Unified Diff: cc/trees/layer_sorter.cc

Issue 471113002: Revert of Remove unnecessary static function (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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/trees/layer_sorter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_sorter.cc
diff --git a/cc/trees/layer_sorter.cc b/cc/trees/layer_sorter.cc
index 8f3454e8514957ff47c5d194b62b4e65e64efa63..e171fe01120f6389931b1acb403581968e7126db 100644
--- a/cc/trees/layer_sorter.cc
+++ b/cc/trees/layer_sorter.cc
@@ -22,6 +22,11 @@
// a value near machine epsilon and then increasing it until the flickering on
// the test scene went away.
const float k_layer_epsilon = 1e-4f;
+
+inline static float PerpProduct(const gfx::Vector2dF& u,
+ const gfx::Vector2dF& v) {
+ return u.x() * v.y() - u.y() * v.x();
+}
// Tests if two edges defined by their endpoints (a,b) and (c,d) intersect.
// Returns true and the point of intersection if they do and false otherwise.
@@ -34,7 +39,7 @@
gfx::Vector2dF v = d - c;
gfx::Vector2dF w = a - c;
- float denom = static_cast<float>(gfx::CrossProduct(u, v));
+ float denom = PerpProduct(u, v);
// If denom == 0 then the edges are parallel. While they could be overlapping
// we don't bother to check here as the we'll find their intersections from
@@ -42,11 +47,11 @@
if (!denom)
return false;
- float s = static_cast<float>(gfx::CrossProduct(v, w)) / denom;
+ float s = PerpProduct(v, w) / denom;
if (s < 0.f || s > 1.f)
return false;
- float t = static_cast<float>(gfx::CrossProduct(u, w)) / denom;
+ float t = PerpProduct(u, w) / denom;
if (t < 0.f || t > 1.f)
return false;
« no previous file with comments | « cc/trees/layer_sorter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698