| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layers/surface_layer_impl.h" | 5 #include "cc/layers/surface_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
| 10 #include "cc/test/layer_test_common.h" | 10 #include "cc/test/layer_test_common.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 EXPECT_EQ(impl.quad_list().size(), 0u); | 65 EXPECT_EQ(impl.quad_list().size(), 0u); |
| 66 } | 66 } |
| 67 | 67 |
| 68 { | 68 { |
| 69 SCOPED_TRACE("Partial occlusion"); | 69 SCOPED_TRACE("Partial occlusion"); |
| 70 gfx::Rect occluded(gfx::ScaleToEnclosingRect(gfx::Rect(200, 0, 312, 512), | 70 gfx::Rect occluded(gfx::ScaleToEnclosingRect(gfx::Rect(200, 0, 312, 512), |
| 71 device_scale_factor)); | 71 device_scale_factor)); |
| 72 impl.AppendQuadsWithOcclusion(surface_layer_impl, occluded); | 72 impl.AppendQuadsWithOcclusion(surface_layer_impl, occluded); |
| 73 | 73 |
| 74 size_t partially_occluded_count = 0; | 74 size_t partially_occluded_count = 0; |
| 75 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, | 75 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, false, |
| 76 &partially_occluded_count); | 76 &partially_occluded_count); |
| 77 // The layer outputs one quad, which is partially occluded. | 77 // The layer outputs one quad, which is partially occluded. |
| 78 EXPECT_EQ(1u, impl.quad_list().size()); | 78 EXPECT_EQ(1u, impl.quad_list().size()); |
| 79 EXPECT_EQ(1u, partially_occluded_count); | 79 EXPECT_EQ(1u, partially_occluded_count); |
| 80 } | 80 } |
| 81 { | 81 { |
| 82 SCOPED_TRACE("No outside occlusion"); | 82 SCOPED_TRACE("No outside occlusion"); |
| 83 gfx::Rect occluded(gfx::ScaleToEnclosingRect(gfx::Rect(0, 681, 681, 69), | 83 gfx::Rect occluded(gfx::ScaleToEnclosingRect(gfx::Rect(0, 681, 681, 69), |
| 84 device_scale_factor)); | 84 device_scale_factor)); |
| 85 impl.AppendQuadsWithOcclusion(surface_layer_impl, occluded); | 85 impl.AppendQuadsWithOcclusion(surface_layer_impl, occluded); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); | 126 LayerTestCommon::VerifyQuadsExactlyCoverRect(impl.quad_list(), gfx::Rect()); |
| 127 EXPECT_EQ(impl.quad_list().size(), 0u); | 127 EXPECT_EQ(impl.quad_list().size(), 0u); |
| 128 } | 128 } |
| 129 | 129 |
| 130 { | 130 { |
| 131 SCOPED_TRACE("Partial occlusion"); | 131 SCOPED_TRACE("Partial occlusion"); |
| 132 gfx::Rect occluded(200, 0, 800, 1000); | 132 gfx::Rect occluded(200, 0, 800, 1000); |
| 133 impl.AppendQuadsWithOcclusion(surface_layer_impl, occluded); | 133 impl.AppendQuadsWithOcclusion(surface_layer_impl, occluded); |
| 134 | 134 |
| 135 size_t partially_occluded_count = 0; | 135 size_t partially_occluded_count = 0; |
| 136 LayerTestCommon::VerifyQuadsAreOccluded( | 136 LayerTestCommon::VerifyQuadsAreOccluded(impl.quad_list(), occluded, false, |
| 137 impl.quad_list(), occluded, &partially_occluded_count); | 137 &partially_occluded_count); |
| 138 // The layer outputs one quad, which is partially occluded. | 138 // The layer outputs one quad, which is partially occluded. |
| 139 EXPECT_EQ(1u, impl.quad_list().size()); | 139 EXPECT_EQ(1u, impl.quad_list().size()); |
| 140 EXPECT_EQ(1u, partially_occluded_count); | 140 EXPECT_EQ(1u, partially_occluded_count); |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 TEST(SurfaceLayerImplTest, SurfaceStretchedToLayerBounds) { | 144 TEST(SurfaceLayerImplTest, SurfaceStretchedToLayerBounds) { |
| 145 LayerTestCommon::LayerImplTest impl; | 145 LayerTestCommon::LayerImplTest impl; |
| 146 SurfaceLayerImpl* surface_layer_impl = | 146 SurfaceLayerImpl* surface_layer_impl = |
| 147 impl.AddChildToRoot<SurfaceLayerImpl>(); | 147 impl.AddChildToRoot<SurfaceLayerImpl>(); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 ASSERT_TRUE(surface_draw_quad1); | 366 ASSERT_TRUE(surface_draw_quad1); |
| 367 | 367 |
| 368 EXPECT_EQ(SurfaceDrawQuadType::PRIMARY, | 368 EXPECT_EQ(SurfaceDrawQuadType::PRIMARY, |
| 369 surface_draw_quad1->surface_draw_quad_type); | 369 surface_draw_quad1->surface_draw_quad_type); |
| 370 EXPECT_EQ(surface_id1, surface_draw_quad1->surface_id); | 370 EXPECT_EQ(surface_id1, surface_draw_quad1->surface_id); |
| 371 EXPECT_FALSE(surface_draw_quad1->fallback_quad); | 371 EXPECT_FALSE(surface_draw_quad1->fallback_quad); |
| 372 } | 372 } |
| 373 | 373 |
| 374 } // namespace | 374 } // namespace |
| 375 } // namespace cc | 375 } // namespace cc |
| OLD | NEW |