| 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/math_util.h" | 9 #include "cc/base/math_util.h" |
| 10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 RenderSurfaceImpl* target_surface = | 65 RenderSurfaceImpl* target_surface = |
| 66 render_surface_layer_list[index]->render_surface(); | 66 render_surface_layer_list[index]->render_surface(); |
| 67 target_surface->damage_tracker()->UpdateDamageTrackingState( | 67 target_surface->damage_tracker()->UpdateDamageTrackingState( |
| 68 target_surface->layer_list(), target_surface, | 68 target_surface->layer_list(), target_surface, |
| 69 target_surface->SurfacePropertyChangedOnlyFromDescendant(), | 69 target_surface->SurfacePropertyChangedOnlyFromDescendant(), |
| 70 target_surface->content_rect(), | 70 target_surface->content_rect(), |
| 71 render_surface_layer_list[index]->mask_layer(), | 71 render_surface_layer_list[index]->mask_layer(), |
| 72 render_surface_layer_list[index]->filters()); | 72 render_surface_layer_list[index]->filters()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 root->layer_tree_impl()->ResetAllChangeTracking( | 75 root->layer_tree_impl()->ResetAllChangeTracking(); |
| 76 PropertyTrees::ResetFlags::ALL_TREES); | |
| 77 } | 76 } |
| 78 | 77 |
| 79 class DamageTrackerTest : public testing::Test { | 78 class DamageTrackerTest : public testing::Test { |
| 80 public: | 79 public: |
| 81 DamageTrackerTest() | 80 DamageTrackerTest() |
| 82 : host_impl_(&task_runner_provider_, | 81 : host_impl_(&task_runner_provider_, |
| 83 &shared_bitmap_manager_, | 82 &shared_bitmap_manager_, |
| 84 &task_graph_runner_) {} | 83 &task_graph_runner_) {} |
| 85 | 84 |
| 86 LayerImpl* CreateTestTreeWithOneSurface() { | 85 LayerImpl* CreateTestTreeWithOneSurface() { |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface(); | 874 LayerImpl* root = CreateAndSetUpTestTreeWithOneSurface(); |
| 876 | 875 |
| 877 ClearDamageForAllSurfaces(root); | 876 ClearDamageForAllSurfaces(root); |
| 878 { | 877 { |
| 879 std::unique_ptr<LayerImpl> child2 = | 878 std::unique_ptr<LayerImpl> child2 = |
| 880 LayerImpl::Create(host_impl_.active_tree(), 3); | 879 LayerImpl::Create(host_impl_.active_tree(), 3); |
| 881 child2->SetPosition(gfx::PointF(400.f, 380.f)); | 880 child2->SetPosition(gfx::PointF(400.f, 380.f)); |
| 882 child2->SetBounds(gfx::Size(6, 8)); | 881 child2->SetBounds(gfx::Size(6, 8)); |
| 883 child2->SetDrawsContent(true); | 882 child2->SetDrawsContent(true); |
| 884 root->AddChild(std::move(child2)); | 883 root->AddChild(std::move(child2)); |
| 885 host_impl_.active_tree()->ResetAllChangeTracking( | 884 host_impl_.active_tree()->ResetAllChangeTracking(); |
| 886 PropertyTrees::ResetFlags::ALL_TREES); | |
| 887 LayerImpl* child2_ptr = host_impl_.active_tree()->LayerById(3); | 885 LayerImpl* child2_ptr = host_impl_.active_tree()->LayerById(3); |
| 888 // Sanity check the initial conditions of the test, if these asserts | 886 // Sanity check the initial conditions of the test, if these asserts |
| 889 // trigger, it means the test no longer actually covers the intended | 887 // trigger, it means the test no longer actually covers the intended |
| 890 // scenario. | 888 // scenario. |
| 891 ASSERT_FALSE(child2_ptr->LayerPropertyChanged()); | 889 ASSERT_FALSE(child2_ptr->LayerPropertyChanged()); |
| 892 ASSERT_TRUE(child2_ptr->update_rect().IsEmpty()); | 890 ASSERT_TRUE(child2_ptr->update_rect().IsEmpty()); |
| 893 } | 891 } |
| 894 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 892 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 895 EmulateDrawingOneFrame(root); | 893 EmulateDrawingOneFrame(root); |
| 896 | 894 |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 gfx::Rect root_damage_rect = | 1627 gfx::Rect root_damage_rect = |
| 1630 root->render_surface()->damage_tracker()->current_damage_rect(); | 1628 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 1631 gfx::Rect damage_we_care_about = gfx::Rect(i, i); | 1629 gfx::Rect damage_we_care_about = gfx::Rect(i, i); |
| 1632 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); | 1630 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); |
| 1633 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); | 1631 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); |
| 1634 } | 1632 } |
| 1635 } | 1633 } |
| 1636 | 1634 |
| 1637 } // namespace | 1635 } // namespace |
| 1638 } // namespace cc | 1636 } // namespace cc |
| OLD | NEW |