Commit c23a242e authored by danakj@chromium.org's avatar danakj@chromium.org

Revert of Remove unnecessary static function (patchset #2 of...

Revert of Remove unnecessary static function (patchset #2 of https://codereview.chromium.org/444983002/)

Reason for revert:
Perf regression, due to the method no longer being inline, and using doubles instead of floats.

Original issue's description:
> Remove unnecessary static function
> 
> Use gfx::CrossProduct() instead of defining a new static function.
> 
> BUG=
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=288372

TBR=enne@chromium.org,heejin.r.chung@samsung.com
NOTREECHECKS=true
NOTRY=true
BUG=402552

Review URL: https://codereview.chromium.org/471113002

Cr-Commit-Position: refs/heads/master@{#289645}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289645 0039d316-1c4b-4281-b951-d872f2087c98
parent 8d3d21ea
......@@ -23,6 +23,11 @@ namespace cc {
// 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.
static bool EdgeEdgeTest(const gfx::PointF& a,
......@@ -34,7 +39,7 @@ static bool EdgeEdgeTest(const gfx::PointF& a,
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 @@ static bool EdgeEdgeTest(const gfx::PointF& a,
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;
......
......@@ -11,10 +11,10 @@
#include "base/containers/hash_tables.h"
#include "cc/base/cc_export.h"
#include "cc/layers/layer_impl.h"
#include "ui/gfx/geometry/point3_f.h"
#include "ui/gfx/geometry/quad_f.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/vector3d_f.h"
#include "ui/gfx/point3_f.h"
#include "ui/gfx/quad_f.h"
#include "ui/gfx/rect_f.h"
#include "ui/gfx/vector3d_f.h"
#if defined(COMPILER_GCC)
namespace cc { struct GraphEdge; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment