Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: cc/trees/occlusion_tracker_unittest.cc

Issue 1505243003: Revert of Create RenderSurface on Effect Tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@alwayspt
Patch Set: rebase Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/occlusion_tracker_perftest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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->SetForceRenderSurface(true); 109 layer_ptr->SetHasRenderSurface(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->SetForceRenderSurface(true); 133 layer->SetHasRenderSurface(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
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->SetForceRenderSurface(true); 192 layer->SetHasRenderSurface(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);
216 layer->PassCopyRequests(&requests); 217 layer->PassCopyRequests(&requests);
217 } 218 }
218 219
219 void CalcDrawEtc(TestContentLayerImpl* root) { 220 void CalcDrawEtc(TestContentLayerImpl* root) {
220 DCHECK(root == root_.get()); 221 DCHECK(root == root_.get());
221 222
222 // These occlusion tests attach and detach layers in multiple 223 // These occlusion tests attach and detach layers in multiple
223 // iterations, so rebuild property trees every time. 224 // iterations, so rebuild property trees every time.
224 root->layer_tree_impl()->property_trees()->needs_rebuild = true; 225 root->layer_tree_impl()->property_trees()->needs_rebuild = true;
225 226
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 : OcclusionTrackerTest(opaque_layers) {} 529 : OcclusionTrackerTest(opaque_layers) {}
529 530
530 void RunMyTest() override { 531 void RunMyTest() override {
531 TestContentLayerImpl* parent = this->CreateRoot( 532 TestContentLayerImpl* parent = this->CreateRoot(
532 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 533 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
533 534
534 gfx::Transform layer1_matrix; 535 gfx::Transform layer1_matrix;
535 layer1_matrix.Scale(2.0, 2.0); 536 layer1_matrix.Scale(2.0, 2.0);
536 TestContentLayerImpl* layer1 = this->CreateDrawingLayer( 537 TestContentLayerImpl* layer1 = this->CreateDrawingLayer(
537 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true); 538 parent, layer1_matrix, gfx::PointF(), gfx::Size(100, 100), true);
538 layer1->SetForceRenderSurface(true); 539 layer1->SetHasRenderSurface(true);
539 540
540 gfx::Transform layer2_matrix; 541 gfx::Transform layer2_matrix;
541 layer2_matrix.Translate(25.0, 25.0); 542 layer2_matrix.Translate(25.0, 25.0);
542 TestContentLayerImpl* layer2 = this->CreateDrawingLayer( 543 TestContentLayerImpl* layer2 = this->CreateDrawingLayer(
543 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true); 544 layer1, layer2_matrix, gfx::PointF(), gfx::Size(50, 50), true);
544 TestContentLayerImpl* occluder = this->CreateDrawingLayer( 545 TestContentLayerImpl* occluder = this->CreateDrawingLayer(
545 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), 546 parent, this->identity_matrix, gfx::PointF(100.f, 100.f),
546 gfx::Size(500, 500), true); 547 gfx::Size(500, 500), true);
547 this->CalcDrawEtc(parent); 548 this->CalcDrawEtc(parent);
548 549
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 TestContentLayerImpl* blur_layer = this->CreateDrawingLayer( 910 TestContentLayerImpl* blur_layer = this->CreateDrawingLayer(
910 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), 911 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500),
911 true); 912 true);
912 TestContentLayerImpl* opaque_layer = this->CreateDrawingLayer( 913 TestContentLayerImpl* opaque_layer = this->CreateDrawingLayer(
913 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), 914 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500),
914 true); 915 true);
915 TestContentLayerImpl* opacity_layer = this->CreateDrawingLayer( 916 TestContentLayerImpl* opacity_layer = this->CreateDrawingLayer(
916 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500), 917 parent, layer_transform, gfx::PointF(30.f, 30.f), gfx::Size(500, 500),
917 true); 918 true);
918 919
919 blur_layer->SetForceRenderSurface(true); 920 blur_layer->SetHasRenderSurface(true);
920 FilterOperations filters; 921 FilterOperations filters;
921 filters.Append(FilterOperation::CreateBlurFilter(10.f)); 922 filters.Append(FilterOperation::CreateBlurFilter(10.f));
922 blur_layer->SetFilters(filters); 923 blur_layer->SetFilters(filters);
923 924
924 opaque_layer->SetForceRenderSurface(true); 925 opaque_layer->SetHasRenderSurface(true);
925 filters.Clear(); 926 filters.Clear();
926 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f)); 927 filters.Append(FilterOperation::CreateGrayscaleFilter(0.5f));
927 opaque_layer->SetFilters(filters); 928 opaque_layer->SetFilters(filters);
928 929
929 opacity_layer->SetForceRenderSurface(true); 930 opacity_layer->SetHasRenderSurface(true);
930 filters.Clear(); 931 filters.Clear();
931 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); 932 filters.Append(FilterOperation::CreateOpacityFilter(0.5f));
932 opacity_layer->SetFilters(filters); 933 opacity_layer->SetFilters(filters);
933 934
934 this->CalcDrawEtc(parent); 935 this->CalcDrawEtc(parent);
935 936
936 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); 937 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000));
937 938
938 // Opacity layer won't contribute to occlusion. 939 // Opacity layer won't contribute to occlusion.
939 this->VisitLayer(opacity_layer, &occlusion); 940 this->VisitLayer(opacity_layer, &occlusion);
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 1452
1452 // Make a 50x50 filtered surface that is adjacent to occluding layers 1453 // Make a 50x50 filtered surface that is adjacent to occluding layers
1453 // which are above it in the z-order in various configurations. The 1454 // which are above it in the z-order in various configurations. The
1454 // surface is scaled to test that the pixel moving is done in the target 1455 // surface is scaled to test that the pixel moving is done in the target
1455 // space, where the background filter is applied. 1456 // space, where the background filter is applied.
1456 TestContentLayerImpl* parent = this->CreateRoot( 1457 TestContentLayerImpl* parent = this->CreateRoot(
1457 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200)); 1458 this->identity_matrix, gfx::PointF(), gfx::Size(200, 200));
1458 LayerImpl* filtered_surface = this->CreateDrawingLayer( 1459 LayerImpl* filtered_surface = this->CreateDrawingLayer(
1459 parent, scale_by_half, gfx::PointF(50.f, 50.f), gfx::Size(100, 100), 1460 parent, scale_by_half, gfx::PointF(50.f, 50.f), gfx::Size(100, 100),
1460 false); 1461 false);
1462 filtered_surface->SetHasRenderSurface(true);
1461 filtered_surface->SetBackgroundFilters(filters); 1463 filtered_surface->SetBackgroundFilters(filters);
1462 gfx::Rect occlusion_rect; 1464 gfx::Rect occlusion_rect;
1463 switch (i) { 1465 switch (i) {
1464 case LEFT: 1466 case LEFT:
1465 occlusion_rect = gfx::Rect(0, 0, 50, 200); 1467 occlusion_rect = gfx::Rect(0, 0, 50, 200);
1466 break; 1468 break;
1467 case RIGHT: 1469 case RIGHT:
1468 occlusion_rect = gfx::Rect(100, 0, 50, 200); 1470 occlusion_rect = gfx::Rect(100, 0, 50, 200);
1469 break; 1471 break;
1470 case TOP: 1472 case TOP:
1471 occlusion_rect = gfx::Rect(0, 0, 200, 50); 1473 occlusion_rect = gfx::Rect(0, 0, 200, 50);
1472 break; 1474 break;
1473 case BOTTOM: 1475 case BOTTOM:
1474 occlusion_rect = gfx::Rect(0, 100, 200, 50); 1476 occlusion_rect = gfx::Rect(0, 100, 200, 50);
1475 break; 1477 break;
1476 } 1478 }
1477 1479
1478 LayerImpl* occluding_layer = this->CreateDrawingLayer( 1480 LayerImpl* occluding_layer = this->CreateDrawingLayer(
1479 parent, this->identity_matrix, gfx::PointF(occlusion_rect.origin()), 1481 parent, this->identity_matrix, gfx::PointF(occlusion_rect.origin()),
1480 occlusion_rect.size(), true); 1482 occlusion_rect.size(), true);
1481 occluding_layer->SetForceRenderSurface(false);
1482 this->CalcDrawEtc(parent); 1483 this->CalcDrawEtc(parent);
1483 1484
1484 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 200, 200)); 1485 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 200, 200));
1485 1486
1486 // This layer occludes pixels directly beside the filtered_surface. 1487 // This layer occludes pixels directly beside the filtered_surface.
1487 // Because filtered surface blends pixels in a radius, it will need to see 1488 // Because filtered surface blends pixels in a radius, it will need to see
1488 // some of the pixels (up to radius far) underneath the occluding layers. 1489 // some of the pixels (up to radius far) underneath the occluding layers.
1489 this->VisitLayer(occluding_layer, &occlusion); 1490 this->VisitLayer(occluding_layer, &occlusion);
1490 1491
1491 EXPECT_EQ(occlusion_rect.ToString(), 1492 EXPECT_EQ(occlusion_rect.ToString(),
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1555 parent->SetMasksToBounds(true); 1556 parent->SetMasksToBounds(true);
1556 LayerImpl* filtered_surface1 = this->CreateDrawingLayer( 1557 LayerImpl* filtered_surface1 = this->CreateDrawingLayer(
1557 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); 1558 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false);
1558 LayerImpl* filtered_surface2 = this->CreateDrawingLayer( 1559 LayerImpl* filtered_surface2 = this->CreateDrawingLayer(
1559 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false); 1560 parent, scale_by_half, gfx::PointF(), gfx::Size(300, 300), false);
1560 LayerImpl* occluding_layer_above = this->CreateDrawingLayer( 1561 LayerImpl* occluding_layer_above = this->CreateDrawingLayer(
1561 parent, this->identity_matrix, gfx::PointF(100.f, 100.f), 1562 parent, this->identity_matrix, gfx::PointF(100.f, 100.f),
1562 gfx::Size(50, 50), true); 1563 gfx::Size(50, 50), true);
1563 1564
1564 // Filters make the layers own surfaces. 1565 // Filters make the layers own surfaces.
1565 filtered_surface1->SetForceRenderSurface(true); 1566 filtered_surface1->SetHasRenderSurface(true);
1566 filtered_surface2->SetForceRenderSurface(true); 1567 filtered_surface2->SetHasRenderSurface(true);
1567 FilterOperations filters; 1568 FilterOperations filters;
1568 filters.Append(FilterOperation::CreateBlurFilter(1.f)); 1569 filters.Append(FilterOperation::CreateBlurFilter(1.f));
1569 filtered_surface1->SetBackgroundFilters(filters); 1570 filtered_surface1->SetBackgroundFilters(filters);
1570 filtered_surface2->SetBackgroundFilters(filters); 1571 filtered_surface2->SetBackgroundFilters(filters);
1571 1572
1572 // Save the distance of influence for the blur effect. 1573 // Save the distance of influence for the blur effect.
1573 int outset_top, outset_right, outset_bottom, outset_left; 1574 int outset_top, outset_right, outset_bottom, outset_left;
1574 filters.GetOutsets( 1575 filters.GetOutsets(
1575 &outset_top, &outset_right, &outset_bottom, &outset_left); 1576 &outset_top, &outset_right, &outset_bottom, &outset_left);
1576 1577
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 gfx::Size(30, 30), true); 1633 gfx::Size(30, 30), true);
1633 LayerImpl* filtered_surface = 1634 LayerImpl* filtered_surface =
1634 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), 1635 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f),
1635 gfx::Size(100, 100), false); 1636 gfx::Size(100, 100), false);
1636 this->CreateReplicaLayer(filtered_surface, 1637 this->CreateReplicaLayer(filtered_surface,
1637 this->identity_matrix, 1638 this->identity_matrix,
1638 gfx::PointF(300.f, 0.f), 1639 gfx::PointF(300.f, 0.f),
1639 gfx::Size()); 1640 gfx::Size());
1640 1641
1641 // Filters make the layer own a surface. 1642 // Filters make the layer own a surface.
1642 filtered_surface->SetForceRenderSurface(true); 1643 filtered_surface->SetHasRenderSurface(true);
1643 FilterOperations filters; 1644 FilterOperations filters;
1644 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 1645 filters.Append(FilterOperation::CreateBlurFilter(3.f));
1645 filtered_surface->SetBackgroundFilters(filters); 1646 filtered_surface->SetBackgroundFilters(filters);
1646 1647
1647 this->CalcDrawEtc(parent); 1648 this->CalcDrawEtc(parent);
1648 1649
1649 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); 1650 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000));
1650 1651
1651 // The surface has a background blur, so it blurs non-opaque pixels below 1652 // The surface has a background blur, so it blurs non-opaque pixels below
1652 // it. 1653 // it.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 TestContentLayerImpl* parent = this->CreateRoot( 1700 TestContentLayerImpl* parent = this->CreateRoot(
1700 this->identity_matrix, gfx::PointF(), gfx::Size(200, 150)); 1701 this->identity_matrix, gfx::PointF(), gfx::Size(200, 150));
1701 LayerImpl* filtered_surface = 1702 LayerImpl* filtered_surface =
1702 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f), 1703 this->CreateDrawingLayer(parent, scale_by_half, gfx::PointF(50.f, 50.f),
1703 gfx::Size(100, 100), false); 1704 gfx::Size(100, 100), false);
1704 LayerImpl* occluding_layer = this->CreateDrawingLayer( 1705 LayerImpl* occluding_layer = this->CreateDrawingLayer(
1705 parent, this->identity_matrix, gfx::PointF(50.f, 50.f), 1706 parent, this->identity_matrix, gfx::PointF(50.f, 50.f),
1706 gfx::Size(50, 50), true); 1707 gfx::Size(50, 50), true);
1707 1708
1708 // Filters make the layer own a surface. 1709 // Filters make the layer own a surface.
1709 filtered_surface->SetForceRenderSurface(true); 1710 filtered_surface->SetHasRenderSurface(true);
1710 FilterOperations filters; 1711 FilterOperations filters;
1711 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 1712 filters.Append(FilterOperation::CreateBlurFilter(3.f));
1712 filtered_surface->SetBackgroundFilters(filters); 1713 filtered_surface->SetBackgroundFilters(filters);
1713 1714
1714 this->CalcDrawEtc(parent); 1715 this->CalcDrawEtc(parent);
1715 1716
1716 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); 1717 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000));
1717 1718
1718 this->VisitLayer(occluding_layer, &occlusion); 1719 this->VisitLayer(occluding_layer, &occlusion);
1719 1720
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 parent, this->identity_matrix, gfx::PointF(200.f, 50.f), 1779 parent, this->identity_matrix, gfx::PointF(200.f, 50.f),
1779 gfx::Size(30, 50), true); 1780 gfx::Size(30, 50), true);
1780 LayerImpl* beside_surface_layer = this->CreateDrawingLayer( 1781 LayerImpl* beside_surface_layer = this->CreateDrawingLayer(
1781 parent, this->identity_matrix, gfx::PointF(90.f, 40.f), 1782 parent, this->identity_matrix, gfx::PointF(90.f, 40.f),
1782 gfx::Size(10, 10), true); 1783 gfx::Size(10, 10), true);
1783 LayerImpl* beside_replica_layer = this->CreateDrawingLayer( 1784 LayerImpl* beside_replica_layer = this->CreateDrawingLayer(
1784 parent, this->identity_matrix, gfx::PointF(200.f, 40.f), 1785 parent, this->identity_matrix, gfx::PointF(200.f, 40.f),
1785 gfx::Size(10, 10), true); 1786 gfx::Size(10, 10), true);
1786 1787
1787 // Filters make the layer own a surface. 1788 // Filters make the layer own a surface.
1788 filtered_surface->SetForceRenderSurface(true); 1789 filtered_surface->SetHasRenderSurface(true);
1789 FilterOperations filters; 1790 FilterOperations filters;
1790 filters.Append(FilterOperation::CreateBlurFilter(3.f)); 1791 filters.Append(FilterOperation::CreateBlurFilter(3.f));
1791 filtered_surface->SetBackgroundFilters(filters); 1792 filtered_surface->SetBackgroundFilters(filters);
1792 1793
1793 // Save the distance of influence for the blur effect. 1794 // Save the distance of influence for the blur effect.
1794 int outset_top, outset_right, outset_bottom, outset_left; 1795 int outset_top, outset_right, outset_bottom, outset_left;
1795 filters.GetOutsets( 1796 filters.GetOutsets(
1796 &outset_top, &outset_right, &outset_bottom, &outset_left); 1797 &outset_top, &outset_right, &outset_bottom, &outset_left);
1797 1798
1798 this->CalcDrawEtc(parent); 1799 this->CalcDrawEtc(parent);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1853 TestContentLayerImpl* parent = this->CreateRoot( 1854 TestContentLayerImpl* parent = this->CreateRoot(
1854 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100)); 1855 this->identity_matrix, gfx::PointF(), gfx::Size(100, 100));
1855 LayerImpl* blend_mode_layer = this->CreateDrawingLayer( 1856 LayerImpl* blend_mode_layer = this->CreateDrawingLayer(
1856 parent, this->identity_matrix, gfx::PointF(0.f, 0.f), 1857 parent, this->identity_matrix, gfx::PointF(0.f, 0.f),
1857 gfx::Size(100, 100), true); 1858 gfx::Size(100, 100), true);
1858 LayerImpl* top_layer = this->CreateDrawingLayer( 1859 LayerImpl* top_layer = this->CreateDrawingLayer(
1859 parent, this->identity_matrix, gfx::PointF(10.f, 12.f), 1860 parent, this->identity_matrix, gfx::PointF(10.f, 12.f),
1860 gfx::Size(20, 22), true); 1861 gfx::Size(20, 22), true);
1861 1862
1862 // Blend mode makes the layer own a surface. 1863 // Blend mode makes the layer own a surface.
1863 blend_mode_layer->SetForceRenderSurface(true); 1864 blend_mode_layer->SetHasRenderSurface(true);
1864 blend_mode_layer->SetBlendMode(SkXfermode::kMultiply_Mode); 1865 blend_mode_layer->SetBlendMode(SkXfermode::kMultiply_Mode);
1865 1866
1866 this->CalcDrawEtc(parent); 1867 this->CalcDrawEtc(parent);
1867 1868
1868 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000)); 1869 TestOcclusionTrackerWithClip occlusion(gfx::Rect(0, 0, 1000, 1000));
1869 1870
1870 this->VisitLayer(top_layer, &occlusion); 1871 this->VisitLayer(top_layer, &occlusion);
1871 // |top_layer| occludes. 1872 // |top_layer| occludes.
1872 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(), 1873 EXPECT_EQ(gfx::Rect(10, 12, 20, 22).ToString(),
1873 occlusion.occlusion_from_inside_target().ToString()); 1874 occlusion.occlusion_from_inside_target().ToString());
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2511 EXPECT_EQ(gfx::Rect(), 2512 EXPECT_EQ(gfx::Rect(),
2512 occlusion.UnoccludedSurfaceContentRect( 2513 occlusion.UnoccludedSurfaceContentRect(
2513 surface, gfx::Rect(80, 70, 50, 50))); 2514 surface, gfx::Rect(80, 70, 50, 50)));
2514 } 2515 }
2515 }; 2516 };
2516 2517
2517 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery) 2518 ALL_OCCLUSIONTRACKER_TEST(OcclusionTrackerTestUnoccludedSurfaceQuery)
2518 2519
2519 } // namespace 2520 } // namespace
2520 } // namespace cc 2521 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion_tracker_perftest.cc ('k') | cc/trees/property_tree_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698