OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/test/layer_test_common.h" | 5 #include "cc/test/layer_test_common.h" |
6 | 6 |
7 #include "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
8 #include "cc/base/region.h" | 8 #include "cc/base/region.h" |
9 #include "cc/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 EXPECT_TRUE(remaining.Contains(quad_rect)) | 57 EXPECT_TRUE(remaining.Contains(quad_rect)) |
58 << quad_string << i << " remaining: " << remaining.ToString() | 58 << quad_string << i << " remaining: " << remaining.ToString() |
59 << " quad: " << quad_rect.ToString(); | 59 << " quad: " << quad_rect.ToString(); |
60 remaining.Subtract(quad_rect); | 60 remaining.Subtract(quad_rect); |
61 } | 61 } |
62 | 62 |
63 EXPECT_TRUE(remaining.IsEmpty()); | 63 EXPECT_TRUE(remaining.IsEmpty()); |
64 } | 64 } |
65 | 65 |
66 // static | 66 // static |
67 void LayerTestCommon::VerifyQuadsCoverRectWithOcclusion( | 67 void LayerTestCommon::VerifyQuadsAreOccluded(const QuadList& quads, |
68 const QuadList& quads, | 68 const gfx::Rect& occluded, |
69 const gfx::Rect& rect, | 69 size_t* partially_occluded_count) { |
70 const gfx::Rect& occluded, | |
71 size_t* partially_occluded_count) { | |
72 // No quad should exist if it's fully occluded. | 70 // No quad should exist if it's fully occluded. |
73 for (size_t i = 0; i < quads.size(); ++i) { | 71 for (size_t i = 0; i < quads.size(); ++i) { |
74 EXPECT_FALSE(occluded.Contains(quads[i]->visible_rect)); | 72 gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect( |
| 73 quads[i]->quadTransform(), quads[i]->visible_rect); |
| 74 EXPECT_FALSE(occluded.Contains(target_visible_rect)); |
75 } | 75 } |
76 | 76 |
77 // Quads that are fully occluded on one axis only should be shrunken. | 77 // Quads that are fully occluded on one axis only should be shrunken. |
78 for (size_t i = 0; i < quads.size(); ++i) { | 78 for (size_t i = 0; i < quads.size(); ++i) { |
79 DrawQuad* quad = quads[i]; | 79 DrawQuad* quad = quads[i]; |
80 DCHECK(quad->quadTransform().IsIdentityOrIntegerTranslation()); | 80 DCHECK(quad->quadTransform().IsIdentityOrIntegerTranslation()); |
81 gfx::Rect target_rect = | 81 gfx::Rect target_rect = |
82 MathUtil::MapEnclosingClippedRect(quad->quadTransform(), quad->rect); | 82 MathUtil::MapEnclosingClippedRect(quad->quadTransform(), quad->rect); |
83 gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect( | 83 gfx::Rect target_visible_rect = MathUtil::MapEnclosingClippedRect( |
84 quad->quadTransform(), quad->visible_rect); | 84 quad->quadTransform(), quad->visible_rect); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 render_pass_->shared_quad_state_list.clear(); | 155 render_pass_->shared_quad_state_list.clear(); |
156 occlusion_tracker_.set_occluded_target_rect_for_contributing_surface( | 156 occlusion_tracker_.set_occluded_target_rect_for_contributing_surface( |
157 occluded); | 157 occluded); |
158 bool for_replica = false; | 158 bool for_replica = false; |
159 RenderPassId id(1, 1); | 159 RenderPassId id(1, 1); |
160 surface_impl->AppendQuads( | 160 surface_impl->AppendQuads( |
161 render_pass_.get(), occlusion_tracker_, &data, for_replica, id); | 161 render_pass_.get(), occlusion_tracker_, &data, for_replica, id); |
162 } | 162 } |
163 | 163 |
164 } // namespace cc | 164 } // namespace cc |
OLD | NEW |