OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/trees/damage_tracker.h" | 5 #include "cc/trees/damage_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/base/filter_operation.h" | 9 #include "cc/base/filter_operation.h" |
10 #include "cc/base/filter_operations.h" | 10 #include "cc/base/filter_operations.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 LayerImpl* child1 = root->test_properties()->children[0]; | 200 LayerImpl* child1 = root->test_properties()->children[0]; |
201 LayerImpl* child2 = root->test_properties()->children[1]; | 201 LayerImpl* child2 = root->test_properties()->children[1]; |
202 | 202 |
203 gfx::Rect child_damage_rect; | 203 gfx::Rect child_damage_rect; |
204 EXPECT_TRUE(GetRenderSurface(child1)->damage_tracker()->GetDamageRectIfValid( | 204 EXPECT_TRUE(GetRenderSurface(child1)->damage_tracker()->GetDamageRectIfValid( |
205 &child_damage_rect)); | 205 &child_damage_rect)); |
206 gfx::Rect root_damage_rect; | 206 gfx::Rect root_damage_rect; |
207 EXPECT_TRUE(GetRenderSurface(root)->damage_tracker()->GetDamageRectIfValid( | 207 EXPECT_TRUE(GetRenderSurface(root)->damage_tracker()->GetDamageRectIfValid( |
208 &root_damage_rect)); | 208 &root_damage_rect)); |
209 | 209 |
210 ASSERT_TRUE(GetRenderSurface(child1)); | 210 EXPECT_NE(GetRenderSurface(child1), GetRenderSurface(root)); |
211 EXPECT_FALSE(GetRenderSurface(child2)); | 211 EXPECT_EQ(GetRenderSurface(child2), GetRenderSurface(root)); |
212 EXPECT_EQ(3, GetRenderSurface(root)->num_contributors()); | 212 EXPECT_EQ(3, GetRenderSurface(root)->num_contributors()); |
213 EXPECT_EQ(2, GetRenderSurface(child1)->num_contributors()); | 213 EXPECT_EQ(2, GetRenderSurface(child1)->num_contributors()); |
214 | 214 |
215 // The render surface for child1 only has a content_rect that encloses | 215 // The render surface for child1 only has a content_rect that encloses |
216 // grand_child1 and grand_child2, because child1 does not draw content. | 216 // grand_child1 and grand_child2, because child1 does not draw content. |
217 EXPECT_EQ(gfx::Rect(190, 190, 16, 18).ToString(), | 217 EXPECT_EQ(gfx::Rect(190, 190, 16, 18).ToString(), |
218 child_damage_rect.ToString()); | 218 child_damage_rect.ToString()); |
219 EXPECT_EQ(gfx::Rect(500, 500).ToString(), root_damage_rect.ToString()); | 219 EXPECT_EQ(gfx::Rect(500, 500).ToString(), root_damage_rect.ToString()); |
220 } | 220 } |
221 | 221 |
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 gfx::Rect root_damage_rect; | 1098 gfx::Rect root_damage_rect; |
1099 | 1099 |
1100 // CASE 1: If a descendant surface disappears, its entire old area becomes | 1100 // CASE 1: If a descendant surface disappears, its entire old area becomes |
1101 // exposed. | 1101 // exposed. |
1102 ClearDamageForAllSurfaces(root); | 1102 ClearDamageForAllSurfaces(root); |
1103 child1->test_properties()->force_render_surface = false; | 1103 child1->test_properties()->force_render_surface = false; |
1104 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 1104 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
1105 EmulateDrawingOneFrame(root); | 1105 EmulateDrawingOneFrame(root); |
1106 | 1106 |
1107 // Sanity check that there is only one surface now. | 1107 // Sanity check that there is only one surface now. |
1108 ASSERT_FALSE(GetRenderSurface(child1)); | 1108 ASSERT_EQ(GetRenderSurface(child1), GetRenderSurface(root)); |
1109 ASSERT_EQ(4, GetRenderSurface(root)->num_contributors()); | 1109 ASSERT_EQ(4, GetRenderSurface(root)->num_contributors()); |
1110 | 1110 |
1111 EXPECT_TRUE(GetRenderSurface(root)->damage_tracker()->GetDamageRectIfValid( | 1111 EXPECT_TRUE(GetRenderSurface(root)->damage_tracker()->GetDamageRectIfValid( |
1112 &root_damage_rect)); | 1112 &root_damage_rect)); |
1113 EXPECT_EQ(gfx::Rect(290, 290, 16, 18).ToString(), | 1113 EXPECT_EQ(gfx::Rect(290, 290, 16, 18).ToString(), |
1114 root_damage_rect.ToString()); | 1114 root_damage_rect.ToString()); |
1115 | 1115 |
1116 // CASE 2: If a descendant surface appears, its entire old area becomes | 1116 // CASE 2: If a descendant surface appears, its entire old area becomes |
1117 // exposed. | 1117 // exposed. |
1118 | 1118 |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 ASSERT_TRUE(GetRenderSurface(root)->damage_tracker()->GetDamageRectIfValid( | 1633 ASSERT_TRUE(GetRenderSurface(root)->damage_tracker()->GetDamageRectIfValid( |
1634 &damage_rect)); | 1634 &damage_rect)); |
1635 EXPECT_TRUE(damage_rect.Contains(GetRenderSurface(root)->content_rect())); | 1635 EXPECT_TRUE(damage_rect.Contains(GetRenderSurface(root)->content_rect())); |
1636 EXPECT_TRUE(damage_rect.Contains( | 1636 EXPECT_TRUE(damage_rect.Contains( |
1637 gfx::ToEnclosingRect(GetRenderSurface(child1)->DrawableContentRect()))); | 1637 gfx::ToEnclosingRect(GetRenderSurface(child1)->DrawableContentRect()))); |
1638 EXPECT_EQ(damage_rect, GetRenderSurface(root)->GetDamageRect()); | 1638 EXPECT_EQ(damage_rect, GetRenderSurface(root)->GetDamageRect()); |
1639 } | 1639 } |
1640 | 1640 |
1641 } // namespace | 1641 } // namespace |
1642 } // namespace cc | 1642 } // namespace cc |
OLD | NEW |