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 |