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 "cc/animation/layer_animation_controller.h" | 7 #include "cc/animation/layer_animation_controller.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
10 #include "cc/layers/layer_impl.h" | 10 #include "cc/layers/layer_impl.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 const gfx::Size& bounds) { | 99 const gfx::Size& bounds) { |
100 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 100 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
101 int id = next_layer_impl_id_++; | 101 int id = next_layer_impl_id_++; |
102 scoped_ptr<TestContentLayerImpl> layer(new TestContentLayerImpl(tree, id)); | 102 scoped_ptr<TestContentLayerImpl> layer(new TestContentLayerImpl(tree, id)); |
103 TestContentLayerImpl* layer_ptr = layer.get(); | 103 TestContentLayerImpl* layer_ptr = layer.get(); |
104 SetProperties(layer_ptr, transform, position, bounds); | 104 SetProperties(layer_ptr, transform, position, bounds); |
105 | 105 |
106 DCHECK(!root_.get()); | 106 DCHECK(!root_.get()); |
107 root_ = std::move(layer); | 107 root_ = std::move(layer); |
108 | 108 |
109 layer_ptr->SetHasRenderSurface(true); | 109 layer_ptr->SetForceRenderSurface(true); |
110 SetRootLayerOnMainThread(layer_ptr); | 110 SetRootLayerOnMainThread(layer_ptr); |
111 | 111 |
112 return layer_ptr; | 112 return layer_ptr; |
113 } | 113 } |
114 | 114 |
115 LayerImpl* CreateLayer(LayerImpl* parent, | 115 LayerImpl* CreateLayer(LayerImpl* parent, |
116 const gfx::Transform& transform, | 116 const gfx::Transform& transform, |
117 const gfx::PointF& position, | 117 const gfx::PointF& position, |
118 const gfx::Size& bounds) { | 118 const gfx::Size& bounds) { |
119 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 119 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
120 int id = next_layer_impl_id_++; | 120 int id = next_layer_impl_id_++; |
121 scoped_ptr<LayerImpl> layer = LayerImpl::Create(tree, id); | 121 scoped_ptr<LayerImpl> layer = LayerImpl::Create(tree, id); |
122 LayerImpl* layer_ptr = layer.get(); | 122 LayerImpl* layer_ptr = layer.get(); |
123 SetProperties(layer_ptr, transform, position, bounds); | 123 SetProperties(layer_ptr, transform, position, bounds); |
124 parent->AddChild(std::move(layer)); | 124 parent->AddChild(std::move(layer)); |
125 return layer_ptr; | 125 return layer_ptr; |
126 } | 126 } |
127 | 127 |
128 LayerImpl* CreateSurface(LayerImpl* parent, | 128 LayerImpl* CreateSurface(LayerImpl* parent, |
129 const gfx::Transform& transform, | 129 const gfx::Transform& transform, |
130 const gfx::PointF& position, | 130 const gfx::PointF& position, |
131 const gfx::Size& bounds) { | 131 const gfx::Size& bounds) { |
132 LayerImpl* layer = CreateLayer(parent, transform, position, bounds); | 132 LayerImpl* layer = CreateLayer(parent, transform, position, bounds); |
133 layer->SetHasRenderSurface(true); | 133 layer->SetForceRenderSurface(true); |
134 return layer; | 134 return layer; |
135 } | 135 } |
136 | 136 |
137 TestContentLayerImpl* CreateDrawingLayer(LayerImpl* parent, | 137 TestContentLayerImpl* CreateDrawingLayer(LayerImpl* parent, |
138 const gfx::Transform& transform, | 138 const gfx::Transform& transform, |
139 const gfx::PointF& position, | 139 const gfx::PointF& position, |
140 const gfx::Size& bounds, | 140 const gfx::Size& bounds, |
141 bool opaque) { | 141 bool opaque) { |
142 LayerTreeImpl* tree = host_->host_impl()->active_tree(); | 142 LayerTreeImpl* tree = host_->host_impl()->active_tree(); |
143 int id = next_layer_impl_id_++; | 143 int id = next_layer_impl_id_++; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return layer_ptr; | 182 return layer_ptr; |
183 } | 183 } |
184 | 184 |
185 TestContentLayerImpl* CreateDrawingSurface(LayerImpl* parent, | 185 TestContentLayerImpl* CreateDrawingSurface(LayerImpl* parent, |
186 const gfx::Transform& transform, | 186 const gfx::Transform& transform, |
187 const gfx::PointF& position, | 187 const gfx::PointF& position, |
188 const gfx::Size& bounds, | 188 const gfx::Size& bounds, |
189 bool opaque) { | 189 bool opaque) { |
190 TestContentLayerImpl* layer = | 190 TestContentLayerImpl* layer = |
191 CreateDrawingLayer(parent, transform, position, bounds, opaque); | 191 CreateDrawingLayer(parent, transform, position, bounds, opaque); |
192 layer->SetHasRenderSurface(true); | 192 layer->SetForceRenderSurface(true); |
193 return layer; | 193 return layer; |
194 } | 194 } |
195 | 195 |
196 void DestroyLayers() { | 196 void DestroyLayers() { |
197 root_ = nullptr; | 197 root_ = nullptr; |
198 render_surface_layer_list_impl_.clear(); | 198 render_surface_layer_list_impl_.clear(); |
199 replica_layers_.clear(); | 199 replica_layers_.clear(); |
200 mask_layers_.clear(); | 200 mask_layers_.clear(); |
201 ResetLayerIterator(); | 201 ResetLayerIterator(); |
202 } | 202 } |
203 | 203 |
204 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 204 void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
205 | 205 |
206 void AddCopyRequest(Layer* layer) { | 206 void AddCopyRequest(Layer* layer) { |
207 layer->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( | 207 layer->RequestCopyOfOutput(CopyOutputRequest::CreateBitmapRequest( |
208 base::Bind(&OcclusionTrackerTest::CopyOutputCallback, | 208 base::Bind(&OcclusionTrackerTest::CopyOutputCallback, |
209 base::Unretained(this)))); | 209 base::Unretained(this)))); |
210 } | 210 } |
211 | 211 |
212 void AddCopyRequest(LayerImpl* layer) { | 212 void AddCopyRequest(LayerImpl* layer) { |
213 std::vector<scoped_ptr<CopyOutputRequest>> requests; | 213 std::vector<scoped_ptr<CopyOutputRequest>> requests; |
214 requests.push_back(CopyOutputRequest::CreateBitmapRequest(base::Bind( | 214 requests.push_back(CopyOutputRequest::CreateBitmapRequest(base::Bind( |
215 &OcclusionTrackerTest::CopyOutputCallback, base::Unretained(this)))); | 215 &OcclusionTrackerTest::CopyOutputCallback, base::Unretained(this)))); |
216 layer->SetHasRenderSurface(true); | |
217 layer->PassCopyRequests(&requests); | 216 layer->PassCopyRequests(&requests); |
218 } | 217 } |
219 | 218 |
220 void CalcDrawEtc(TestContentLayerImpl* root) { | 219 void CalcDrawEtc(TestContentLayerImpl* root) { |
221 DCHECK(root == root_.get()); | 220 DCHECK(root == root_.get()); |
222 | 221 |
223 // These occlusion tests attach and detach layers in multiple | 222 // These occlusion tests attach and detach layers in multiple |
224 // iterations, so rebuild property trees every time. | 223 // iterations, so rebuild property trees every time. |
225 root->layer_tree_impl()->property_trees()->needs_rebuild = true; | 224 root->layer_tree_impl()->property_trees()->needs_rebuild = true; |
226 | 225 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 : OcclusionTrackerTest(opaque_layers) {} | 528 : OcclusionTrackerTest(opaque_layers) {} |
530 | 529 |
531 void RunMyTest() override { | 530 void RunMyTest() override { |
532 TestContentLayerImpl* parent = this->CreateRoot( | 531 TestContentLayerImpl* parent = this->CreateRoot( |
533 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); | 532 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); |
534 | 533 |
535 gfx::Transform layer1_matrix; | 534 gfx::Transform layer1_matrix; |
536 layer1_matrix.Scale(2.0, 2.0); | 535 layer1_matrix.Scale(2.0, 2.0); |
537 TestContentLayerImpl* layer1 = this->CreateDrawingLayer( | 536 TestContentLayerImpl* layer1 = this->CreateDrawingLayer( |
538 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); | 537 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); |
539 layer1->SetHasRenderSurface(true); | 538 layer1->SetForceRenderSurface(true); |
540 | 539 |
541 gfx::Transform layer2_matrix; | 540 gfx::Transform layer2_matrix; |
542 layer2_matrix.Translate(25.0, 25.0); | 541 layer2_matrix.Translate(25.0, 25.0); |
543 TestContentLayerImpl* layer2 = this->CreateDrawingLayer( | 542 TestContentLayerImpl* layer2 = this->CreateDrawingLayer( |
544 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); | 543 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); |
545 TestContentLayerImpl* occluder = this->CreateDrawingLayer( | 544 TestContentLayerImpl* occluder = this->CreateDrawingLayer( |
546 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), | 545 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), |
547 gfx::Size(500, 500), true); | 546 gfx::Size(500, 500), true); |
548 this->CalcDrawEtc(parent); | 547 this->CalcDrawEtc(parent); |
549 | 548 |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 TestContentLayerImpl* blur_layer = this->CreateDrawingLayer( | 909 TestContentLayerImpl* blur_layer = this->CreateDrawingLayer( |
911 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), | 910 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), |
912 true); | 911 true); |
913 TestContentLayerImpl* opaque_layer = this->CreateDrawingLayer( | 912 TestContentLayerImpl* opaque_layer = this->CreateDrawingLayer( |
914 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), | 913 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), |
915 true); | 914 true); |
916 TestContentLayerImpl* opacity_layer = this->CreateDrawingLayer( | 915 TestContentLayerImpl* opacity_layer = this->CreateDrawingLayer( |
917 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), |
918 true); | 917 true); |
919 | 918 |
920 blur_layer->SetHasRenderSurface(true); | 919 blur_layer->SetForceRenderSurface(true); |
921 FilterOperations filters; | 920 FilterOperations filters; |
922 filters.Append(FilterOperation::CreateBlurFilter(10.f)); | 921 filters.Append(FilterOperation::CreateBlurFilter(10.f)); |
923 blur_layer->SetFilters(filters); | 922 blur_layer->SetFilters(filters); |
924 | 923 |
925 opaque_layer->SetHasRenderSurface(true); | 924 opaque_layer->SetForceRenderSurface(true); |
926 filters.Clear(); | 925 filters.Clear(); |
927 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); | 926 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); |
928 opaque_layer->SetFilters(filters); | 927 opaque_layer->SetFilters(filters); |
929 | 928 |
930 opacity_layer->SetHasRenderSurface(true); | 929 opacity_layer->SetForceRenderSurface(true); |
931 filters.Clear(); | 930 filters.Clear(); |
932 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); | 931 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
933 opacity_layer->SetFilters(filters); | 932 opacity_layer->SetFilters(filters); |
934 | 933 |
935 this->CalcDrawEtc(parent); | 934 this->CalcDrawEtc(parent); |
936 | 935 |
937 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 936 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
938 | 937 |
939 // Opacity layer won't contribute to occlusion. | 938 // Opacity layer won't contribute to occlusion. |
940 this->VisitLayer(opacity_layer, &occlusion); | 939 this->VisitLayer(opacity_layer, &occlusion); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 | 1451 |
1453 // Make a 50x50 filtered surface that is adjacent to occluding layers | 1452 // Make a 50x50 filtered surface that is adjacent to occluding layers |
1454 // which are above it in the z-order in various configurations. The | 1453 // which are above it in the z-order in various configurations. The |
1455 // surface is scaled to test that the pixel moving is done in the target | 1454 // surface is scaled to test that the pixel moving is done in the target |
1456 // space, where the background filter is applied. | 1455 // space, where the background filter is applied. |
1457 TestContentLayerImpl* parent = this->CreateRoot( | 1456 TestContentLayerImpl* parent = this->CreateRoot( |
1458 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); | 1457 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); |
1459 LayerImpl* filtered_surface = this->CreateDrawingLayer( | 1458 LayerImpl* filtered_surface = this->CreateDrawingLayer( |
1460 parent, scale_by_half, gfx::PointF(50.f, 50.f), gfx::Size(100, 100), | 1459 parent, scale_by_half, gfx::PointF(50.f, 50.f), gfx::Size(100, 100), |
1461 false); | 1460 false); |
1462 filtered_surface->SetHasRenderSurface(true); | |
1463 filtered_surface->SetBackgroundFilters(filters); | 1461 filtered_surface->SetBackgroundFilters(filters); |
1464 gfx::Rect occlusion_rect; | 1462 gfx::Rect occlusion_rect; |
1465 switch (i) { | 1463 switch (i) { |
1466 case LEFT: | 1464 case LEFT: |
1467 occlusion_rect = gfx::Rect(0, 0, 50, 200); | 1465 occlusion_rect = gfx::Rect(0, 0, 50, 200); |
1468 break; | 1466 break; |
1469 case RIGHT: | 1467 case RIGHT: |
1470 occlusion_rect = gfx::Rect(100, 0, 50, 200); | 1468 occlusion_rect = gfx::Rect(100, 0, 50, 200); |
1471 break; | 1469 break; |
1472 case TOP: | 1470 case TOP: |
1473 occlusion_rect = gfx::Rect(0, 0, 200, 50); | 1471 occlusion_rect = gfx::Rect(0, 0, 200, 50); |
1474 break; | 1472 break; |
1475 case BOTTOM: | 1473 case BOTTOM: |
1476 occlusion_rect = gfx::Rect(0, 100, 200, 50); | 1474 occlusion_rect = gfx::Rect(0, 100, 200, 50); |
1477 break; | 1475 break; |
1478 } | 1476 } |
1479 | 1477 |
1480 LayerImpl* occluding_layer = this->CreateDrawingLayer( | 1478 LayerImpl* occluding_layer = this->CreateDrawingLayer( |
1481 parent, this->identity_matrix, gfx::PointF(occlusion_rect.origin()), | 1479 parent, this->identity_matrix, gfx::PointF(occlusion_rect.origin()), |
1482 occlusion_rect.size(), true); | 1480 occlusion_rect.size(), true); |
| 1481 occluding_layer->SetForceRenderSurface(false); |
1483 this->CalcDrawEtc(parent); | 1482 this->CalcDrawEtc(parent); |
1484 | 1483 |
1485 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 200, 200)); | 1484 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 200, 200)); |
1486 | 1485 |
1487 // This layer occludes pixels directly beside the filtered_surface. | 1486 // This layer occludes pixels directly beside the filtered_surface. |
1488 // Because filtered surface blends pixels in a radius, it will need to see | 1487 // Because filtered surface blends pixels in a radius, it will need to see |
1489 // some of the pixels (up to radius far) underneath the occluding layers. | 1488 // some of the pixels (up to radius far) underneath the occluding layers. |
1490 this->VisitLayer(occluding_layer, &occlusion); | 1489 this->VisitLayer(occluding_layer, &occlusion); |
1491 | 1490 |
1492 EXPECT_EQ(occlusion_rect.ToString(), | 1491 EXPECT_EQ(occlusion_rect.ToString(), |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 parent->SetMasksToBounds(true); | 1555 parent->SetMasksToBounds(true); |
1557 LayerImpl* filtered_surface1 = this->CreateDrawingLayer( | 1556 LayerImpl* filtered_surface1 = this->CreateDrawingLayer( |
1558 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); | 1557 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); |
1559 LayerImpl* filtered_surface2 = this->CreateDrawingLayer( | 1558 LayerImpl* filtered_surface2 = this->CreateDrawingLayer( |
1560 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); | 1559 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); |
1561 LayerImpl* occluding_layer_above = this->CreateDrawingLayer( | 1560 LayerImpl* occluding_layer_above = this->CreateDrawingLayer( |
1562 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), | 1561 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), |
1563 gfx::Size(50, 50), true); | 1562 gfx::Size(50, 50), true); |
1564 | 1563 |
1565 // Filters make the layers own surfaces. | 1564 // Filters make the layers own surfaces. |
1566 filtered_surface1->SetHasRenderSurface(true); | 1565 filtered_surface1->SetForceRenderSurface(true); |
1567 filtered_surface2->SetHasRenderSurface(true); | 1566 filtered_surface2->SetForceRenderSurface(true); |
1568 FilterOperations filters; | 1567 FilterOperations filters; |
1569 filters.Append(FilterOperation::CreateBlurFilter(1.f)); | 1568 filters.Append(FilterOperation::CreateBlurFilter(1.f)); |
1570 filtered_surface1->SetBackgroundFilters(filters); | 1569 filtered_surface1->SetBackgroundFilters(filters); |
1571 filtered_surface2->SetBackgroundFilters(filters); | 1570 filtered_surface2->SetBackgroundFilters(filters); |
1572 | 1571 |
1573 // Save the distance of influence for the blur effect. | 1572 // Save the distance of influence for the blur effect. |
1574 int outset_top, outset_right, outset_bottom, outset_left; | 1573 int outset_top, outset_right, outset_bottom, outset_left; |
1575 filters.GetOutsets( | 1574 filters.GetOutsets( |
1576 &outset_top, &outset_right, &outset_bottom, &outset_left); | 1575 &outset_top, &outset_right, &outset_bottom, &outset_left); |
1577 | 1576 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1633 gfx::Size(30, 30), true); | 1632 gfx::Size(30, 30), true); |
1634 LayerImpl* filtered_surface = | 1633 LayerImpl* filtered_surface = |
1635 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), | 1634 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), |
1636 gfx::Size(100, 100), false); | 1635 gfx::Size(100, 100), false); |
1637 this->CreateReplicaLayer(filtered_surface, | 1636 this->CreateReplicaLayer(filtered_surface, |
1638 this->identity_matrix, | 1637 this->identity_matrix, |
1639 gfx::PointF(300.f, 0.f), | 1638 gfx::PointF(300.f, 0.f), |
1640 gfx::Size()); | 1639 gfx::Size()); |
1641 | 1640 |
1642 // Filters make the layer own a surface. | 1641 // Filters make the layer own a surface. |
1643 filtered_surface->SetHasRenderSurface(true); | 1642 filtered_surface->SetForceRenderSurface(true); |
1644 FilterOperations filters; | 1643 FilterOperations filters; |
1645 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 1644 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
1646 filtered_surface->SetBackgroundFilters(filters); | 1645 filtered_surface->SetBackgroundFilters(filters); |
1647 | 1646 |
1648 this->CalcDrawEtc(parent); | 1647 this->CalcDrawEtc(parent); |
1649 | 1648 |
1650 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1649 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1651 | 1650 |
1652 // The surface has a background blur, so it blurs non-opaque pixels below | 1651 // The surface has a background blur, so it blurs non-opaque pixels below |
1653 // it. | 1652 // it. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1700 TestContentLayerImpl* parent = this->CreateRoot( | 1699 TestContentLayerImpl* parent = this->CreateRoot( |
1701 this->identity_matrix, gfx::PointF(), gfx::Size(200, 150)); | 1700 this->identity_matrix, gfx::PointF(), gfx::Size(200, 150)); |
1702 LayerImpl* filtered_surface = | 1701 LayerImpl* filtered_surface = |
1703 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), | 1702 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), |
1704 gfx::Size(100, 100), false); | 1703 gfx::Size(100, 100), false); |
1705 LayerImpl* occluding_layer = this->CreateDrawingLayer( | 1704 LayerImpl* occluding_layer = this->CreateDrawingLayer( |
1706 parent, this->identity_matrix, gfx::PointF(50.f, 50.f), | 1705 parent, this->identity_matrix, gfx::PointF(50.f, 50.f), |
1707 gfx::Size(50, 50), true); | 1706 gfx::Size(50, 50), true); |
1708 | 1707 |
1709 // Filters make the layer own a surface. | 1708 // Filters make the layer own a surface. |
1710 filtered_surface->SetHasRenderSurface(true); | 1709 filtered_surface->SetForceRenderSurface(true); |
1711 FilterOperations filters; | 1710 FilterOperations filters; |
1712 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 1711 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
1713 filtered_surface->SetBackgroundFilters(filters); | 1712 filtered_surface->SetBackgroundFilters(filters); |
1714 | 1713 |
1715 this->CalcDrawEtc(parent); | 1714 this->CalcDrawEtc(parent); |
1716 | 1715 |
1717 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1716 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1718 | 1717 |
1719 this->VisitLayer(occluding_layer, &occlusion); | 1718 this->VisitLayer(occluding_layer, &occlusion); |
1720 | 1719 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 parent, this->identity_matrix, gfx::PointF(200.f, 50.f), | 1778 parent, this->identity_matrix, gfx::PointF(200.f, 50.f), |
1780 gfx::Size(30, 50), true); | 1779 gfx::Size(30, 50), true); |
1781 LayerImpl* beside_surface_layer = this->CreateDrawingLayer( | 1780 LayerImpl* beside_surface_layer = this->CreateDrawingLayer( |
1782 parent, this->identity_matrix, gfx::PointF(90.f, 40.f), | 1781 parent, this->identity_matrix, gfx::PointF(90.f, 40.f), |
1783 gfx::Size(10, 10), true); | 1782 gfx::Size(10, 10), true); |
1784 LayerImpl* beside_replica_layer = this->CreateDrawingLayer( | 1783 LayerImpl* beside_replica_layer = this->CreateDrawingLayer( |
1785 parent, this->identity_matrix, gfx::PointF(200.f, 40.f), | 1784 parent, this->identity_matrix, gfx::PointF(200.f, 40.f), |
1786 gfx::Size(10, 10), true); | 1785 gfx::Size(10, 10), true); |
1787 | 1786 |
1788 // Filters make the layer own a surface. | 1787 // Filters make the layer own a surface. |
1789 filtered_surface->SetHasRenderSurface(true); | 1788 filtered_surface->SetForceRenderSurface(true); |
1790 FilterOperations filters; | 1789 FilterOperations filters; |
1791 filters.Append(FilterOperation::CreateBlurFilter(3.f)); | 1790 filters.Append(FilterOperation::CreateBlurFilter(3.f)); |
1792 filtered_surface->SetBackgroundFilters(filters); | 1791 filtered_surface->SetBackgroundFilters(filters); |
1793 | 1792 |
1794 // Save the distance of influence for the blur effect. | 1793 // Save the distance of influence for the blur effect. |
1795 int outset_top, outset_right, outset_bottom, outset_left; | 1794 int outset_top, outset_right, outset_bottom, outset_left; |
1796 filters.GetOutsets( | 1795 filters.GetOutsets( |
1797 &outset_top, &outset_right, &outset_bottom, &outset_left); | 1796 &outset_top, &outset_right, &outset_bottom, &outset_left); |
1798 | 1797 |
1799 this->CalcDrawEtc(parent); | 1798 this->CalcDrawEtc(parent); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1854 TestContentLayerImpl* parent = this->CreateRoot( | 1853 TestContentLayerImpl* parent = this->CreateRoot( |
1855 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); | 1854 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); |
1856 LayerImpl* blend_mode_layer = this->CreateDrawingLayer( | 1855 LayerImpl* blend_mode_layer = this->CreateDrawingLayer( |
1857 parent, this->identity_matrix, gfx::PointF(0.f, 0.f), | 1856 parent, this->identity_matrix, gfx::PointF(0.f, 0.f), |
1858 gfx::Size(100, 100), true); | 1857 gfx::Size(100, 100), true); |
1859 LayerImpl* top_layer = this->CreateDrawingLayer( | 1858 LayerImpl* top_layer = this->CreateDrawingLayer( |
1860 parent, this->identity_matrix, gfx::PointF(10.f, 12.f), | 1859 parent, this->identity_matrix, gfx::PointF(10.f, 12.f), |
1861 gfx::Size(20, 22), true); | 1860 gfx::Size(20, 22), true); |
1862 | 1861 |
1863 // Blend mode makes the layer own a surface. | 1862 // Blend mode makes the layer own a surface. |
1864 blend_mode_layer->SetHasRenderSurface(true); | 1863 blend_mode_layer->SetForceRenderSurface(true); |
1865 blend_mode_layer->SetBlendMode(SkXfermode::kMultiply_Mode); | 1864 blend_mode_layer->SetBlendMode(SkXfermode::kMultiply_Mode); |
1866 | 1865 |
1867 this->CalcDrawEtc(parent); | 1866 this->CalcDrawEtc(parent); |
1868 | 1867 |
1869 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); | 1868 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); |
1870 | 1869 |
1871 this->VisitLayer(top_layer, &occlusion); | 1870 this->VisitLayer(top_layer, &occlusion); |
1872 // |top_layer| occludes. | 1871 // |top_layer| occludes. |
1873 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(), | 1872 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(), |
1874 occlusion.occlusion_from_inside_target().ToString()); | 1873 occlusion.occlusion_from_inside_target().ToString()); |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2512 EXPECT_EQ(gfx::Rect(), | 2511 EXPECT_EQ(gfx::Rect(), |
2513 occlusion.UnoccludedSurfaceContentRect( | 2512 occlusion.UnoccludedSurfaceContentRect( |
2514 surface, gfx::Rect(80, 70, 50, 50))); | 2513 surface, gfx::Rect(80, 70, 50, 50))); |
2515 } | 2514 } |
2516 }; | 2515 }; |
2517 | 2516 |
2518 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) | 2517 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) |
2519 | 2518 |
2520 } // namespace | 2519 } // namespace |
2521 } // namespace cc | 2520 } // namespace cc |
OLD | NEW |