| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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); | 76 PropertyTrees::Types::EFFECT_AND_TRANSFORM_TREES); |
| 77 } | 77 } |
| 78 | 78 |
| 79 class DamageTrackerTest : public testing::Test { | 79 class DamageTrackerTest : public testing::Test { |
| 80 public: | 80 public: |
| 81 DamageTrackerTest() | 81 DamageTrackerTest() |
| 82 : host_impl_(&task_runner_provider_, | 82 : host_impl_(&task_runner_provider_, |
| 83 &shared_bitmap_manager_, | 83 &shared_bitmap_manager_, |
| 84 &task_graph_runner_) {} | 84 &task_graph_runner_) {} |
| 85 | 85 |
| 86 LayerImpl* CreateTestTreeWithOneSurface() { | 86 LayerImpl* CreateTestTreeWithOneSurface() { |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 | 858 |
| 859 ClearDamageForAllSurfaces(root); | 859 ClearDamageForAllSurfaces(root); |
| 860 { | 860 { |
| 861 std::unique_ptr<LayerImpl> child2 = | 861 std::unique_ptr<LayerImpl> child2 = |
| 862 LayerImpl::Create(host_impl_.active_tree(), 3); | 862 LayerImpl::Create(host_impl_.active_tree(), 3); |
| 863 child2->SetPosition(gfx::PointF(400.f, 380.f)); | 863 child2->SetPosition(gfx::PointF(400.f, 380.f)); |
| 864 child2->SetBounds(gfx::Size(6, 8)); | 864 child2->SetBounds(gfx::Size(6, 8)); |
| 865 child2->SetDrawsContent(true); | 865 child2->SetDrawsContent(true); |
| 866 root->AddChild(std::move(child2)); | 866 root->AddChild(std::move(child2)); |
| 867 host_impl_.active_tree()->ResetAllChangeTracking( | 867 host_impl_.active_tree()->ResetAllChangeTracking( |
| 868 PropertyTrees::ResetFlags::ALL_TREES); | 868 PropertyTrees::Types::EFFECT_AND_TRANSFORM_TREES); |
| 869 LayerImpl* child2_ptr = host_impl_.active_tree()->LayerById(3); | 869 LayerImpl* child2_ptr = host_impl_.active_tree()->LayerById(3); |
| 870 // Sanity check the initial conditions of the test, if these asserts | 870 // Sanity check the initial conditions of the test, if these asserts |
| 871 // trigger, it means the test no longer actually covers the intended | 871 // trigger, it means the test no longer actually covers the intended |
| 872 // scenario. | 872 // scenario. |
| 873 ASSERT_FALSE(child2_ptr->LayerPropertyChanged()); | 873 ASSERT_FALSE(child2_ptr->LayerPropertyChanged()); |
| 874 ASSERT_TRUE(child2_ptr->update_rect().IsEmpty()); | 874 ASSERT_TRUE(child2_ptr->update_rect().IsEmpty()); |
| 875 } | 875 } |
| 876 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 876 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
| 877 EmulateDrawingOneFrame(root); | 877 EmulateDrawingOneFrame(root); |
| 878 | 878 |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 gfx::Rect root_damage_rect = | 1611 gfx::Rect root_damage_rect = |
| 1612 root->render_surface()->damage_tracker()->current_damage_rect(); | 1612 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 1613 gfx::Rect damage_we_care_about = gfx::Rect(i, i); | 1613 gfx::Rect damage_we_care_about = gfx::Rect(i, i); |
| 1614 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); | 1614 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); |
| 1615 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); | 1615 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); |
| 1616 } | 1616 } |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 } // namespace | 1619 } // namespace |
| 1620 } // namespace cc | 1620 } // namespace cc |
| OLD | NEW |