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

Unified Diff: cc/base/math_util.cc

Issue 266913021: Hit test on the layer tree rather than the RSLL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Helps if you upload all your files. Created 6 years, 7 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/cc_tests.gyp » ('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 ca6e5711760f8b6a16ccfcb9f3e10c82b1f3ada7..641d6499cd147a759453baa86095101851ab5b6e 100644
--- a/cc/base/math_util.cc
+++ b/cc/base/math_util.cc
@@ -41,6 +41,15 @@ static HomogeneousCoordinate ProjectHomogeneousPoint(
return result;
}
+static HomogeneousCoordinate ProjectHomogeneousPoint(
+ const gfx::Transform& transform,
+ const gfx::PointF& p,
+ bool* clipped) {
+ HomogeneousCoordinate h = ProjectHomogeneousPoint(transform, p);
+ *clipped = h.w() <= 0;
+ return h;
+}
+
static HomogeneousCoordinate MapHomogeneousPoint(
const gfx::Transform& transform,
const gfx::Point3F& p) {
@@ -444,28 +453,27 @@ gfx::QuadF MathUtil::ProjectQuad(const gfx::Transform& transform,
gfx::PointF MathUtil::ProjectPoint(const gfx::Transform& transform,
const gfx::PointF& p,
bool* clipped) {
- HomogeneousCoordinate h = ProjectHomogeneousPoint(transform, p);
-
- if (h.w() > 0) {
- // The cartesian coordinates will be valid in this case.
- *clipped = false;
- return h.CartesianPoint2d();
- }
-
- // The cartesian coordinates will be invalid after dividing by w.
- *clipped = true;
-
+ HomogeneousCoordinate h = ProjectHomogeneousPoint(transform, p, clipped);
// Avoid dividing by w if w == 0.
if (!h.w())
return gfx::PointF();
- // This return value will be invalid because clipped == true, but (1) users of
+ // This return value will be invalid if clipped == true, but (1) users of
// this code should be ignoring the return value when clipped == true anyway,
// and (2) this behavior is more consistent with existing behavior of WebKit
// transforms if the user really does not ignore the return value.
return h.CartesianPoint2d();
}
+gfx::Point3F MathUtil::ProjectPoint3D(const gfx::Transform& transform,
+ const gfx::PointF& p,
+ bool* clipped) {
+ HomogeneousCoordinate h = ProjectHomogeneousPoint(transform, p, clipped);
+ if (!h.w())
+ return gfx::Point3F();
+ return h.CartesianPoint3d();
+}
+
gfx::RectF MathUtil::ScaleRectProportional(const gfx::RectF& input_outer_rect,
const gfx::RectF& scale_outer_rect,
const gfx::RectF& scale_inner_rect) {
« no previous file with comments | « cc/base/math_util.h ('k') | cc/cc_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698