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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/damage_tracker.h" | 7 #include "cc/damage_tracker.h" |
8 | 8 |
9 #include "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
10 #include "cc/layer_sorter.h" | 10 #include "cc/layer_sorter.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 scoped_ptr<LayerImpl> createTestTreeWithOneSurface() | 69 scoped_ptr<LayerImpl> createTestTreeWithOneSurface() |
70 { | 70 { |
71 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 71 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
72 scoped_ptr<LayerImpl> child = LayerImpl::create(2); | 72 scoped_ptr<LayerImpl> child = LayerImpl::create(2); |
73 | 73 |
74 root->setPosition(FloatPoint::zero()); | 74 root->setPosition(FloatPoint::zero()); |
75 root->setAnchorPoint(FloatPoint::zero()); | 75 root->setAnchorPoint(FloatPoint::zero()); |
76 root->setBounds(IntSize(500, 500)); | 76 root->setBounds(IntSize(500, 500)); |
77 root->setContentBounds(IntSize(500, 500)); | |
78 root->setDrawsContent(true); | 77 root->setDrawsContent(true); |
79 root->createRenderSurface(); | 78 root->createRenderSurface(); |
80 root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))
); | 79 root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))
); |
81 | 80 |
82 child->setPosition(FloatPoint(100, 100)); | 81 child->setPosition(FloatPoint(100, 100)); |
83 child->setAnchorPoint(FloatPoint::zero()); | 82 child->setAnchorPoint(FloatPoint::zero()); |
84 child->setBounds(IntSize(30, 30)); | 83 child->setBounds(IntSize(30, 30)); |
85 child->setContentBounds(IntSize(30, 30)); | |
86 child->setDrawsContent(true); | 84 child->setDrawsContent(true); |
87 root->addChild(child.Pass()); | 85 root->addChild(child.Pass()); |
88 | 86 |
89 return root.Pass(); | 87 return root.Pass(); |
90 } | 88 } |
91 | 89 |
92 scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces() | 90 scoped_ptr<LayerImpl> createTestTreeWithTwoSurfaces() |
93 { | 91 { |
94 // This test tree has two render surfaces: one for the root, and one for | 92 // This test tree has two render surfaces: one for the root, and one for |
95 // child1. Additionally, the root has a second child layer, and child1 has t
wo | 93 // child1. Additionally, the root has a second child layer, and child1 has t
wo |
96 // children of its own. | 94 // children of its own. |
97 | 95 |
98 scoped_ptr<LayerImpl> root = LayerImpl::create(1); | 96 scoped_ptr<LayerImpl> root = LayerImpl::create(1); |
99 scoped_ptr<LayerImpl> child1 = LayerImpl::create(2); | 97 scoped_ptr<LayerImpl> child1 = LayerImpl::create(2); |
100 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); | 98 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); |
101 scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4); | 99 scoped_ptr<LayerImpl> grandChild1 = LayerImpl::create(4); |
102 scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(5); | 100 scoped_ptr<LayerImpl> grandChild2 = LayerImpl::create(5); |
103 | 101 |
104 root->setPosition(FloatPoint::zero()); | 102 root->setPosition(FloatPoint::zero()); |
105 root->setAnchorPoint(FloatPoint::zero()); | 103 root->setAnchorPoint(FloatPoint::zero()); |
106 root->setBounds(IntSize(500, 500)); | 104 root->setBounds(IntSize(500, 500)); |
107 root->setContentBounds(IntSize(500, 500)); | |
108 root->setDrawsContent(true); | 105 root->setDrawsContent(true); |
109 root->createRenderSurface(); | 106 root->createRenderSurface(); |
110 root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))
); | 107 root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(500, 500))
); |
111 | 108 |
112 child1->setPosition(FloatPoint(100, 100)); | 109 child1->setPosition(FloatPoint(100, 100)); |
113 child1->setAnchorPoint(FloatPoint::zero()); | 110 child1->setAnchorPoint(FloatPoint::zero()); |
114 child1->setBounds(IntSize(30, 30)); | 111 child1->setBounds(IntSize(30, 30)); |
115 child1->setContentBounds(IntSize(30, 30)); | |
116 child1->setOpacity(0.5); // with a child that drawsContent, this will cause
the layer to create its own renderSurface. | 112 child1->setOpacity(0.5); // with a child that drawsContent, this will cause
the layer to create its own renderSurface. |
117 child1->setDrawsContent(false); // this layer does not draw, but is intended
to create its own renderSurface. | 113 child1->setDrawsContent(false); // this layer does not draw, but is intended
to create its own renderSurface. |
118 | 114 |
119 child2->setPosition(FloatPoint(11, 11)); | 115 child2->setPosition(FloatPoint(11, 11)); |
120 child2->setAnchorPoint(FloatPoint::zero()); | 116 child2->setAnchorPoint(FloatPoint::zero()); |
121 child2->setBounds(IntSize(18, 18)); | 117 child2->setBounds(IntSize(18, 18)); |
122 child2->setContentBounds(IntSize(18, 18)); | |
123 child2->setDrawsContent(true); | 118 child2->setDrawsContent(true); |
124 | 119 |
125 grandChild1->setPosition(FloatPoint(200, 200)); | 120 grandChild1->setPosition(FloatPoint(200, 200)); |
126 grandChild1->setAnchorPoint(FloatPoint::zero()); | 121 grandChild1->setAnchorPoint(FloatPoint::zero()); |
127 grandChild1->setBounds(IntSize(6, 8)); | 122 grandChild1->setBounds(IntSize(6, 8)); |
128 grandChild1->setContentBounds(IntSize(6, 8)); | |
129 grandChild1->setDrawsContent(true); | 123 grandChild1->setDrawsContent(true); |
130 | 124 |
131 grandChild2->setPosition(FloatPoint(190, 190)); | 125 grandChild2->setPosition(FloatPoint(190, 190)); |
132 grandChild2->setAnchorPoint(FloatPoint::zero()); | 126 grandChild2->setAnchorPoint(FloatPoint::zero()); |
133 grandChild2->setBounds(IntSize(6, 8)); | 127 grandChild2->setBounds(IntSize(6, 8)); |
134 grandChild2->setContentBounds(IntSize(6, 8)); | |
135 grandChild2->setDrawsContent(true); | 128 grandChild2->setDrawsContent(true); |
136 | 129 |
137 child1->addChild(grandChild1.Pass()); | 130 child1->addChild(grandChild1.Pass()); |
138 child1->addChild(grandChild2.Pass()); | 131 child1->addChild(grandChild2.Pass()); |
139 root->addChild(child1.Pass()); | 132 root->addChild(child1.Pass()); |
140 root->addChild(child2.Pass()); | 133 root->addChild(child2.Pass()); |
141 | 134 |
142 return root.Pass(); | 135 return root.Pass(); |
143 } | 136 } |
144 | 137 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 328 |
336 WebTransformationMatrix transform; | 329 WebTransformationMatrix transform; |
337 transform.translate3d(500, 500, 0); | 330 transform.translate3d(500, 500, 0); |
338 transform.applyPerspective(1); | 331 transform.applyPerspective(1); |
339 transform.rotate3d(0, 45, 0); | 332 transform.rotate3d(0, 45, 0); |
340 transform.translate3d(-50, -50, 0); | 333 transform.translate3d(-50, -50, 0); |
341 | 334 |
342 // Set up the child | 335 // Set up the child |
343 child->setPosition(FloatPoint(0, 0)); | 336 child->setPosition(FloatPoint(0, 0)); |
344 child->setBounds(IntSize(100, 100)); | 337 child->setBounds(IntSize(100, 100)); |
345 child->setContentBounds(IntSize(100, 100)); | |
346 child->setTransform(transform); | 338 child->setTransform(transform); |
347 emulateDrawingOneFrame(root.get()); | 339 emulateDrawingOneFrame(root.get()); |
348 | 340 |
349 // Sanity check that the child layer's bounds would actually get clipped by
w < 0, | 341 // Sanity check that the child layer's bounds would actually get clipped by
w < 0, |
350 // otherwise this test is not actually testing the intended scenario. | 342 // otherwise this test is not actually testing the intended scenario. |
351 FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100))); | 343 FloatQuad testQuad(FloatRect(FloatPoint::zero(), FloatSize(100, 100))); |
352 bool clipped = false; | 344 bool clipped = false; |
353 MathUtil::mapQuad(transform, testQuad, clipped); | 345 MathUtil::mapQuad(transform, testQuad, clipped); |
354 EXPECT_TRUE(clipped); | 346 EXPECT_TRUE(clipped); |
355 | 347 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 LayerImpl* child1 = root->children()[0]; | 525 LayerImpl* child1 = root->children()[0]; |
534 | 526 |
535 // CASE 1: Adding a new layer should cause the appropriate damage. | 527 // CASE 1: Adding a new layer should cause the appropriate damage. |
536 // | 528 // |
537 clearDamageForAllSurfaces(root.get()); | 529 clearDamageForAllSurfaces(root.get()); |
538 { | 530 { |
539 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); | 531 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); |
540 child2->setPosition(FloatPoint(400, 380)); | 532 child2->setPosition(FloatPoint(400, 380)); |
541 child2->setAnchorPoint(FloatPoint::zero()); | 533 child2->setAnchorPoint(FloatPoint::zero()); |
542 child2->setBounds(IntSize(6, 8)); | 534 child2->setBounds(IntSize(6, 8)); |
543 child2->setContentBounds(IntSize(6, 8)); | |
544 child2->setDrawsContent(true); | 535 child2->setDrawsContent(true); |
545 root->addChild(child2.Pass()); | 536 root->addChild(child2.Pass()); |
546 } | 537 } |
547 emulateDrawingOneFrame(root.get()); | 538 emulateDrawingOneFrame(root.get()); |
548 | 539 |
549 // Sanity check - all 3 layers should be on the same render surface; render
surfaces are tested elsewhere. | 540 // Sanity check - all 3 layers should be on the same render surface; render
surfaces are tested elsewhere. |
550 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); | 541 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); |
551 | 542 |
552 FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDa
mageRect(); | 543 FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDa
mageRect(); |
553 EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect); | 544 EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect); |
(...skipping 19 matching lines...) Expand all Loading... |
573 // its own, it should still indeed damage the target surface. | 564 // its own, it should still indeed damage the target surface. |
574 | 565 |
575 scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); | 566 scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); |
576 | 567 |
577 clearDamageForAllSurfaces(root.get()); | 568 clearDamageForAllSurfaces(root.get()); |
578 { | 569 { |
579 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); | 570 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); |
580 child2->setPosition(FloatPoint(400, 380)); | 571 child2->setPosition(FloatPoint(400, 380)); |
581 child2->setAnchorPoint(FloatPoint::zero()); | 572 child2->setAnchorPoint(FloatPoint::zero()); |
582 child2->setBounds(IntSize(6, 8)); | 573 child2->setBounds(IntSize(6, 8)); |
583 child2->setContentBounds(IntSize(6, 8)); | |
584 child2->setDrawsContent(true); | 574 child2->setDrawsContent(true); |
585 child2->resetAllChangeTrackingForSubtree(); | 575 child2->resetAllChangeTrackingForSubtree(); |
586 // Sanity check the initial conditions of the test, if these asserts tri
gger, it | 576 // Sanity check the initial conditions of the test, if these asserts tri
gger, it |
587 // means the test no longer actually covers the intended scenario. | 577 // means the test no longer actually covers the intended scenario. |
588 ASSERT_FALSE(child2->layerPropertyChanged()); | 578 ASSERT_FALSE(child2->layerPropertyChanged()); |
589 ASSERT_TRUE(child2->updateRect().isEmpty()); | 579 ASSERT_TRUE(child2->updateRect().isEmpty()); |
590 root->addChild(child2.Pass()); | 580 root->addChild(child2.Pass()); |
591 } | 581 } |
592 emulateDrawingOneFrame(root.get()); | 582 emulateDrawingOneFrame(root.get()); |
593 | 583 |
594 // Sanity check - all 3 layers should be on the same render surface; render
surfaces are tested elsewhere. | 584 // Sanity check - all 3 layers should be on the same render surface; render
surfaces are tested elsewhere. |
595 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); | 585 ASSERT_EQ(3u, root->renderSurface()->layerList().size()); |
596 | 586 |
597 FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDa
mageRect(); | 587 FloatRect rootDamageRect = root->renderSurface()->damageTracker()->currentDa
mageRect(); |
598 EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect); | 588 EXPECT_FLOAT_RECT_EQ(FloatRect(400, 380, 6, 8), rootDamageRect); |
599 } | 589 } |
600 | 590 |
601 TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers) | 591 TEST_F(DamageTrackerTest, verifyDamageForMultipleLayers) |
602 { | 592 { |
603 scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); | 593 scoped_ptr<LayerImpl> root = createAndSetUpTestTreeWithOneSurface(); |
604 LayerImpl* child1 = root->children()[0]; | 594 LayerImpl* child1 = root->children()[0]; |
605 | 595 |
606 // In this test we don't want the above tree manipulation to be considered p
art of the same frame. | 596 // In this test we don't want the above tree manipulation to be considered p
art of the same frame. |
607 clearDamageForAllSurfaces(root.get()); | 597 clearDamageForAllSurfaces(root.get()); |
608 { | 598 { |
609 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); | 599 scoped_ptr<LayerImpl> child2 = LayerImpl::create(3); |
610 child2->setPosition(FloatPoint(400, 380)); | 600 child2->setPosition(FloatPoint(400, 380)); |
611 child2->setAnchorPoint(FloatPoint::zero()); | 601 child2->setAnchorPoint(FloatPoint::zero()); |
612 child2->setBounds(IntSize(6, 8)); | 602 child2->setBounds(IntSize(6, 8)); |
613 child2->setContentBounds(IntSize(6, 8)); | |
614 child2->setDrawsContent(true); | 603 child2->setDrawsContent(true); |
615 root->addChild(child2.Pass()); | 604 root->addChild(child2.Pass()); |
616 } | 605 } |
617 LayerImpl* child2 = root->children()[1]; | 606 LayerImpl* child2 = root->children()[1]; |
618 emulateDrawingOneFrame(root.get()); | 607 emulateDrawingOneFrame(root.get()); |
619 | 608 |
620 // Damaging two layers simultaneously should cause combined damage. | 609 // Damaging two layers simultaneously should cause combined damage. |
621 // - child1 update rect in surface space: FloatRect(100, 100, 1, 2); | 610 // - child1 update rect in surface space: FloatRect(100, 100, 1, 2); |
622 // - child2 update rect in surface space: FloatRect(400, 380, 3, 4); | 611 // - child2 update rect in surface space: FloatRect(400, 380, 3, 4); |
623 clearDamageForAllSurfaces(root.get()); | 612 clearDamageForAllSurfaces(root.get()); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
822 | 811 |
823 // For this test case, we modify grandChild2, and add grandChild3 to extend
the bounds | 812 // For this test case, we modify grandChild2, and add grandChild3 to extend
the bounds |
824 // of child1's surface. This way, we can test reflection changes without cha
nging | 813 // of child1's surface. This way, we can test reflection changes without cha
nging |
825 // contentBounds of the surface. | 814 // contentBounds of the surface. |
826 grandChild2->setPosition(FloatPoint(180, 180)); | 815 grandChild2->setPosition(FloatPoint(180, 180)); |
827 { | 816 { |
828 scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(6); | 817 scoped_ptr<LayerImpl> grandChild3 = LayerImpl::create(6); |
829 grandChild3->setPosition(FloatPoint(240, 240)); | 818 grandChild3->setPosition(FloatPoint(240, 240)); |
830 grandChild3->setAnchorPoint(FloatPoint::zero()); | 819 grandChild3->setAnchorPoint(FloatPoint::zero()); |
831 grandChild3->setBounds(IntSize(10, 10)); | 820 grandChild3->setBounds(IntSize(10, 10)); |
832 grandChild3->setContentBounds(IntSize(10, 10)); | |
833 grandChild3->setDrawsContent(true); | 821 grandChild3->setDrawsContent(true); |
834 child1->addChild(grandChild3.Pass()); | 822 child1->addChild(grandChild3.Pass()); |
835 } | 823 } |
836 child1->setOpacity(0.5); | 824 child1->setOpacity(0.5); |
837 emulateDrawingOneFrame(root.get()); | 825 emulateDrawingOneFrame(root.get()); |
838 | 826 |
839 // CASE 1: adding a reflection about the left edge of grandChild1. | 827 // CASE 1: adding a reflection about the left edge of grandChild1. |
840 // | 828 // |
841 clearDamageForAllSurfaces(root.get()); | 829 clearDamageForAllSurfaces(root.get()); |
842 { | 830 { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 // damage the entire corresponding surface. | 893 // damage the entire corresponding surface. |
906 | 894 |
907 clearDamageForAllSurfaces(root.get()); | 895 clearDamageForAllSurfaces(root.get()); |
908 | 896 |
909 // Set up the mask layer. | 897 // Set up the mask layer. |
910 { | 898 { |
911 scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(3); | 899 scoped_ptr<LayerImpl> maskLayer = LayerImpl::create(3); |
912 maskLayer->setPosition(child->position()); | 900 maskLayer->setPosition(child->position()); |
913 maskLayer->setAnchorPoint(FloatPoint::zero()); | 901 maskLayer->setAnchorPoint(FloatPoint::zero()); |
914 maskLayer->setBounds(child->bounds()); | 902 maskLayer->setBounds(child->bounds()); |
915 maskLayer->setContentBounds(child->bounds()); | |
916 child->setMaskLayer(maskLayer.Pass()); | 903 child->setMaskLayer(maskLayer.Pass()); |
917 } | 904 } |
918 LayerImpl* maskLayer = child->maskLayer(); | 905 LayerImpl* maskLayer = child->maskLayer(); |
919 | 906 |
920 // Add opacity and a grandChild so that the render surface persists even aft
er we remove the mask. | 907 // Add opacity and a grandChild so that the render surface persists even aft
er we remove the mask. |
921 child->setOpacity(0.5); | 908 child->setOpacity(0.5); |
922 { | 909 { |
923 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(4); | 910 scoped_ptr<LayerImpl> grandChild = LayerImpl::create(4); |
924 grandChild->setPosition(FloatPoint(2, 2)); | 911 grandChild->setPosition(FloatPoint(2, 2)); |
925 grandChild->setAnchorPoint(FloatPoint::zero()); | 912 grandChild->setAnchorPoint(FloatPoint::zero()); |
926 grandChild->setBounds(IntSize(2, 2)); | 913 grandChild->setBounds(IntSize(2, 2)); |
927 grandChild->setContentBounds(IntSize(2, 2)); | |
928 grandChild->setDrawsContent(true); | 914 grandChild->setDrawsContent(true); |
929 child->addChild(grandChild.Pass()); | 915 child->addChild(grandChild.Pass()); |
930 } | 916 } |
931 emulateDrawingOneFrame(root.get()); | 917 emulateDrawingOneFrame(root.get()); |
932 | 918 |
933 // Sanity check that a new surface was created for the child. | 919 // Sanity check that a new surface was created for the child. |
934 ASSERT_TRUE(child->renderSurface()); | 920 ASSERT_TRUE(child->renderSurface()); |
935 | 921 |
936 // CASE 1: the updateRect on a mask layer should damage the entire target su
rface. | 922 // CASE 1: the updateRect on a mask layer should damage the entire target su
rface. |
937 // | 923 // |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 grandChild1->setReplicaLayer(grandChild1Replica.Pass()); | 988 grandChild1->setReplicaLayer(grandChild1Replica.Pass()); |
1003 } | 989 } |
1004 LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); | 990 LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); |
1005 | 991 |
1006 // Set up the mask layer on the replica layer | 992 // Set up the mask layer on the replica layer |
1007 { | 993 { |
1008 scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); | 994 scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); |
1009 replicaMaskLayer->setPosition(FloatPoint::zero()); | 995 replicaMaskLayer->setPosition(FloatPoint::zero()); |
1010 replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); | 996 replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); |
1011 replicaMaskLayer->setBounds(grandChild1->bounds()); | 997 replicaMaskLayer->setBounds(grandChild1->bounds()); |
1012 replicaMaskLayer->setContentBounds(grandChild1->bounds()); | |
1013 grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); | 998 grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); |
1014 } | 999 } |
1015 LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); | 1000 LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); |
1016 | 1001 |
1017 emulateDrawingOneFrame(root.get()); | 1002 emulateDrawingOneFrame(root.get()); |
1018 | 1003 |
1019 // Sanity check that the appropriate render surfaces were created | 1004 // Sanity check that the appropriate render surfaces were created |
1020 ASSERT_TRUE(grandChild1->renderSurface()); | 1005 ASSERT_TRUE(grandChild1->renderSurface()); |
1021 | 1006 |
1022 // CASE 1: a property change on the mask should damage only the reflected re
gion on the target surface. | 1007 // CASE 1: a property change on the mask should damage only the reflected re
gion on the target surface. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1064 grandChild1->setReplicaLayer(grandChild1Replica.Pass()); | 1049 grandChild1->setReplicaLayer(grandChild1Replica.Pass()); |
1065 } | 1050 } |
1066 LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); | 1051 LayerImpl* grandChild1Replica = grandChild1->replicaLayer(); |
1067 | 1052 |
1068 // Set up the mask layer on the replica layer | 1053 // Set up the mask layer on the replica layer |
1069 { | 1054 { |
1070 scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); | 1055 scoped_ptr<LayerImpl> replicaMaskLayer = LayerImpl::create(7); |
1071 replicaMaskLayer->setPosition(FloatPoint::zero()); | 1056 replicaMaskLayer->setPosition(FloatPoint::zero()); |
1072 replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is n
ot the anchor being tested. | 1057 replicaMaskLayer->setAnchorPoint(FloatPoint::zero()); // note, this is n
ot the anchor being tested. |
1073 replicaMaskLayer->setBounds(grandChild1->bounds()); | 1058 replicaMaskLayer->setBounds(grandChild1->bounds()); |
1074 replicaMaskLayer->setContentBounds(grandChild1->bounds()); | |
1075 grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); | 1059 grandChild1Replica->setMaskLayer(replicaMaskLayer.Pass()); |
1076 } | 1060 } |
1077 LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); | 1061 LayerImpl* replicaMaskLayer = grandChild1Replica->maskLayer(); |
1078 | 1062 |
1079 emulateDrawingOneFrame(root.get()); | 1063 emulateDrawingOneFrame(root.get()); |
1080 | 1064 |
1081 // Sanity check that the appropriate render surfaces were created | 1065 // Sanity check that the appropriate render surfaces were created |
1082 ASSERT_TRUE(grandChild1->renderSurface()); | 1066 ASSERT_TRUE(grandChild1->renderSurface()); |
1083 | 1067 |
1084 // A property change on the replicaMask should damage the reflected region o
n the target surface. | 1068 // A property change on the replicaMask should damage the reflected region o
n the target surface. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect()
; | 1143 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect()
; |
1160 EXPECT_TRUE(rootDamageRect.isEmpty()); | 1144 EXPECT_TRUE(rootDamageRect.isEmpty()); |
1161 | 1145 |
1162 // Damage should remain empty even after one frame, since there's yet no new
damage | 1146 // Damage should remain empty even after one frame, since there's yet no new
damage |
1163 emulateDrawingOneFrame(root.get()); | 1147 emulateDrawingOneFrame(root.get()); |
1164 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect()
; | 1148 rootDamageRect = root->renderSurface()->damageTracker()->currentDamageRect()
; |
1165 EXPECT_TRUE(rootDamageRect.isEmpty()); | 1149 EXPECT_TRUE(rootDamageRect.isEmpty()); |
1166 } | 1150 } |
1167 | 1151 |
1168 } // namespace | 1152 } // namespace |
OLD | NEW |