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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 root->SetPosition(gfx::PointF()); | 92 root->SetPosition(gfx::PointF()); |
93 root->SetBounds(gfx::Size(500, 500)); | 93 root->SetBounds(gfx::Size(500, 500)); |
94 root->SetDrawsContent(true); | 94 root->SetDrawsContent(true); |
95 root->SetHasRenderSurface(true); | 95 root->SetHasRenderSurface(true); |
96 root->render_surface()->SetContentRect(gfx::Rect(0, 0, 500, 500)); | 96 root->render_surface()->SetContentRect(gfx::Rect(0, 0, 500, 500)); |
97 | 97 |
98 child->SetPosition(gfx::PointF(100.f, 100.f)); | 98 child->SetPosition(gfx::PointF(100.f, 100.f)); |
99 child->SetBounds(gfx::Size(30, 30)); | 99 child->SetBounds(gfx::Size(30, 30)); |
100 child->SetDrawsContent(true); | 100 child->SetDrawsContent(true); |
101 root->AddChild(child.Pass()); | 101 root->AddChild(std::move(child)); |
102 | 102 |
103 return root.Pass(); | 103 return root; |
104 } | 104 } |
105 | 105 |
106 scoped_ptr<LayerImpl> CreateTestTreeWithTwoSurfaces() { | 106 scoped_ptr<LayerImpl> CreateTestTreeWithTwoSurfaces() { |
107 // This test tree has two render surfaces: one for the root, and one for | 107 // This test tree has two render surfaces: one for the root, and one for |
108 // child1. Additionally, the root has a second child layer, and child1 has | 108 // child1. Additionally, the root has a second child layer, and child1 has |
109 // two children of its own. | 109 // two children of its own. |
110 | 110 |
111 scoped_ptr<LayerImpl> root = | 111 scoped_ptr<LayerImpl> root = |
112 LayerImpl::Create(host_impl_.active_tree(), 1); | 112 LayerImpl::Create(host_impl_.active_tree(), 1); |
113 scoped_ptr<LayerImpl> child1 = | 113 scoped_ptr<LayerImpl> child1 = |
(...skipping 24 matching lines...) Expand all Loading... |
138 child2->SetDrawsContent(true); | 138 child2->SetDrawsContent(true); |
139 | 139 |
140 grand_child1->SetPosition(gfx::PointF(200.f, 200.f)); | 140 grand_child1->SetPosition(gfx::PointF(200.f, 200.f)); |
141 grand_child1->SetBounds(gfx::Size(6, 8)); | 141 grand_child1->SetBounds(gfx::Size(6, 8)); |
142 grand_child1->SetDrawsContent(true); | 142 grand_child1->SetDrawsContent(true); |
143 | 143 |
144 grand_child2->SetPosition(gfx::PointF(190.f, 190.f)); | 144 grand_child2->SetPosition(gfx::PointF(190.f, 190.f)); |
145 grand_child2->SetBounds(gfx::Size(6, 8)); | 145 grand_child2->SetBounds(gfx::Size(6, 8)); |
146 grand_child2->SetDrawsContent(true); | 146 grand_child2->SetDrawsContent(true); |
147 | 147 |
148 child1->AddChild(grand_child1.Pass()); | 148 child1->AddChild(std::move(grand_child1)); |
149 child1->AddChild(grand_child2.Pass()); | 149 child1->AddChild(std::move(grand_child2)); |
150 root->AddChild(child1.Pass()); | 150 root->AddChild(std::move(child1)); |
151 root->AddChild(child2.Pass()); | 151 root->AddChild(std::move(child2)); |
152 | 152 |
153 return root.Pass(); | 153 return root; |
154 } | 154 } |
155 | 155 |
156 scoped_ptr<LayerImpl> CreateAndSetUpTestTreeWithOneSurface() { | 156 scoped_ptr<LayerImpl> CreateAndSetUpTestTreeWithOneSurface() { |
157 scoped_ptr<LayerImpl> root = CreateTestTreeWithOneSurface(); | 157 scoped_ptr<LayerImpl> root = CreateTestTreeWithOneSurface(); |
158 | 158 |
159 // Setup includes going past the first frame which always damages | 159 // Setup includes going past the first frame which always damages |
160 // everything, so that we can actually perform specific tests. | 160 // everything, so that we can actually perform specific tests. |
161 EmulateDrawingOneFrame(root.get()); | 161 EmulateDrawingOneFrame(root.get()); |
162 | 162 |
163 return root.Pass(); | 163 return root; |
164 } | 164 } |
165 | 165 |
166 scoped_ptr<LayerImpl> CreateAndSetUpTestTreeWithTwoSurfaces() { | 166 scoped_ptr<LayerImpl> CreateAndSetUpTestTreeWithTwoSurfaces() { |
167 scoped_ptr<LayerImpl> root = CreateTestTreeWithTwoSurfaces(); | 167 scoped_ptr<LayerImpl> root = CreateTestTreeWithTwoSurfaces(); |
168 | 168 |
169 // Setup includes going past the first frame which always damages | 169 // Setup includes going past the first frame which always damages |
170 // everything, so that we can actually perform specific tests. | 170 // everything, so that we can actually perform specific tests. |
171 EmulateDrawingOneFrame(root.get()); | 171 EmulateDrawingOneFrame(root.get()); |
172 | 172 |
173 return root.Pass(); | 173 return root; |
174 } | 174 } |
175 | 175 |
176 protected: | 176 protected: |
177 FakeImplTaskRunnerProvider task_runner_provider_; | 177 FakeImplTaskRunnerProvider task_runner_provider_; |
178 TestSharedBitmapManager shared_bitmap_manager_; | 178 TestSharedBitmapManager shared_bitmap_manager_; |
179 TestTaskGraphRunner task_graph_runner_; | 179 TestTaskGraphRunner task_graph_runner_; |
180 FakeLayerTreeHostImpl host_impl_; | 180 FakeLayerTreeHostImpl host_impl_; |
181 }; | 181 }; |
182 | 182 |
183 TEST_F(DamageTrackerTest, SanityCheckTestTreeWithOneSurface) { | 183 TEST_F(DamageTrackerTest, SanityCheckTestTreeWithOneSurface) { |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 711 |
712 // CASE 1: Adding a new layer should cause the appropriate damage. | 712 // CASE 1: Adding a new layer should cause the appropriate damage. |
713 // | 713 // |
714 ClearDamageForAllSurfaces(root.get()); | 714 ClearDamageForAllSurfaces(root.get()); |
715 { | 715 { |
716 scoped_ptr<LayerImpl> child2 = | 716 scoped_ptr<LayerImpl> child2 = |
717 LayerImpl::Create(host_impl_.active_tree(), 3); | 717 LayerImpl::Create(host_impl_.active_tree(), 3); |
718 child2->SetPosition(gfx::PointF(400.f, 380.f)); | 718 child2->SetPosition(gfx::PointF(400.f, 380.f)); |
719 child2->SetBounds(gfx::Size(6, 8)); | 719 child2->SetBounds(gfx::Size(6, 8)); |
720 child2->SetDrawsContent(true); | 720 child2->SetDrawsContent(true); |
721 root->AddChild(child2.Pass()); | 721 root->AddChild(std::move(child2)); |
722 } | 722 } |
723 EmulateDrawingOneFrame(root.get()); | 723 EmulateDrawingOneFrame(root.get()); |
724 | 724 |
725 // Sanity check - all 3 layers should be on the same render surface; render | 725 // Sanity check - all 3 layers should be on the same render surface; render |
726 // surfaces are tested elsewhere. | 726 // surfaces are tested elsewhere. |
727 ASSERT_EQ(3u, root->render_surface()->layer_list().size()); | 727 ASSERT_EQ(3u, root->render_surface()->layer_list().size()); |
728 | 728 |
729 gfx::Rect root_damage_rect = | 729 gfx::Rect root_damage_rect = |
730 root->render_surface()->damage_tracker()->current_damage_rect(); | 730 root->render_surface()->damage_tracker()->current_damage_rect(); |
731 EXPECT_EQ(gfx::Rect(400, 380, 6, 8).ToString(), root_damage_rect.ToString()); | 731 EXPECT_EQ(gfx::Rect(400, 380, 6, 8).ToString(), root_damage_rect.ToString()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 LayerImpl::Create(host_impl_.active_tree(), 3); | 765 LayerImpl::Create(host_impl_.active_tree(), 3); |
766 child2->SetPosition(gfx::PointF(400.f, 380.f)); | 766 child2->SetPosition(gfx::PointF(400.f, 380.f)); |
767 child2->SetBounds(gfx::Size(6, 8)); | 767 child2->SetBounds(gfx::Size(6, 8)); |
768 child2->SetDrawsContent(true); | 768 child2->SetDrawsContent(true); |
769 child2->ResetAllChangeTrackingForSubtree(); | 769 child2->ResetAllChangeTrackingForSubtree(); |
770 // Sanity check the initial conditions of the test, if these asserts | 770 // Sanity check the initial conditions of the test, if these asserts |
771 // trigger, it means the test no longer actually covers the intended | 771 // trigger, it means the test no longer actually covers the intended |
772 // scenario. | 772 // scenario. |
773 ASSERT_FALSE(child2->LayerPropertyChanged()); | 773 ASSERT_FALSE(child2->LayerPropertyChanged()); |
774 ASSERT_TRUE(child2->update_rect().IsEmpty()); | 774 ASSERT_TRUE(child2->update_rect().IsEmpty()); |
775 root->AddChild(child2.Pass()); | 775 root->AddChild(std::move(child2)); |
776 } | 776 } |
777 EmulateDrawingOneFrame(root.get()); | 777 EmulateDrawingOneFrame(root.get()); |
778 | 778 |
779 // Sanity check - all 3 layers should be on the same render surface; render | 779 // Sanity check - all 3 layers should be on the same render surface; render |
780 // surfaces are tested elsewhere. | 780 // surfaces are tested elsewhere. |
781 ASSERT_EQ(3u, root->render_surface()->layer_list().size()); | 781 ASSERT_EQ(3u, root->render_surface()->layer_list().size()); |
782 | 782 |
783 gfx::Rect root_damage_rect = | 783 gfx::Rect root_damage_rect = |
784 root->render_surface()->damage_tracker()->current_damage_rect(); | 784 root->render_surface()->damage_tracker()->current_damage_rect(); |
785 EXPECT_EQ(gfx::Rect(400, 380, 6, 8).ToString(), root_damage_rect.ToString()); | 785 EXPECT_EQ(gfx::Rect(400, 380, 6, 8).ToString(), root_damage_rect.ToString()); |
786 } | 786 } |
787 | 787 |
788 TEST_F(DamageTrackerTest, VerifyDamageForMultipleLayers) { | 788 TEST_F(DamageTrackerTest, VerifyDamageForMultipleLayers) { |
789 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface(); | 789 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface(); |
790 LayerImpl* child1 = root->children()[0].get(); | 790 LayerImpl* child1 = root->children()[0].get(); |
791 | 791 |
792 // In this test we don't want the above tree manipulation to be considered | 792 // In this test we don't want the above tree manipulation to be considered |
793 // part of the same frame. | 793 // part of the same frame. |
794 ClearDamageForAllSurfaces(root.get()); | 794 ClearDamageForAllSurfaces(root.get()); |
795 { | 795 { |
796 scoped_ptr<LayerImpl> child2 = | 796 scoped_ptr<LayerImpl> child2 = |
797 LayerImpl::Create(host_impl_.active_tree(), 3); | 797 LayerImpl::Create(host_impl_.active_tree(), 3); |
798 child2->SetPosition(gfx::PointF(400.f, 380.f)); | 798 child2->SetPosition(gfx::PointF(400.f, 380.f)); |
799 child2->SetBounds(gfx::Size(6, 8)); | 799 child2->SetBounds(gfx::Size(6, 8)); |
800 child2->SetDrawsContent(true); | 800 child2->SetDrawsContent(true); |
801 root->AddChild(child2.Pass()); | 801 root->AddChild(std::move(child2)); |
802 } | 802 } |
803 LayerImpl* child2 = root->children()[1].get(); | 803 LayerImpl* child2 = root->children()[1].get(); |
804 EmulateDrawingOneFrame(root.get()); | 804 EmulateDrawingOneFrame(root.get()); |
805 | 805 |
806 // Damaging two layers simultaneously should cause combined damage. | 806 // Damaging two layers simultaneously should cause combined damage. |
807 // - child1 update rect in surface space: gfx::Rect(100, 100, 1, 2); | 807 // - child1 update rect in surface space: gfx::Rect(100, 100, 1, 2); |
808 // - child2 update rect in surface space: gfx::Rect(400, 380, 3, 4); | 808 // - child2 update rect in surface space: gfx::Rect(400, 380, 3, 4); |
809 ClearDamageForAllSurfaces(root.get()); | 809 ClearDamageForAllSurfaces(root.get()); |
810 child1->SetUpdateRect(gfx::Rect(1, 2)); | 810 child1->SetUpdateRect(gfx::Rect(1, 2)); |
811 child2->SetUpdateRect(gfx::Rect(3, 4)); | 811 child2->SetUpdateRect(gfx::Rect(3, 4)); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 // For this test case, we modify grand_child2, and add grand_child3 to extend | 1040 // For this test case, we modify grand_child2, and add grand_child3 to extend |
1041 // the bounds of child1's surface. This way, we can test reflection changes | 1041 // the bounds of child1's surface. This way, we can test reflection changes |
1042 // without changing content_bounds of the surface. | 1042 // without changing content_bounds of the surface. |
1043 grand_child2->SetPosition(gfx::PointF(180.f, 180.f)); | 1043 grand_child2->SetPosition(gfx::PointF(180.f, 180.f)); |
1044 { | 1044 { |
1045 scoped_ptr<LayerImpl> grand_child3 = | 1045 scoped_ptr<LayerImpl> grand_child3 = |
1046 LayerImpl::Create(host_impl_.active_tree(), 6); | 1046 LayerImpl::Create(host_impl_.active_tree(), 6); |
1047 grand_child3->SetPosition(gfx::PointF(240.f, 240.f)); | 1047 grand_child3->SetPosition(gfx::PointF(240.f, 240.f)); |
1048 grand_child3->SetBounds(gfx::Size(10, 10)); | 1048 grand_child3->SetBounds(gfx::Size(10, 10)); |
1049 grand_child3->SetDrawsContent(true); | 1049 grand_child3->SetDrawsContent(true); |
1050 child1->AddChild(grand_child3.Pass()); | 1050 child1->AddChild(std::move(grand_child3)); |
1051 } | 1051 } |
1052 child1->SetOpacity(0.5f); | 1052 child1->SetOpacity(0.5f); |
1053 EmulateDrawingOneFrame(root.get()); | 1053 EmulateDrawingOneFrame(root.get()); |
1054 | 1054 |
1055 // CASE 1: adding a reflection about the left edge of grand_child1. | 1055 // CASE 1: adding a reflection about the left edge of grand_child1. |
1056 // | 1056 // |
1057 ClearDamageForAllSurfaces(root.get()); | 1057 ClearDamageForAllSurfaces(root.get()); |
1058 { | 1058 { |
1059 scoped_ptr<LayerImpl> grand_child1_replica = | 1059 scoped_ptr<LayerImpl> grand_child1_replica = |
1060 LayerImpl::Create(host_impl_.active_tree(), 7); | 1060 LayerImpl::Create(host_impl_.active_tree(), 7); |
1061 grand_child1_replica->SetPosition(gfx::PointF()); | 1061 grand_child1_replica->SetPosition(gfx::PointF()); |
1062 gfx::Transform reflection; | 1062 gfx::Transform reflection; |
1063 reflection.Scale3d(-1.0, 1.0, 1.0); | 1063 reflection.Scale3d(-1.0, 1.0, 1.0); |
1064 grand_child1_replica->SetTransform(reflection); | 1064 grand_child1_replica->SetTransform(reflection); |
1065 grand_child1->SetReplicaLayer(grand_child1_replica.Pass()); | 1065 grand_child1->SetReplicaLayer(std::move(grand_child1_replica)); |
1066 grand_child1->SetHasRenderSurface(true); | 1066 grand_child1->SetHasRenderSurface(true); |
1067 } | 1067 } |
1068 EmulateDrawingOneFrame(root.get()); | 1068 EmulateDrawingOneFrame(root.get()); |
1069 | 1069 |
1070 gfx::Rect grand_child_damage_rect = | 1070 gfx::Rect grand_child_damage_rect = |
1071 grand_child1->render_surface()->damage_tracker()->current_damage_rect(); | 1071 grand_child1->render_surface()->damage_tracker()->current_damage_rect(); |
1072 gfx::Rect child_damage_rect = | 1072 gfx::Rect child_damage_rect = |
1073 child1->render_surface()->damage_tracker()->current_damage_rect(); | 1073 child1->render_surface()->damage_tracker()->current_damage_rect(); |
1074 gfx::Rect root_damage_rect = | 1074 gfx::Rect root_damage_rect = |
1075 root->render_surface()->damage_tracker()->current_damage_rect(); | 1075 root->render_surface()->damage_tracker()->current_damage_rect(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 // layers should damage the entire corresponding surface. | 1140 // layers should damage the entire corresponding surface. |
1141 | 1141 |
1142 ClearDamageForAllSurfaces(root.get()); | 1142 ClearDamageForAllSurfaces(root.get()); |
1143 | 1143 |
1144 // Set up the mask layer. | 1144 // Set up the mask layer. |
1145 { | 1145 { |
1146 scoped_ptr<LayerImpl> mask_layer = | 1146 scoped_ptr<LayerImpl> mask_layer = |
1147 LayerImpl::Create(host_impl_.active_tree(), 3); | 1147 LayerImpl::Create(host_impl_.active_tree(), 3); |
1148 mask_layer->SetPosition(child->position()); | 1148 mask_layer->SetPosition(child->position()); |
1149 mask_layer->SetBounds(child->bounds()); | 1149 mask_layer->SetBounds(child->bounds()); |
1150 child->SetMaskLayer(mask_layer.Pass()); | 1150 child->SetMaskLayer(std::move(mask_layer)); |
1151 child->SetHasRenderSurface(true); | 1151 child->SetHasRenderSurface(true); |
1152 } | 1152 } |
1153 LayerImpl* mask_layer = child->mask_layer(); | 1153 LayerImpl* mask_layer = child->mask_layer(); |
1154 | 1154 |
1155 // Add opacity and a grand_child so that the render surface persists even | 1155 // Add opacity and a grand_child so that the render surface persists even |
1156 // after we remove the mask. | 1156 // after we remove the mask. |
1157 { | 1157 { |
1158 scoped_ptr<LayerImpl> grand_child = | 1158 scoped_ptr<LayerImpl> grand_child = |
1159 LayerImpl::Create(host_impl_.active_tree(), 4); | 1159 LayerImpl::Create(host_impl_.active_tree(), 4); |
1160 grand_child->SetPosition(gfx::PointF(2.f, 2.f)); | 1160 grand_child->SetPosition(gfx::PointF(2.f, 2.f)); |
1161 grand_child->SetBounds(gfx::Size(2, 2)); | 1161 grand_child->SetBounds(gfx::Size(2, 2)); |
1162 grand_child->SetDrawsContent(true); | 1162 grand_child->SetDrawsContent(true); |
1163 child->AddChild(grand_child.Pass()); | 1163 child->AddChild(std::move(grand_child)); |
1164 } | 1164 } |
1165 EmulateDrawingOneFrame(root.get()); | 1165 EmulateDrawingOneFrame(root.get()); |
1166 | 1166 |
1167 // CASE 1: the update_rect on a mask layer should damage the entire target | 1167 // CASE 1: the update_rect on a mask layer should damage the entire target |
1168 // surface. | 1168 // surface. |
1169 ClearDamageForAllSurfaces(root.get()); | 1169 ClearDamageForAllSurfaces(root.get()); |
1170 mask_layer->SetUpdateRect(gfx::Rect(1, 2, 3, 4)); | 1170 mask_layer->SetUpdateRect(gfx::Rect(1, 2, 3, 4)); |
1171 EmulateDrawingOneFrame(root.get()); | 1171 EmulateDrawingOneFrame(root.get()); |
1172 gfx::Rect child_damage_rect = | 1172 gfx::Rect child_damage_rect = |
1173 child->render_surface()->damage_tracker()->current_damage_rect(); | 1173 child->render_surface()->damage_tracker()->current_damage_rect(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 ClearDamageForAllSurfaces(root.get()); | 1229 ClearDamageForAllSurfaces(root.get()); |
1230 | 1230 |
1231 // Create a reflection about the left edge of grand_child1. | 1231 // Create a reflection about the left edge of grand_child1. |
1232 { | 1232 { |
1233 scoped_ptr<LayerImpl> grand_child1_replica = | 1233 scoped_ptr<LayerImpl> grand_child1_replica = |
1234 LayerImpl::Create(host_impl_.active_tree(), 6); | 1234 LayerImpl::Create(host_impl_.active_tree(), 6); |
1235 grand_child1_replica->SetPosition(gfx::PointF()); | 1235 grand_child1_replica->SetPosition(gfx::PointF()); |
1236 gfx::Transform reflection; | 1236 gfx::Transform reflection; |
1237 reflection.Scale3d(-1.0, 1.0, 1.0); | 1237 reflection.Scale3d(-1.0, 1.0, 1.0); |
1238 grand_child1_replica->SetTransform(reflection); | 1238 grand_child1_replica->SetTransform(reflection); |
1239 grand_child1->SetReplicaLayer(grand_child1_replica.Pass()); | 1239 grand_child1->SetReplicaLayer(std::move(grand_child1_replica)); |
1240 grand_child1->SetHasRenderSurface(true); | 1240 grand_child1->SetHasRenderSurface(true); |
1241 } | 1241 } |
1242 LayerImpl* grand_child1_replica = grand_child1->replica_layer(); | 1242 LayerImpl* grand_child1_replica = grand_child1->replica_layer(); |
1243 | 1243 |
1244 // Set up the mask layer on the replica layer | 1244 // Set up the mask layer on the replica layer |
1245 { | 1245 { |
1246 scoped_ptr<LayerImpl> replica_mask_layer = | 1246 scoped_ptr<LayerImpl> replica_mask_layer = |
1247 LayerImpl::Create(host_impl_.active_tree(), 7); | 1247 LayerImpl::Create(host_impl_.active_tree(), 7); |
1248 replica_mask_layer->SetPosition(gfx::PointF()); | 1248 replica_mask_layer->SetPosition(gfx::PointF()); |
1249 replica_mask_layer->SetBounds(grand_child1->bounds()); | 1249 replica_mask_layer->SetBounds(grand_child1->bounds()); |
1250 grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); | 1250 grand_child1_replica->SetMaskLayer(std::move(replica_mask_layer)); |
1251 } | 1251 } |
1252 LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); | 1252 LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); |
1253 | 1253 |
1254 EmulateDrawingOneFrame(root.get()); | 1254 EmulateDrawingOneFrame(root.get()); |
1255 | 1255 |
1256 // Sanity check that the appropriate render surfaces were created | 1256 // Sanity check that the appropriate render surfaces were created |
1257 ASSERT_TRUE(grand_child1->render_surface()); | 1257 ASSERT_TRUE(grand_child1->render_surface()); |
1258 | 1258 |
1259 // CASE 1: a property change on the mask should damage only the reflected | 1259 // CASE 1: a property change on the mask should damage only the reflected |
1260 // region on the target surface. | 1260 // region on the target surface. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 scoped_ptr<LayerImpl> grand_child1_replica = | 1306 scoped_ptr<LayerImpl> grand_child1_replica = |
1307 LayerImpl::Create(host_impl_.active_tree(), 6); | 1307 LayerImpl::Create(host_impl_.active_tree(), 6); |
1308 grand_child1_replica->SetPosition(gfx::PointF()); | 1308 grand_child1_replica->SetPosition(gfx::PointF()); |
1309 | 1309 |
1310 // This is the anchor being tested. | 1310 // This is the anchor being tested. |
1311 grand_child1_replica->SetTransformOrigin( | 1311 grand_child1_replica->SetTransformOrigin( |
1312 gfx::Point3F(grand_child1->bounds().width(), 0.f, 0.f)); | 1312 gfx::Point3F(grand_child1->bounds().width(), 0.f, 0.f)); |
1313 gfx::Transform reflection; | 1313 gfx::Transform reflection; |
1314 reflection.Scale3d(-1.0, 1.0, 1.0); | 1314 reflection.Scale3d(-1.0, 1.0, 1.0); |
1315 grand_child1_replica->SetTransform(reflection); | 1315 grand_child1_replica->SetTransform(reflection); |
1316 grand_child1->SetReplicaLayer(grand_child1_replica.Pass()); | 1316 grand_child1->SetReplicaLayer(std::move(grand_child1_replica)); |
1317 grand_child1->SetHasRenderSurface(true); | 1317 grand_child1->SetHasRenderSurface(true); |
1318 } | 1318 } |
1319 LayerImpl* grand_child1_replica = grand_child1->replica_layer(); | 1319 LayerImpl* grand_child1_replica = grand_child1->replica_layer(); |
1320 | 1320 |
1321 // Set up the mask layer on the replica layer | 1321 // Set up the mask layer on the replica layer |
1322 { | 1322 { |
1323 scoped_ptr<LayerImpl> replica_mask_layer = | 1323 scoped_ptr<LayerImpl> replica_mask_layer = |
1324 LayerImpl::Create(host_impl_.active_tree(), 7); | 1324 LayerImpl::Create(host_impl_.active_tree(), 7); |
1325 replica_mask_layer->SetPosition(gfx::PointF()); | 1325 replica_mask_layer->SetPosition(gfx::PointF()); |
1326 // Note: this is not the transform origin being tested. | 1326 // Note: this is not the transform origin being tested. |
1327 replica_mask_layer->SetBounds(grand_child1->bounds()); | 1327 replica_mask_layer->SetBounds(grand_child1->bounds()); |
1328 grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); | 1328 grand_child1_replica->SetMaskLayer(std::move(replica_mask_layer)); |
1329 } | 1329 } |
1330 LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); | 1330 LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); |
1331 | 1331 |
1332 EmulateDrawingOneFrame(root.get()); | 1332 EmulateDrawingOneFrame(root.get()); |
1333 | 1333 |
1334 // Sanity check that the appropriate render surfaces were created | 1334 // Sanity check that the appropriate render surfaces were created |
1335 ASSERT_TRUE(grand_child1->render_surface()); | 1335 ASSERT_TRUE(grand_child1->render_surface()); |
1336 | 1336 |
1337 // A property change on the replica_mask should damage the reflected region on | 1337 // A property change on the replica_mask should damage the reflected region on |
1338 // the target surface. | 1338 // the target surface. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 gfx::Rect root_damage_rect = | 1466 gfx::Rect root_damage_rect = |
1467 root->render_surface()->damage_tracker()->current_damage_rect(); | 1467 root->render_surface()->damage_tracker()->current_damage_rect(); |
1468 gfx::Rect damage_we_care_about = gfx::Rect(i, i); | 1468 gfx::Rect damage_we_care_about = gfx::Rect(i, i); |
1469 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); | 1469 EXPECT_LE(damage_we_care_about.right(), root_damage_rect.right()); |
1470 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); | 1470 EXPECT_LE(damage_we_care_about.bottom(), root_damage_rect.bottom()); |
1471 } | 1471 } |
1472 } | 1472 } |
1473 | 1473 |
1474 } // namespace | 1474 } // namespace |
1475 } // namespace cc | 1475 } // namespace cc |
OLD | NEW |