| 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 // The first frame draws and clears any damage. | 268 // The first frame draws and clears any damage. |
| 269 EXPECT_EQ(root_surface->content_rect(), root_damage); | 269 EXPECT_EQ(root_surface->content_rect(), root_damage); |
| 270 EXPECT_FALSE(frame_data->has_no_damage); | 270 EXPECT_FALSE(frame_data->has_no_damage); |
| 271 break; | 271 break; |
| 272 case 1: | 272 case 1: |
| 273 // If we get a frame without damage then we don't draw. | 273 // If we get a frame without damage then we don't draw. |
| 274 EXPECT_EQ(gfx::Rect(), root_damage); | 274 EXPECT_EQ(gfx::Rect(), root_damage); |
| 275 EXPECT_TRUE(frame_data->has_no_damage); | 275 EXPECT_TRUE(frame_data->has_no_damage); |
| 276 | 276 |
| 277 // Then we set full damage for the next frame. | 277 // Then we set full damage for the next frame. |
| 278 host_impl->SetFullRootLayerDamage(); | 278 host_impl->SetFullViewportDamage(); |
| 279 break; | 279 break; |
| 280 case 2: | 280 case 2: |
| 281 // The whole frame should be damaged as requested. | 281 // The whole frame should be damaged as requested. |
| 282 EXPECT_EQ(root_surface->content_rect(), root_damage); | 282 EXPECT_EQ(root_surface->content_rect(), root_damage); |
| 283 EXPECT_FALSE(frame_data->has_no_damage); | 283 EXPECT_FALSE(frame_data->has_no_damage); |
| 284 | 284 |
| 285 // Just a part of the next frame should be damaged. | 285 // Just a part of the next frame should be damaged. |
| 286 child_damage_rect_ = gfx::Rect(10, 11, 12, 13); | 286 child_damage_rect_ = gfx::Rect(10, 11, 12, 13); |
| 287 break; | 287 break; |
| 288 case 3: | 288 case 3: |
| 289 // The update rect in the child should be damaged and the damaged area | 289 // The update rect in the child should be damaged and the damaged area |
| 290 // should match the invalidation. | 290 // should match the invalidation. |
| 291 EXPECT_EQ(gfx::Rect(100 + 10, 100 + 11, 12, 13), root_damage); | 291 EXPECT_EQ(gfx::Rect(100 + 10, 100 + 11, 12, 13), root_damage); |
| 292 EXPECT_FALSE(frame_data->has_no_damage); | 292 EXPECT_FALSE(frame_data->has_no_damage); |
| 293 | 293 |
| 294 // If we damage part of the frame, but also damage the full | 294 // If we damage part of the frame, but also damage the full |
| 295 // frame, then the whole frame should be damaged. | 295 // frame, then the whole frame should be damaged. |
| 296 child_damage_rect_ = gfx::Rect(10, 11, 12, 13); | 296 child_damage_rect_ = gfx::Rect(10, 11, 12, 13); |
| 297 host_impl->SetFullRootLayerDamage(); | 297 host_impl->SetFullViewportDamage(); |
| 298 break; | 298 break; |
| 299 case 4: | 299 case 4: |
| 300 // The whole frame is damaged. | 300 // The whole frame is damaged. |
| 301 EXPECT_EQ(root_surface->content_rect(), root_damage); | 301 EXPECT_EQ(root_surface->content_rect(), root_damage); |
| 302 EXPECT_FALSE(frame_data->has_no_damage); | 302 EXPECT_FALSE(frame_data->has_no_damage); |
| 303 | 303 |
| 304 EndTest(); | 304 EndTest(); |
| 305 break; | 305 break; |
| 306 } | 306 } |
| 307 return draw_result; | 307 return draw_result; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 | 520 |
| 521 void AfterTest() override { EXPECT_EQ(3, num_draws_); } | 521 void AfterTest() override { EXPECT_EQ(3, num_draws_); } |
| 522 | 522 |
| 523 int num_draws_; | 523 int num_draws_; |
| 524 }; | 524 }; |
| 525 | 525 |
| 526 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); | 526 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestScrollbarCommitDoesNoDamage); |
| 527 | 527 |
| 528 } // namespace | 528 } // namespace |
| 529 } // namespace cc | 529 } // namespace cc |
| OLD | NEW |