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

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2721743003: Remove unused utility methods. (Closed)
Patch Set: Created 3 years, 10 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_common_unittest.cc
diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
index 31f5343c3f913aa43a32c3e361e73d5855868294..a28d8b19891a3a64babf7f72bc87675268458f19 100644
--- a/cc/trees/layer_tree_host_common_unittest.cc
+++ b/cc/trees/layer_tree_host_common_unittest.cc
@@ -2966,6 +2966,20 @@ TEST_F(LayerTreeHostCommonDrawRectsTest,
drawing_layer->drawable_content_rect());
}
+static bool projection_clips(const gfx::Transform& t, const gfx::RectF& r) {
danakj 2017/03/14 20:14:11 nit: ProjectionClips
Peter Mayo 2017/03/17 00:35:54 Done.
+ gfx::Transform inv_t(Inverse(t));
danakj 2017/03/14 20:14:11 nit: inverted (or some not-shortened word/s)
Peter Mayo 2017/03/17 00:35:54 Done.
+ bool clipped = false;
+ if (!clipped)
+ MathUtil::ProjectPoint(inv_t, r.top_right(), &clipped);
+ if (!clipped)
+ MathUtil::ProjectPoint(inv_t, r.origin(), &clipped);
+ if (!clipped)
+ MathUtil::ProjectPoint(inv_t, r.bottom_right(), &clipped);
+ if (!clipped)
+ MathUtil::ProjectPoint(inv_t, r.bottom_left(), &clipped);
+ return clipped;
+}
+
TEST_F(LayerTreeHostCommonDrawRectsTest, DrawRectsForPerspectiveUnprojection) {
// To determine visible rect in layer space, there needs to be an
// un-projection from surface space to layer space. When the original
@@ -2988,12 +3002,9 @@ TEST_F(LayerTreeHostCommonDrawRectsTest, DrawRectsForPerspectiveUnprojection) {
// Sanity check that un-projection does indeed cause w < 0, otherwise this
// code is not testing the intended scenario.
- bool clipped;
gfx::RectF clipped_rect = MathUtil::MapClippedRect(
layer_to_surface_transform, gfx::RectF(layer_content_rect));
- MathUtil::ProjectQuad(
- Inverse(layer_to_surface_transform), gfx::QuadF(clipped_rect), &clipped);
- ASSERT_TRUE(clipped);
+ ASSERT_TRUE(projection_clips(layer_to_surface_transform, clipped_rect));
// Only the corner of the layer is not visible on the surface because of being
// clipped. But, the net result of rounding visible region to an axis-aligned
« no previous file with comments | « cc/base/math_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698