| 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 "cc/base/math_util.h" | 7 #include "cc/base/math_util.h" |
| 8 #include "cc/layers/layer_impl.h" | 8 #include "cc/layers/layer_impl.h" |
| 9 #include "cc/output/filter_operation.h" | 9 #include "cc/output/filter_operation.h" |
| 10 #include "cc/output/filter_operations.h" | 10 #include "cc/output/filter_operations.h" |
| (...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 // - new location in target space: gfx::Rect(189, 205, 12, 8) | 1098 // - new location in target space: gfx::Rect(189, 205, 12, 8) |
| 1099 EXPECT_EQ(gfx::Rect(6, 8).ToString(), grand_child_damage_rect.ToString()); | 1099 EXPECT_EQ(gfx::Rect(6, 8).ToString(), grand_child_damage_rect.ToString()); |
| 1100 EXPECT_EQ(gfx::Rect(189, 200, 17, 13).ToString(), | 1100 EXPECT_EQ(gfx::Rect(189, 200, 17, 13).ToString(), |
| 1101 child_damage_rect.ToString()); | 1101 child_damage_rect.ToString()); |
| 1102 EXPECT_EQ(gfx::Rect(289, 300, 17, 13).ToString(), | 1102 EXPECT_EQ(gfx::Rect(289, 300, 17, 13).ToString(), |
| 1103 root_damage_rect.ToString()); | 1103 root_damage_rect.ToString()); |
| 1104 | 1104 |
| 1105 // CASE 3: removing the reflection should cause the entire region including | 1105 // CASE 3: removing the reflection should cause the entire region including |
| 1106 // reflection to damage the target surface. | 1106 // reflection to damage the target surface. |
| 1107 ClearDamageForAllSurfaces(root.get()); | 1107 ClearDamageForAllSurfaces(root.get()); |
| 1108 grand_child1->SetReplicaLayer(scoped_ptr<LayerImpl>()); | 1108 grand_child1->SetReplicaLayer(nullptr); |
| 1109 EmulateDrawingOneFrame(root.get()); | 1109 EmulateDrawingOneFrame(root.get()); |
| 1110 ASSERT_EQ(old_content_rect.width(), | 1110 ASSERT_EQ(old_content_rect.width(), |
| 1111 child1->render_surface()->content_rect().width()); | 1111 child1->render_surface()->content_rect().width()); |
| 1112 ASSERT_EQ(old_content_rect.height(), | 1112 ASSERT_EQ(old_content_rect.height(), |
| 1113 child1->render_surface()->content_rect().height()); | 1113 child1->render_surface()->content_rect().height()); |
| 1114 | 1114 |
| 1115 EXPECT_FALSE(grand_child1->render_surface()); | 1115 EXPECT_FALSE(grand_child1->render_surface()); |
| 1116 child_damage_rect = | 1116 child_damage_rect = |
| 1117 child1->render_surface()->damage_tracker()->current_damage_rect(); | 1117 child1->render_surface()->damage_tracker()->current_damage_rect(); |
| 1118 root_damage_rect = | 1118 root_damage_rect = |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1195 // Advance one frame without damage so that we know the damage rect is not | 1195 // Advance one frame without damage so that we know the damage rect is not |
| 1196 // leftover from the previous case. | 1196 // leftover from the previous case. |
| 1197 ClearDamageForAllSurfaces(root.get()); | 1197 ClearDamageForAllSurfaces(root.get()); |
| 1198 EmulateDrawingOneFrame(root.get()); | 1198 EmulateDrawingOneFrame(root.get()); |
| 1199 child_damage_rect = | 1199 child_damage_rect = |
| 1200 child->render_surface()->damage_tracker()->current_damage_rect(); | 1200 child->render_surface()->damage_tracker()->current_damage_rect(); |
| 1201 EXPECT_TRUE(child_damage_rect.IsEmpty()); | 1201 EXPECT_TRUE(child_damage_rect.IsEmpty()); |
| 1202 | 1202 |
| 1203 // Then test mask removal. | 1203 // Then test mask removal. |
| 1204 ClearDamageForAllSurfaces(root.get()); | 1204 ClearDamageForAllSurfaces(root.get()); |
| 1205 child->SetMaskLayer(scoped_ptr<LayerImpl>()); | 1205 child->SetMaskLayer(nullptr); |
| 1206 ASSERT_TRUE(child->LayerPropertyChanged()); | 1206 ASSERT_TRUE(child->LayerPropertyChanged()); |
| 1207 EmulateDrawingOneFrame(root.get()); | 1207 EmulateDrawingOneFrame(root.get()); |
| 1208 | 1208 |
| 1209 // Sanity check that a render surface still exists. | 1209 // Sanity check that a render surface still exists. |
| 1210 ASSERT_TRUE(child->render_surface()); | 1210 ASSERT_TRUE(child->render_surface()); |
| 1211 | 1211 |
| 1212 child_damage_rect = | 1212 child_damage_rect = |
| 1213 child->render_surface()->damage_tracker()->current_damage_rect(); | 1213 child->render_surface()->damage_tracker()->current_damage_rect(); |
| 1214 EXPECT_EQ(gfx::Rect(30, 30).ToString(), child_damage_rect.ToString()); | 1214 EXPECT_EQ(gfx::Rect(30, 30).ToString(), child_damage_rect.ToString()); |
| 1215 } | 1215 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 gfx::Rect child_damage_rect = | 1263 gfx::Rect child_damage_rect = |
| 1264 child1->render_surface()->damage_tracker()->current_damage_rect(); | 1264 child1->render_surface()->damage_tracker()->current_damage_rect(); |
| 1265 | 1265 |
| 1266 EXPECT_TRUE(grand_child_damage_rect.IsEmpty()); | 1266 EXPECT_TRUE(grand_child_damage_rect.IsEmpty()); |
| 1267 EXPECT_EQ(gfx::Rect(194, 200, 6, 8).ToString(), child_damage_rect.ToString()); | 1267 EXPECT_EQ(gfx::Rect(194, 200, 6, 8).ToString(), child_damage_rect.ToString()); |
| 1268 | 1268 |
| 1269 // CASE 2: removing the replica mask damages only the reflected region on the | 1269 // CASE 2: removing the replica mask damages only the reflected region on the |
| 1270 // target surface. | 1270 // target surface. |
| 1271 // | 1271 // |
| 1272 ClearDamageForAllSurfaces(root.get()); | 1272 ClearDamageForAllSurfaces(root.get()); |
| 1273 grand_child1_replica->SetMaskLayer(scoped_ptr<LayerImpl>()); | 1273 grand_child1_replica->SetMaskLayer(nullptr); |
| 1274 EmulateDrawingOneFrame(root.get()); | 1274 EmulateDrawingOneFrame(root.get()); |
| 1275 | 1275 |
| 1276 grand_child_damage_rect = | 1276 grand_child_damage_rect = |
| 1277 grand_child1->render_surface()->damage_tracker()-> | 1277 grand_child1->render_surface()->damage_tracker()-> |
| 1278 current_damage_rect(); | 1278 current_damage_rect(); |
| 1279 child_damage_rect = | 1279 child_damage_rect = |
| 1280 child1->render_surface()->damage_tracker()->current_damage_rect(); | 1280 child1->render_surface()->damage_tracker()->current_damage_rect(); |
| 1281 | 1281 |
| 1282 EXPECT_TRUE(grand_child_damage_rect.IsEmpty()); | 1282 EXPECT_TRUE(grand_child_damage_rect.IsEmpty()); |
| 1283 EXPECT_EQ(gfx::Rect(194, 200, 6, 8).ToString(), child_damage_rect.ToString()); | 1283 EXPECT_EQ(gfx::Rect(194, 200, 6, 8).ToString(), child_damage_rect.ToString()); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1462 gfx::Rect root_damage_rect = | 1462 gfx::Rect root_damage_rect = |
| 1463 root->render_surface()->damage_tracker()->current_damage_rect(); | 1463 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 1464 gfx::Rect damage_we_care_about = gfx::Rect(i, i); | 1464 gfx::Rect damage_we_care_about = gfx::Rect(i, i); |
| 1465 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); | 1465 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); |
| 1466 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); | 1466 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); |
| 1467 } | 1467 } |
| 1468 } | 1468 } |
| 1469 | 1469 |
| 1470 } // namespace | 1470 } // namespace |
| 1471 } // namespace cc | 1471 } // namespace cc |
| OLD | NEW |