OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "cc/animation/layer_animation_controller.h" | 9 #include "cc/animation/layer_animation_controller.h" |
10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const gfx::Size& bounds) { | 101 const gfx::Size& bounds) { |
102 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 102 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
103 int id = next_layer_impl_id_++; | 103 int id = next_layer_impl_id_++; |
104 std::unique_ptr<TestContentLayerImpl> layer( | 104 std::unique_ptr<TestContentLayerImpl> layer( |
105 new TestContentLayerImpl(tree, id)); | 105 new TestContentLayerImpl(tree, id)); |
106 TestContentLayerImpl* layer_ptr = layer.get(); | 106 TestContentLayerImpl* layer_ptr = layer.get(); |
107 SetProperties(layer_ptr, transform, position, bounds); | 107 SetProperties(layer_ptr, transform, position, bounds); |
108 | 108 |
109 host_->host_impl()->active_tree()->SetRootLayer(std::move(layer)); | 109 host_->host_impl()->active_tree()->SetRootLayer(std::move(layer)); |
110 | 110 |
111 layer_ptr->SetForceRenderSurface(true); | 111 layer_ptr->test_properties()->force_render_surface = true; |
112 SetRootLayerOnMainThread(layer_ptr); | 112 SetRootLayerOnMainThread(layer_ptr); |
113 | 113 |
114 return layer_ptr; | 114 return layer_ptr; |
115 } | 115 } |
116 | 116 |
117 LayerImpl* CreateLayer(LayerImpl* parent, | 117 LayerImpl* CreateLayer(LayerImpl* parent, |
118 const gfx::Transform& transform, | 118 const gfx::Transform& transform, |
119 const gfx::PointF& position, | 119 const gfx::PointF& position, |
120 const gfx::Size& bounds) { | 120 const gfx::Size& bounds) { |
121 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 121 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
122 int id = next_layer_impl_id_++; | 122 int id = next_layer_impl_id_++; |
123 std::unique_ptr<LayerImpl> layer = LayerImpl::Create(tree, id); | 123 std::unique_ptr<LayerImpl> layer = LayerImpl::Create(tree, id); |
124 LayerImpl* layer_ptr = layer.get(); | 124 LayerImpl* layer_ptr = layer.get(); |
125 SetProperties(layer_ptr, transform, position, bounds); | 125 SetProperties(layer_ptr, transform, position, bounds); |
126 parent->AddChild(std::move(layer)); | 126 parent->AddChild(std::move(layer)); |
127 return layer_ptr; | 127 return layer_ptr; |
128 } | 128 } |
129 | 129 |
130 LayerImpl* CreateSurface(LayerImpl* parent, | 130 LayerImpl* CreateSurface(LayerImpl* parent, |
131 const gfx::Transform& transform, | 131 const gfx::Transform& transform, |
132 const gfx::PointF& position, | 132 const gfx::PointF& position, |
133 const gfx::Size& bounds) { | 133 const gfx::Size& bounds) { |
134 LayerImpl* layer = CreateLayer(parent, transform, position, bounds); | 134 LayerImpl* layer = CreateLayer(parent, transform, position, bounds); |
135 layer->SetForceRenderSurface(true); | 135 layer->test_properties()->force_render_surface = true; |
136 return layer; | 136 return layer; |
137 } | 137 } |
138 | 138 |
139 TestContentLayerImpl* CreateDrawingLayer(LayerImpl* parent, | 139 TestContentLayerImpl* CreateDrawingLayer(LayerImpl* parent, |
140 const gfx::Transform& transform, | 140 const gfx::Transform& transform, |
141 const gfx::PointF& position, | 141 const gfx::PointF& position, |
142 const gfx::Size& bounds, | 142 const gfx::Size& bounds, |
143 bool opaque) { | 143 bool opaque) { |
144 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 144 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
145 int id = next_layer_impl_id_++; | 145 int id = next_layer_impl_id_++; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 return layer_ptr; | 187 return layer_ptr; |
188 } | 188 } |
189 | 189 |
190 TestContentLayerImpl* CreateDrawingSurface(LayerImpl* parent, | 190 TestContentLayerImpl* CreateDrawingSurface(LayerImpl* parent, |
191 const gfx::Transform& transform, | 191 const gfx::Transform& transform, |
192 const gfx::PointF& position, | 192 const gfx::PointF& position, |
193 const gfx::Size& bounds, | 193 const gfx::Size& bounds, |
194 bool opaque) { | 194 bool opaque) { |
195 TestContentLayerImpl* layer = | 195 TestContentLayerImpl* layer = |
196 CreateDrawingLayer(parent, transform, position, bounds, opaque); | 196 CreateDrawingLayer(parent, transform, position, bounds, opaque); |
197 layer->SetForceRenderSurface(true); | 197 layer->test_properties()->force_render_surface = true; |
198 return layer; | 198 return layer; |
199 } | 199 } |
200 | 200 |
201 void DestroyLayers() { | 201 void DestroyLayers() { |
202 host_->host_impl()->active_tree()->SetRootLayer(nullptr); | 202 host_->host_impl()->active_tree()->SetRootLayer(nullptr); |
203 render_surface_layer_list_impl_.clear(); | 203 render_surface_layer_list_impl_.clear(); |
204 replica_layers_.clear(); | 204 replica_layers_.clear(); |
205 mask_layers_.clear(); | 205 mask_layers_.clear(); |
206 ResetLayerIterator(); | 206 ResetLayerIterator(); |
207 } | 207 } |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 : OcclusionTrackerTest(opaque_layers) {} | 534 : OcclusionTrackerTest(opaque_layers) {} |
535 | 535 |
536 void RunMyTest() override { | 536 void RunMyTest() override { |
537 TestContentLayerImpl* parent = this->CreateRoot( | 537 TestContentLayerImpl* parent = this->CreateRoot( |
538 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); | 538 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); |
539 | 539 |
540 gfx::Transform layer1_matrix; | 540 gfx::Transform layer1_matrix; |
541 layer1_matrix.Scale(2.0, 2.0); | 541 layer1_matrix.Scale(2.0, 2.0); |
542 TestContentLayerImpl* layer1 = this->CreateDrawingLayer( | 542 TestContentLayerImpl* layer1 = this->CreateDrawingLayer( |
543 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 543 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
544 layer1->SetForceRenderSurface(true); | 544 layer1->test_properties()->force_render_surface = true; |
545 | 545 |
546 gfx::Transform layer2_matrix; | 546 gfx::Transform layer2_matrix; |
547 layer2_matrix.Translate(25.0, 25.0); | 547 layer2_matrix.Translate(25.0, 25.0); |
548 TestContentLayerImpl* layer2 = this->CreateDrawingLayer( | 548 TestContentLayerImpl* layer2 = this->CreateDrawingLayer( |
549 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); | 549 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); |
550 TestContentLayerImpl* occluder = this->CreateDrawingLayer( | 550 TestContentLayerImpl* occluder = this->CreateDrawingLayer( |
551 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), | 551 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), |
552 gfx::Size(500, 500), true); | 552 gfx::Size(500, 500), true); |
553 this->CalcDrawEtc(parent); | 553 this->CalcDrawEtc(parent); |
554 | 554 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 TestContentLayerImpl* blur_layer = this->CreateDrawingLayer( | 915 TestContentLayerImpl* blur_layer = this->CreateDrawingLayer( |
916 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), | 916 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), |
917 true); | 917 true); |
918 TestContentLayerImpl* opaque_layer = this->CreateDrawingLayer( | 918 TestContentLayerImpl* opaque_layer = this->CreateDrawingLayer( |
919 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), | 919 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), |
920 true); | 920 true); |
921 TestContentLayerImpl* opacity_layer = this->CreateDrawingLayer( | 921 TestContentLayerImpl* opacity_layer = this->CreateDrawingLayer( |
922 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), | 922 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), |
923 true); | 923 true); |
924 | 924 |
925 blur_layer->SetForceRenderSurface(true); | 925 blur_layer->test_properties()->force_render_surface = true; |
926 FilterOperations filters; | 926 FilterOperations filters; |
927 filters.Append(FilterOperation::CreateBlurFilter(10.f)); | 927 filters.Append(FilterOperation::CreateBlurFilter(10.f)); |
928 blur_layer->SetFilters(filters); | 928 blur_layer->SetFilters(filters); |
929 | 929 |
930 opaque_layer->SetForceRenderSurface(true); | 930 opaque_layer->test_properties()->force_render_surface = true; |
931 filters.Clear(); | 931 filters.Clear(); |
932 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); | 932 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); |
933 opaque_layer->SetFilters(filters); | 933 opaque_layer->SetFilters(filters); |
934 | 934 |
935 opacity_layer->SetForceRenderSurface(true); | 935 opacity_layer->test_properties()->force_render_surface = true; |
936 filters.Clear(); | 936 filters.Clear(); |
937 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); | 937 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
938 opacity_layer->SetFilters(filters); | 938 opacity_layer->SetFilters(filters); |
939 | 939 |
940 this->CalcDrawEtc(parent); | 940 this->CalcDrawEtc(parent); |
941 | 941 |
942 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 942 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
943 | 943 |
944 // Opacity layer won't contribute to occlusion. | 944 // Opacity layer won't contribute to occlusion. |
945 this->VisitLayer(opacity_layer, &occlusion); | 945 this->VisitLayer(opacity_layer, &occlusion); |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 occlusion_rect = gfx::Rect(0, 0, 200, 50); | 1477 occlusion_rect = gfx::Rect(0, 0, 200, 50); |
1478 break; | 1478 break; |
1479 case BOTTOM: | 1479 case BOTTOM: |
1480 occlusion_rect = gfx::Rect(0, 100, 200, 50); | 1480 occlusion_rect = gfx::Rect(0, 100, 200, 50); |
1481 break; | 1481 break; |
1482 } | 1482 } |
1483 | 1483 |
1484 LayerImpl* occluding_layer = this->CreateDrawingLayer( | 1484 LayerImpl* occluding_layer = this->CreateDrawingLayer( |
1485 parent, this->identity_matrix, gfx::PointF(occlusion_rect.origin()), | 1485 parent, this->identity_matrix, gfx::PointF(occlusion_rect.origin()), |
1486 occlusion_rect.size(), true); | 1486 occlusion_rect.size(), true); |
1487 occluding_layer->SetForceRenderSurface(false); | 1487 occluding_layer->test_properties()->force_render_surface = false; |
1488 this->CalcDrawEtc(parent); | 1488 this->CalcDrawEtc(parent); |
1489 | 1489 |
1490 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 200, 200)); | 1490 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 200, 200)); |
1491 | 1491 |
1492 // This layer occludes pixels directly beside the filtered_surface. | 1492 // This layer occludes pixels directly beside the filtered_surface. |
1493 // Because filtered surface blends pixels in a radius, it will need to see | 1493 // Because filtered surface blends pixels in a radius, it will need to see |
1494 // some of the pixels (up to radius far) underneath the occluding layers. | 1494 // some of the pixels (up to radius far) underneath the occluding layers. |
1495 this->VisitLayer(occluding_layer, &occlusion); | 1495 this->VisitLayer(occluding_layer, &occlusion); |
1496 | 1496 |
1497 EXPECT_EQ(occlusion_rect.ToString(), | 1497 EXPECT_EQ(occlusion_rect.ToString(), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1561 parent->SetMasksToBounds(true); | 1561 parent->SetMasksToBounds(true); |
1562 LayerImpl* filtered_surface1 = this->CreateDrawingLayer( | 1562 LayerImpl* filtered_surface1 = this->CreateDrawingLayer( |
1563 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); | 1563 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); |
1564 LayerImpl* filtered_surface2 = this->CreateDrawingLayer( | 1564 LayerImpl* filtered_surface2 = this->CreateDrawingLayer( |
1565 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); | 1565 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); |
1566 LayerImpl* occluding_layer_above = this->CreateDrawingLayer( | 1566 LayerImpl* occluding_layer_above = this->CreateDrawingLayer( |
1567 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), | 1567 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), |
1568 gfx::Size(50, 50), true); | 1568 gfx::Size(50, 50), true); |
1569 | 1569 |
1570 // Filters make the layers own surfaces. | 1570 // Filters make the layers own surfaces. |
1571 filtered_surface1->SetForceRenderSurface(true); | 1571 filtered_surface1->test_properties()->force_render_surface = true; |
1572 filtered_surface2->SetForceRenderSurface(true); | 1572 filtered_surface2->test_properties()->force_render_surface = true; |
1573 FilterOperations filters; | 1573 FilterOperations filters; |
1574 filters.Append(FilterOperation::CreateBlurFilter(1.f)); | 1574 filters.Append(FilterOperation::CreateBlurFilter(1.f)); |
1575 filtered_surface1->SetBackgroundFilters(filters); | 1575 filtered_surface1->SetBackgroundFilters(filters); |
1576 filtered_surface2->SetBackgroundFilters(filters); | 1576 filtered_surface2->SetBackgroundFilters(filters); |
1577 | 1577 |
1578 // Save the distance of influence for the blur effect. | 1578 // Save the distance of influence for the blur effect. |
1579 int outset_top, outset_right, outset_bottom, outset_left; | 1579 int outset_top, outset_right, outset_bottom, outset_left; |
1580 filters.GetOutsets( | 1580 filters.GetOutsets( |
1581 &outset_top, &outset_right, &outset_bottom, &outset_left); | 1581 &outset_top, &outset_right, &outset_bottom, &outset_left); |
1582 | 1582 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1638 gfx::Size(30, 30), true); | 1638 gfx::Size(30, 30), true); |
1639 LayerImpl* filtered_surface = | 1639 LayerImpl* filtered_surface = |
1640 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), | 1640 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), |
1641 gfx::Size(100, 100), false); | 1641 gfx::Size(100, 100), false); |
1642 this->CreateReplicaLayer(filtered_surface, | 1642 this->CreateReplicaLayer(filtered_surface, |
1643 this->identity_matrix, | 1643 this->identity_matrix, |
1644 gfx::PointF(300.f, 0.f), | 1644 gfx::PointF(300.f, 0.f), |
1645 gfx::Size()); | 1645 gfx::Size()); |
1646 | 1646 |
1647 // Filters make the layer own a surface. | 1647 // Filters make the layer own a surface. |
1648 filtered_surface->SetForceRenderSurface(true); | 1648 filtered_surface->test_properties()->force_render_surface = true; |
1649 FilterOperations filters; | 1649 FilterOperations filters; |
1650 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 1650 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
1651 filtered_surface->SetBackgroundFilters(filters); | 1651 filtered_surface->SetBackgroundFilters(filters); |
1652 | 1652 |
1653 this->CalcDrawEtc(parent); | 1653 this->CalcDrawEtc(parent); |
1654 | 1654 |
1655 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1655 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1656 | 1656 |
1657 // The surface has a background blur, so it blurs non-opaque pixels below | 1657 // The surface has a background blur, so it blurs non-opaque pixels below |
1658 // it. | 1658 // it. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1705 TestContentLayerImpl* parent = this->CreateRoot( | 1705 TestContentLayerImpl* parent = this->CreateRoot( |
1706 this->identity_matrix, gfx::PointF(), gfx::Size(200, 150)); | 1706 this->identity_matrix, gfx::PointF(), gfx::Size(200, 150)); |
1707 LayerImpl* filtered_surface = | 1707 LayerImpl* filtered_surface = |
1708 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), | 1708 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), |
1709 gfx::Size(100, 100), false); | 1709 gfx::Size(100, 100), false); |
1710 LayerImpl* occluding_layer = this->CreateDrawingLayer( | 1710 LayerImpl* occluding_layer = this->CreateDrawingLayer( |
1711 parent, this->identity_matrix, gfx::PointF(50.f, 50.f), | 1711 parent, this->identity_matrix, gfx::PointF(50.f, 50.f), |
1712 gfx::Size(50, 50), true); | 1712 gfx::Size(50, 50), true); |
1713 | 1713 |
1714 // Filters make the layer own a surface. | 1714 // Filters make the layer own a surface. |
1715 filtered_surface->SetForceRenderSurface(true); | 1715 filtered_surface->test_properties()->force_render_surface = true; |
1716 FilterOperations filters; | 1716 FilterOperations filters; |
1717 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 1717 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
1718 filtered_surface->SetBackgroundFilters(filters); | 1718 filtered_surface->SetBackgroundFilters(filters); |
1719 | 1719 |
1720 this->CalcDrawEtc(parent); | 1720 this->CalcDrawEtc(parent); |
1721 | 1721 |
1722 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1722 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1723 | 1723 |
1724 this->VisitLayer(occluding_layer, &occlusion); | 1724 this->VisitLayer(occluding_layer, &occlusion); |
1725 | 1725 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 parent, this->identity_matrix, gfx::PointF(200.f, 50.f), | 1784 parent, this->identity_matrix, gfx::PointF(200.f, 50.f), |
1785 gfx::Size(30, 50), true); | 1785 gfx::Size(30, 50), true); |
1786 LayerImpl* beside_surface_layer = this->CreateDrawingLayer( | 1786 LayerImpl* beside_surface_layer = this->CreateDrawingLayer( |
1787 parent, this->identity_matrix, gfx::PointF(90.f, 40.f), | 1787 parent, this->identity_matrix, gfx::PointF(90.f, 40.f), |
1788 gfx::Size(10, 10), true); | 1788 gfx::Size(10, 10), true); |
1789 LayerImpl* beside_replica_layer = this->CreateDrawingLayer( | 1789 LayerImpl* beside_replica_layer = this->CreateDrawingLayer( |
1790 parent, this->identity_matrix, gfx::PointF(200.f, 40.f), | 1790 parent, this->identity_matrix, gfx::PointF(200.f, 40.f), |
1791 gfx::Size(10, 10), true); | 1791 gfx::Size(10, 10), true); |
1792 | 1792 |
1793 // Filters make the layer own a surface. | 1793 // Filters make the layer own a surface. |
1794 filtered_surface->SetForceRenderSurface(true); | 1794 filtered_surface->test_properties()->force_render_surface = true; |
1795 FilterOperations filters; | 1795 FilterOperations filters; |
1796 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 1796 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
1797 filtered_surface->SetBackgroundFilters(filters); | 1797 filtered_surface->SetBackgroundFilters(filters); |
1798 | 1798 |
1799 // Save the distance of influence for the blur effect. | 1799 // Save the distance of influence for the blur effect. |
1800 int outset_top, outset_right, outset_bottom, outset_left; | 1800 int outset_top, outset_right, outset_bottom, outset_left; |
1801 filters.GetOutsets( | 1801 filters.GetOutsets( |
1802 &outset_top, &outset_right, &outset_bottom, &outset_left); | 1802 &outset_top, &outset_right, &outset_bottom, &outset_left); |
1803 | 1803 |
1804 this->CalcDrawEtc(parent); | 1804 this->CalcDrawEtc(parent); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1859 TestContentLayerImpl* parent = this->CreateRoot( | 1859 TestContentLayerImpl* parent = this->CreateRoot( |
1860 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); | 1860 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); |
1861 LayerImpl* blend_mode_layer = this->CreateDrawingLayer( | 1861 LayerImpl* blend_mode_layer = this->CreateDrawingLayer( |
1862 parent, this->identity_matrix, gfx::PointF(0.f, 0.f), | 1862 parent, this->identity_matrix, gfx::PointF(0.f, 0.f), |
1863 gfx::Size(100, 100), true); | 1863 gfx::Size(100, 100), true); |
1864 LayerImpl* top_layer = this->CreateDrawingLayer( | 1864 LayerImpl* top_layer = this->CreateDrawingLayer( |
1865 parent, this->identity_matrix, gfx::PointF(10.f, 12.f), | 1865 parent, this->identity_matrix, gfx::PointF(10.f, 12.f), |
1866 gfx::Size(20, 22), true); | 1866 gfx::Size(20, 22), true); |
1867 | 1867 |
1868 // Blend mode makes the layer own a surface. | 1868 // Blend mode makes the layer own a surface. |
1869 blend_mode_layer->SetForceRenderSurface(true); | 1869 blend_mode_layer->test_properties()->force_render_surface = true; |
1870 blend_mode_layer->SetBlendMode(SkXfermode::kMultiply_Mode); | 1870 blend_mode_layer->SetBlendMode(SkXfermode::kMultiply_Mode); |
1871 | 1871 |
1872 this->CalcDrawEtc(parent); | 1872 this->CalcDrawEtc(parent); |
1873 | 1873 |
1874 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1874 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1875 | 1875 |
1876 this->VisitLayer(top_layer, &occlusion); | 1876 this->VisitLayer(top_layer, &occlusion); |
1877 // |top_layer| occludes. | 1877 // |top_layer| occludes. |
1878 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(), | 1878 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(), |
1879 occlusion.occlusion_from_inside_target().ToString()); | 1879 occlusion.occlusion_from_inside_target().ToString()); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2517 EXPECT_EQ(gfx::Rect(), | 2517 EXPECT_EQ(gfx::Rect(), |
2518 occlusion.UnoccludedSurfaceContentRect( | 2518 occlusion.UnoccludedSurfaceContentRect( |
2519 surface, gfx::Rect(80, 70, 50, 50))); | 2519 surface, gfx::Rect(80, 70, 50, 50))); |
2520 } | 2520 } |
2521 }; | 2521 }; |
2522 | 2522 |
2523 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 2523 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
2524 | 2524 |
2525 } // namespace | 2525 } // namespace |
2526 } // namespace cc | 2526 } // namespace cc |
OLD | NEW |