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/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 case 2: | 356 case 2: |
357 // The whole frame should be damaged as requested. | 357 // The whole frame should be damaged as requested. |
358 EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(), | 358 EXPECT_EQ(gfx::RectF(root_surface->content_rect()).ToString(), |
359 root_damage.ToString()); | 359 root_damage.ToString()); |
360 EXPECT_FALSE(frame_data->has_no_damage); | 360 EXPECT_FALSE(frame_data->has_no_damage); |
361 | 361 |
362 // Just a part of the next frame should be damaged. | 362 // Just a part of the next frame should be damaged. |
363 child_damage_rect_ = gfx::RectF(10, 11, 12, 13); | 363 child_damage_rect_ = gfx::RectF(10, 11, 12, 13); |
364 break; | 364 break; |
365 case 3: | 365 case 3: |
366 if (!delegating_renderer() && | 366 // The update rect in the child should be damaged and the damaged area |
367 !host_impl->settings().impl_side_painting) { | 367 // should match the invalidation. |
368 // The update rect in the child should be damaged. | 368 EXPECT_EQ(gfx::RectF(100+10, 100+11, 12, 13).ToString(), |
369 // TODO(danakj): Remove this when impl side painting is always on. | 369 root_damage.ToString()); |
370 EXPECT_EQ(gfx::RectF(100+10, 100+11, 12, 13).ToString(), | 370 |
371 root_damage.ToString()); | 371 // TODO(danakj): Remove this when impl side painting is always on. |
372 } else { | 372 if (delegating_renderer() || |
| 373 host_impl->settings().impl_side_painting) { |
373 // When using a delegating renderer, or using impl side painting, the | 374 // When using a delegating renderer, or using impl side painting, the |
374 // entire child is considered damaged as we need to replace its | 375 // entire child is considered damaged as we need to replace its |
375 // resources with newly created ones. | 376 // resources with newly created ones. The damaged area is kept as it |
376 EXPECT_EQ(gfx::RectF(child_->position(), child_->bounds()).ToString(), | 377 // is, but entire child is painted. |
377 root_damage.ToString()); | 378 |
| 379 // The paint rect should match the layer bounds. |
| 380 gfx::RectF paint_rect = child_->LastPaintRect(); |
| 381 paint_rect.set_origin(child_->position()); |
| 382 EXPECT_EQ(gfx::RectF(100, 100, 30, 30).ToString(), |
| 383 paint_rect.ToString()); |
378 } | 384 } |
379 EXPECT_FALSE(frame_data->has_no_damage); | 385 EXPECT_FALSE(frame_data->has_no_damage); |
380 | 386 |
381 // If we damage part of the frame, but also damage the full | 387 // If we damage part of the frame, but also damage the full |
382 // frame, then the whole frame should be damaged. | 388 // frame, then the whole frame should be damaged. |
383 child_damage_rect_ = gfx::RectF(10, 11, 12, 13); | 389 child_damage_rect_ = gfx::RectF(10, 11, 12, 13); |
384 host_impl->SetFullRootLayerDamage(); | 390 host_impl->SetFullRootLayerDamage(); |
385 break; | 391 break; |
386 case 4: | 392 case 4: |
387 // The whole frame is damaged. | 393 // The whole frame is damaged. |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 FakeContentLayerClient client_; | 692 FakeContentLayerClient client_; |
687 int swap_count_; | 693 int swap_count_; |
688 int prepare_to_draw_count_; | 694 int prepare_to_draw_count_; |
689 int update_visible_tile_count_; | 695 int update_visible_tile_count_; |
690 }; | 696 }; |
691 | 697 |
692 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestVisibleTilesStillTriggerDraws); | 698 MULTI_THREAD_TEST_F(LayerTreeHostDamageTestVisibleTilesStillTriggerDraws); |
693 | 699 |
694 } // namespace | 700 } // namespace |
695 } // namespace cc | 701 } // namespace cc |
OLD | NEW |