| 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/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
| 10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 // Recursively clear damage for any existing surface. | 50 // Recursively clear damage for any existing surface. |
| 51 for (size_t i = 0; i < layer->children().size(); ++i) | 51 for (size_t i = 0; i < layer->children().size(); ++i) |
| 52 ClearDamageForAllSurfaces(layer->children()[i]); | 52 ClearDamageForAllSurfaces(layer->children()[i]); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void EmulateDrawingOneFrame(LayerImpl* root) { | 55 void EmulateDrawingOneFrame(LayerImpl* root) { |
| 56 // This emulates only steps that are relevant to testing the damage tracker: | 56 // This emulates only steps that are relevant to testing the damage tracker: |
| 57 // 1. computing the render passes and layerlists | 57 // 1. computing the render passes and layerlists |
| 58 // 2. updating all damage trackers in the correct order | 58 // 2. updating all damage trackers in the correct order |
| 59 // 3. resetting all update_rects and propertyChanged flags for all layers | 59 // 3. resetting all update_rects and property_changed flags for all layers |
| 60 // and surfaces. | 60 // and surfaces. |
| 61 | 61 |
| 62 std::vector<LayerImpl*> render_surface_layer_list; | 62 std::vector<LayerImpl*> render_surface_layer_list; |
| 63 ExecuteCalculateDrawProperties(root, render_surface_layer_list); | 63 ExecuteCalculateDrawProperties(root, render_surface_layer_list); |
| 64 | 64 |
| 65 // Iterate back-to-front, so that damage correctly propagates from descendant | 65 // Iterate back-to-front, so that damage correctly propagates from descendant |
| 66 // surfaces to ancestors. | 66 // surfaces to ancestors. |
| 67 for (int i = render_surface_layer_list.size() - 1; i >= 0; --i) { | 67 for (int i = render_surface_layer_list.size() - 1; i >= 0; --i) { |
| 68 RenderSurfaceImpl* target_surface = | 68 RenderSurfaceImpl* target_surface = |
| 69 render_surface_layer_list[i]->render_surface(); | 69 render_surface_layer_list[i]->render_surface(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 root->SetContentBounds(gfx::Size(500, 500)); | 131 root->SetContentBounds(gfx::Size(500, 500)); |
| 132 root->SetDrawsContent(true); | 132 root->SetDrawsContent(true); |
| 133 root->CreateRenderSurface(); | 133 root->CreateRenderSurface(); |
| 134 root->render_surface()->SetContentRect( | 134 root->render_surface()->SetContentRect( |
| 135 gfx::Rect(gfx::Point(), gfx::Size(500, 500))); | 135 gfx::Rect(gfx::Point(), gfx::Size(500, 500))); |
| 136 | 136 |
| 137 child1->SetPosition(gfx::PointF(100.f, 100.f)); | 137 child1->SetPosition(gfx::PointF(100.f, 100.f)); |
| 138 child1->SetAnchorPoint(gfx::PointF()); | 138 child1->SetAnchorPoint(gfx::PointF()); |
| 139 child1->SetBounds(gfx::Size(30, 30)); | 139 child1->SetBounds(gfx::Size(30, 30)); |
| 140 child1->SetContentBounds(gfx::Size(30, 30)); | 140 child1->SetContentBounds(gfx::Size(30, 30)); |
| 141 // With a child that drawsContent, opacity will cause the layer to create | 141 // With a child that draws_content, opacity will cause the layer to create |
| 142 // its own renderSurface. This layer does not draw, but is intended to | 142 // its own RenderSurface. This layer does not draw, but is intended to |
| 143 // create its own renderSurface. TODO: setting opacity and | 143 // create its own RenderSurface. TODO: setting opacity and |
| 144 // forceRenderSurface may be redundant here. | 144 // ForceRenderSurface may be redundant here. |
| 145 child1->SetOpacity(0.5f); | 145 child1->SetOpacity(0.5f); |
| 146 child1->SetDrawsContent(false); | 146 child1->SetDrawsContent(false); |
| 147 child1->SetForceRenderSurface(true); | 147 child1->SetForceRenderSurface(true); |
| 148 | 148 |
| 149 child2->SetPosition(gfx::PointF(11.f, 11.f)); | 149 child2->SetPosition(gfx::PointF(11.f, 11.f)); |
| 150 child2->SetAnchorPoint(gfx::PointF()); | 150 child2->SetAnchorPoint(gfx::PointF()); |
| 151 child2->SetBounds(gfx::Size(18, 18)); | 151 child2->SetBounds(gfx::Size(18, 18)); |
| 152 child2->SetContentBounds(gfx::Size(18, 18)); | 152 child2->SetContentBounds(gfx::Size(18, 18)); |
| 153 child2->SetDrawsContent(true); | 153 child2->SetDrawsContent(true); |
| 154 | 154 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 gfx::RectF child_damage_rect = | 224 gfx::RectF child_damage_rect = |
| 225 child1->render_surface()->damage_tracker()->current_damage_rect(); | 225 child1->render_surface()->damage_tracker()->current_damage_rect(); |
| 226 gfx::RectF root_damage_rect = | 226 gfx::RectF root_damage_rect = |
| 227 root->render_surface()->damage_tracker()->current_damage_rect(); | 227 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 228 | 228 |
| 229 ASSERT_TRUE(child1->render_surface()); | 229 ASSERT_TRUE(child1->render_surface()); |
| 230 EXPECT_FALSE(child2->render_surface()); | 230 EXPECT_FALSE(child2->render_surface()); |
| 231 EXPECT_EQ(3u, root->render_surface()->layer_list().size()); | 231 EXPECT_EQ(3u, root->render_surface()->layer_list().size()); |
| 232 EXPECT_EQ(2u, child1->render_surface()->layer_list().size()); | 232 EXPECT_EQ(2u, child1->render_surface()->layer_list().size()); |
| 233 | 233 |
| 234 // The render surface for child1 only has a contentRect that encloses | 234 // The render surface for child1 only has a content_rect that encloses |
| 235 // grand_child1 and grand_child2, because child1 does not draw content. | 235 // grand_child1 and grand_child2, because child1 does not draw content. |
| 236 EXPECT_FLOAT_RECT_EQ(gfx::RectF(190.f, 190.f, 16.f, 18.f), child_damage_rect); | 236 EXPECT_FLOAT_RECT_EQ(gfx::RectF(190.f, 190.f, 16.f, 18.f), child_damage_rect); |
| 237 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 500.f, 500.f), root_damage_rect); | 237 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 500.f, 500.f), root_damage_rect); |
| 238 } | 238 } |
| 239 | 239 |
| 240 TEST_F(DamageTrackerTest, VerifyDamageForUpdateRects) { | 240 TEST_F(DamageTrackerTest, VerifyDamageForUpdateRects) { |
| 241 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface(); | 241 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithOneSurface(); |
| 242 LayerImpl* child = root->children()[0]; | 242 LayerImpl* child = root->children()[0]; |
| 243 | 243 |
| 244 // CASE 1: Setting the update rect should cause the corresponding damage to | 244 // CASE 1: Setting the update rect should cause the corresponding damage to |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 // update_rect (297, 297), but expanded on the left/top by the blur outsets. | 538 // update_rect (297, 297), but expanded on the left/top by the blur outsets. |
| 539 expected_damage_rect = | 539 expected_damage_rect = |
| 540 gfx::RectF(297.f, 297.f, 30.f, 30.f); | 540 gfx::RectF(297.f, 297.f, 30.f, 30.f); |
| 541 | 541 |
| 542 expected_damage_rect.Inset(-outset_left, | 542 expected_damage_rect.Inset(-outset_left, |
| 543 -outset_top, | 543 -outset_top, |
| 544 0, | 544 0, |
| 545 0); | 545 0); |
| 546 EXPECT_FLOAT_RECT_EQ(expected_damage_rect, root_damage_rect); | 546 EXPECT_FLOAT_RECT_EQ(expected_damage_rect, root_damage_rect); |
| 547 | 547 |
| 548 // CASE 3: Setting this update rect outside the blurred contentBounds of the | 548 // CASE 3: Setting this update rect outside the blurred content_bounds of the |
| 549 // blurred child1 will not cause it to be expanded. | 549 // blurred child1 will not cause it to be expanded. |
| 550 ClearDamageForAllSurfaces(root.get()); | 550 ClearDamageForAllSurfaces(root.get()); |
| 551 root->set_update_rect(gfx::RectF(30.f, 30.f, 2.f, 2.f)); | 551 root->set_update_rect(gfx::RectF(30.f, 30.f, 2.f, 2.f)); |
| 552 EmulateDrawingOneFrame(root.get()); | 552 EmulateDrawingOneFrame(root.get()); |
| 553 | 553 |
| 554 root_damage_rect = | 554 root_damage_rect = |
| 555 root->render_surface()->damage_tracker()->current_damage_rect(); | 555 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 556 // Damage on the root should be: position of update_rect (30, 30), not | 556 // Damage on the root should be: position of update_rect (30, 30), not |
| 557 // expanded. | 557 // expanded. |
| 558 expected_damage_rect = | 558 expected_damage_rect = |
| 559 gfx::RectF(30.f, 30.f, 2.f, 2.f); | 559 gfx::RectF(30.f, 30.f, 2.f, 2.f); |
| 560 | 560 |
| 561 EXPECT_FLOAT_RECT_EQ(expected_damage_rect, root_damage_rect); | 561 EXPECT_FLOAT_RECT_EQ(expected_damage_rect, root_damage_rect); |
| 562 | 562 |
| 563 // CASE 4: Setting this update rect inside the blurred contentBounds but | 563 // CASE 4: Setting this update rect inside the blurred content_bounds but |
| 564 // outside the original contentBounds of the blurred child1 will | 564 // outside the original content_bounds of the blurred child1 will |
| 565 // cause it to be expanded. | 565 // cause it to be expanded. |
| 566 ClearDamageForAllSurfaces(root.get()); | 566 ClearDamageForAllSurfaces(root.get()); |
| 567 root->set_update_rect(gfx::RectF(99.f, 99.f, 1.f, 1.f)); | 567 root->set_update_rect(gfx::RectF(99.f, 99.f, 1.f, 1.f)); |
| 568 EmulateDrawingOneFrame(root.get()); | 568 EmulateDrawingOneFrame(root.get()); |
| 569 | 569 |
| 570 root_damage_rect = | 570 root_damage_rect = |
| 571 root->render_surface()->damage_tracker()->current_damage_rect(); | 571 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 572 // Damage on the root should be: position of update_rect (99, 99), expanded by | 572 // Damage on the root should be: position of update_rect (99, 99), expanded by |
| 573 // the blurring on child1, but since it is 1 pixel outside the layer, the | 573 // the blurring on child1, but since it is 1 pixel outside the layer, the |
| 574 // expanding should be reduced by 1. | 574 // expanding should be reduced by 1. |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 EXPECT_FLOAT_RECT_EQ(gfx::RectF(190.f, 190.f, 11.f, 23.f), child_damage_rect); | 798 EXPECT_FLOAT_RECT_EQ(gfx::RectF(190.f, 190.f, 11.f, 23.f), child_damage_rect); |
| 799 | 799 |
| 800 // Damage to the root surface should be the union of child1's *entire* render | 800 // Damage to the root surface should be the union of child1's *entire* render |
| 801 // surface (in target space), and its old exposed area (also in target | 801 // surface (in target space), and its old exposed area (also in target |
| 802 // space). | 802 // space). |
| 803 EXPECT_FLOAT_RECT_EQ(gfx::RectF(290.f, 290.f, 16.f, 23.f), root_damage_rect); | 803 EXPECT_FLOAT_RECT_EQ(gfx::RectF(290.f, 290.f, 16.f, 23.f), root_damage_rect); |
| 804 } | 804 } |
| 805 | 805 |
| 806 TEST_F(DamageTrackerTest, VerifyDamageForSurfaceChangeFromAncestorLayer) { | 806 TEST_F(DamageTrackerTest, VerifyDamageForSurfaceChangeFromAncestorLayer) { |
| 807 // An ancestor/owning layer changes that affects the position/transform of | 807 // An ancestor/owning layer changes that affects the position/transform of |
| 808 // the render surface. Note that in this case, the layerPropertyChanged flag | 808 // the render surface. Note that in this case, the layer_property_changed flag |
| 809 // already propagates to the subtree (tested in LayerImpltest), which damages | 809 // already propagates to the subtree (tested in LayerImpltest), which damages |
| 810 // the entire child1 surface, but the damage tracker still needs the correct | 810 // the entire child1 surface, but the damage tracker still needs the correct |
| 811 // logic to compute the exposed region on the root surface. | 811 // logic to compute the exposed region on the root surface. |
| 812 | 812 |
| 813 // FIXME: the expectations of this test case should change when we add | 813 // FIXME: the expectations of this test case should change when we add |
| 814 // support for a unique scissorRect per renderSurface. In that case, | 814 // support for a unique scissor_rect per RenderSurface. In that case, |
| 815 // the child1 surface should be completely unchanged, since we are | 815 // the child1 surface should be completely unchanged, since we are |
| 816 // only transforming it, while the root surface would be damaged | 816 // only transforming it, while the root surface would be damaged |
| 817 // appropriately. | 817 // appropriately. |
| 818 | 818 |
| 819 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces(); | 819 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces(); |
| 820 LayerImpl* child1 = root->children()[0]; | 820 LayerImpl* child1 = root->children()[0]; |
| 821 gfx::RectF child_damage_rect; | 821 gfx::RectF child_damage_rect; |
| 822 gfx::RectF root_damage_rect; | 822 gfx::RectF root_damage_rect; |
| 823 | 823 |
| 824 ClearDamageForAllSurfaces(root.get()); | 824 ClearDamageForAllSurfaces(root.get()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces(); | 943 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces(); |
| 944 LayerImpl* child1 = root->children()[0]; | 944 LayerImpl* child1 = root->children()[0]; |
| 945 LayerImpl* grand_child1 = child1->children()[0]; | 945 LayerImpl* grand_child1 = child1->children()[0]; |
| 946 LayerImpl* grand_child2 = child1->children()[1]; | 946 LayerImpl* grand_child2 = child1->children()[1]; |
| 947 | 947 |
| 948 // Damage on a surface that has a reflection should cause the target surface | 948 // Damage on a surface that has a reflection should cause the target surface |
| 949 // to receive the surface's damage and the surface's reflected damage. | 949 // to receive the surface's damage and the surface's reflected damage. |
| 950 | 950 |
| 951 // For this test case, we modify grand_child2, and add grand_child3 to extend | 951 // For this test case, we modify grand_child2, and add grand_child3 to extend |
| 952 // the bounds of child1's surface. This way, we can test reflection changes | 952 // the bounds of child1's surface. This way, we can test reflection changes |
| 953 // without changing contentBounds of the surface. | 953 // without changing content_bounds of the surface. |
| 954 grand_child2->SetPosition(gfx::PointF(180.f, 180.f)); | 954 grand_child2->SetPosition(gfx::PointF(180.f, 180.f)); |
| 955 { | 955 { |
| 956 scoped_ptr<LayerImpl> grand_child3 = | 956 scoped_ptr<LayerImpl> grand_child3 = |
| 957 LayerImpl::Create(host_impl_.active_tree(), 6); | 957 LayerImpl::Create(host_impl_.active_tree(), 6); |
| 958 grand_child3->SetPosition(gfx::PointF(240.f, 240.f)); | 958 grand_child3->SetPosition(gfx::PointF(240.f, 240.f)); |
| 959 grand_child3->SetAnchorPoint(gfx::PointF()); | 959 grand_child3->SetAnchorPoint(gfx::PointF()); |
| 960 grand_child3->SetBounds(gfx::Size(10, 10)); | 960 grand_child3->SetBounds(gfx::Size(10, 10)); |
| 961 grand_child3->SetContentBounds(gfx::Size(10, 10)); | 961 grand_child3->SetContentBounds(gfx::Size(10, 10)); |
| 962 grand_child3->SetDrawsContent(true); | 962 grand_child3->SetDrawsContent(true); |
| 963 child1->AddChild(grand_child3.Pass()); | 963 child1->AddChild(grand_child3.Pass()); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 | 1204 |
| 1205 EXPECT_TRUE(grand_child_damage_rect.IsEmpty()); | 1205 EXPECT_TRUE(grand_child_damage_rect.IsEmpty()); |
| 1206 EXPECT_FLOAT_RECT_EQ(gfx::RectF(194.f, 200.f, 6.f, 8.f), child_damage_rect); | 1206 EXPECT_FLOAT_RECT_EQ(gfx::RectF(194.f, 200.f, 6.f, 8.f), child_damage_rect); |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 TEST_F(DamageTrackerTest, VerifyDamageForReplicaMaskWithAnchor) { | 1209 TEST_F(DamageTrackerTest, VerifyDamageForReplicaMaskWithAnchor) { |
| 1210 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces(); | 1210 scoped_ptr<LayerImpl> root = CreateAndSetUpTestTreeWithTwoSurfaces(); |
| 1211 LayerImpl* child1 = root->children()[0]; | 1211 LayerImpl* child1 = root->children()[0]; |
| 1212 LayerImpl* grand_child1 = child1->children()[0]; | 1212 LayerImpl* grand_child1 = child1->children()[0]; |
| 1213 | 1213 |
| 1214 // Verify that the correct replicaOriginTransform is used for the replicaMask | 1214 // Verify that the correct replica_origin_transform is used for the |
| 1215 // replica_mask. |
| 1215 ClearDamageForAllSurfaces(root.get()); | 1216 ClearDamageForAllSurfaces(root.get()); |
| 1216 | 1217 |
| 1217 // This is not actually the anchor point being tested, but by convention its | 1218 // This is not actually the anchor point being tested, but by convention its |
| 1218 // expected to be the same as the replica's anchor point. | 1219 // expected to be the same as the replica's anchor point. |
| 1219 grand_child1->SetAnchorPoint(gfx::PointF(1.f, 0.f)); | 1220 grand_child1->SetAnchorPoint(gfx::PointF(1.f, 0.f)); |
| 1220 | 1221 |
| 1221 { | 1222 { |
| 1222 scoped_ptr<LayerImpl> grand_child1_replica = | 1223 scoped_ptr<LayerImpl> grand_child1_replica = |
| 1223 LayerImpl::Create(host_impl_.active_tree(), 6); | 1224 LayerImpl::Create(host_impl_.active_tree(), 6); |
| 1224 grand_child1_replica->SetPosition(gfx::PointF()); | 1225 grand_child1_replica->SetPosition(gfx::PointF()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1243 replica_mask_layer->SetContentBounds(grand_child1->bounds()); | 1244 replica_mask_layer->SetContentBounds(grand_child1->bounds()); |
| 1244 grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); | 1245 grand_child1_replica->SetMaskLayer(replica_mask_layer.Pass()); |
| 1245 } | 1246 } |
| 1246 LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); | 1247 LayerImpl* replica_mask_layer = grand_child1_replica->mask_layer(); |
| 1247 | 1248 |
| 1248 EmulateDrawingOneFrame(root.get()); | 1249 EmulateDrawingOneFrame(root.get()); |
| 1249 | 1250 |
| 1250 // Sanity check that the appropriate render surfaces were created | 1251 // Sanity check that the appropriate render surfaces were created |
| 1251 ASSERT_TRUE(grand_child1->render_surface()); | 1252 ASSERT_TRUE(grand_child1->render_surface()); |
| 1252 | 1253 |
| 1253 // A property change on the replicaMask should damage the reflected region on | 1254 // A property change on the replica_mask should damage the reflected region on |
| 1254 // the target surface. | 1255 // the target surface. |
| 1255 ClearDamageForAllSurfaces(root.get()); | 1256 ClearDamageForAllSurfaces(root.get()); |
| 1256 replica_mask_layer->SetStackingOrderChanged(true); | 1257 replica_mask_layer->SetStackingOrderChanged(true); |
| 1257 | 1258 |
| 1258 EmulateDrawingOneFrame(root.get()); | 1259 EmulateDrawingOneFrame(root.get()); |
| 1259 | 1260 |
| 1260 gfx::RectF child_damage_rect = | 1261 gfx::RectF child_damage_rect = |
| 1261 child1->render_surface()->damage_tracker()->current_damage_rect(); | 1262 child1->render_surface()->damage_tracker()->current_damage_rect(); |
| 1262 EXPECT_FLOAT_RECT_EQ(gfx::RectF(206.f, 200.f, 6.f, 8.f), child_damage_rect); | 1263 EXPECT_FLOAT_RECT_EQ(gfx::RectF(206.f, 200.f, 6.f, 8.f), child_damage_rect); |
| 1263 } | 1264 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1283 ClearDamageForAllSurfaces(root.get()); | 1284 ClearDamageForAllSurfaces(root.get()); |
| 1284 root->render_surface()->damage_tracker()->ForceFullDamageNextUpdate(); | 1285 root->render_surface()->damage_tracker()->ForceFullDamageNextUpdate(); |
| 1285 EmulateDrawingOneFrame(root.get()); | 1286 EmulateDrawingOneFrame(root.get()); |
| 1286 root_damage_rect = | 1287 root_damage_rect = |
| 1287 root->render_surface()->damage_tracker()->current_damage_rect(); | 1288 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 1288 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 500.f, 500.f), root_damage_rect); | 1289 EXPECT_FLOAT_RECT_EQ(gfx::RectF(0.f, 0.f, 500.f, 500.f), root_damage_rect); |
| 1289 } | 1290 } |
| 1290 | 1291 |
| 1291 TEST_F(DamageTrackerTest, VerifyDamageForEmptyLayerList) { | 1292 TEST_F(DamageTrackerTest, VerifyDamageForEmptyLayerList) { |
| 1292 // Though it should never happen, its a good idea to verify that the damage | 1293 // Though it should never happen, its a good idea to verify that the damage |
| 1293 // tracker does not crash when it receives an empty layerList. | 1294 // tracker does not crash when it receives an empty layer_list. |
| 1294 | 1295 |
| 1295 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.active_tree(), 1); | 1296 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.active_tree(), 1); |
| 1296 root->CreateRenderSurface(); | 1297 root->CreateRenderSurface(); |
| 1297 | 1298 |
| 1298 ASSERT_TRUE(root == root->render_target()); | 1299 ASSERT_TRUE(root == root->render_target()); |
| 1299 RenderSurfaceImpl* target_surface = root->render_surface(); | 1300 RenderSurfaceImpl* target_surface = root->render_surface(); |
| 1300 target_surface->ClearLayerLists(); | 1301 target_surface->ClearLayerLists(); |
| 1301 target_surface->damage_tracker()->UpdateDamageTrackingState( | 1302 target_surface->damage_tracker()->UpdateDamageTrackingState( |
| 1302 target_surface->layer_list(), | 1303 target_surface->layer_list(), |
| 1303 target_surface->OwningLayerId(), | 1304 target_surface->OwningLayerId(), |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 // Damage should remain empty even after one frame, since there's yet no new | 1346 // Damage should remain empty even after one frame, since there's yet no new |
| 1346 // damage. | 1347 // damage. |
| 1347 EmulateDrawingOneFrame(root.get()); | 1348 EmulateDrawingOneFrame(root.get()); |
| 1348 root_damage_rect = | 1349 root_damage_rect = |
| 1349 root->render_surface()->damage_tracker()->current_damage_rect(); | 1350 root->render_surface()->damage_tracker()->current_damage_rect(); |
| 1350 EXPECT_TRUE(root_damage_rect.IsEmpty()); | 1351 EXPECT_TRUE(root_damage_rect.IsEmpty()); |
| 1351 } | 1352 } |
| 1352 | 1353 |
| 1353 } // namespace | 1354 } // namespace |
| 1354 } // namespace cc | 1355 } // namespace cc |
| OLD | NEW |