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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "cc/output/copy_output_request.h" | 8 #include "cc/output/copy_output_request.h" |
9 #include "cc/output/copy_output_result.h" | 9 #include "cc/output/copy_output_result.h" |
10 #include "cc/test/layer_tree_test.h" | 10 #include "cc/test/layer_tree_test.h" |
11 #include "cc/test/test_occlusion_tracker.h" | 11 #include "cc/test/test_occlusion_tracker.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 namespace { | 14 namespace { |
15 | 15 |
16 class TestLayer : public Layer { | 16 class TestLayer : public Layer { |
17 public: | 17 public: |
18 static scoped_refptr<TestLayer> Create() { | 18 static scoped_refptr<TestLayer> Create() { |
19 return make_scoped_refptr(new TestLayer()); | 19 return make_scoped_refptr(new TestLayer()); |
20 } | 20 } |
21 | 21 |
22 virtual bool Update(ResourceUpdateQueue* update_queue, | 22 virtual bool Update(ResourceUpdateQueue* update_queue, |
23 const OcclusionTracker<Layer>* occlusion) OVERRIDE { | 23 const OcclusionTracker<Layer>* occlusion) override { |
24 if (!occlusion) | 24 if (!occlusion) |
25 return false; | 25 return false; |
26 | 26 |
27 const TestOcclusionTracker<Layer>* test_occlusion = | 27 const TestOcclusionTracker<Layer>* test_occlusion = |
28 static_cast<const TestOcclusionTracker<Layer>*>(occlusion); | 28 static_cast<const TestOcclusionTracker<Layer>*>(occlusion); |
29 occlusion_ = UnionSimpleEnclosedRegions( | 29 occlusion_ = UnionSimpleEnclosedRegions( |
30 test_occlusion->occlusion_from_inside_target(), | 30 test_occlusion->occlusion_from_inside_target(), |
31 test_occlusion->occlusion_from_outside_target()); | 31 test_occlusion->occlusion_from_outside_target()); |
32 return false; | 32 return false; |
33 } | 33 } |
(...skipping 19 matching lines...) Expand all Loading... |
53 class LayerTreeHostOcclusionTest : public LayerTreeTest { | 53 class LayerTreeHostOcclusionTest : public LayerTreeTest { |
54 public: | 54 public: |
55 LayerTreeHostOcclusionTest() | 55 LayerTreeHostOcclusionTest() |
56 : root_(TestLayer::Create()), | 56 : root_(TestLayer::Create()), |
57 child_(TestLayer::Create()), | 57 child_(TestLayer::Create()), |
58 child2_(TestLayer::Create()), | 58 child2_(TestLayer::Create()), |
59 grand_child_(TestLayer::Create()), | 59 grand_child_(TestLayer::Create()), |
60 mask_(TestLayer::Create()) { | 60 mask_(TestLayer::Create()) { |
61 } | 61 } |
62 | 62 |
63 virtual void BeginTest() OVERRIDE { | 63 virtual void BeginTest() override { |
64 PostSetNeedsCommitToMainThread(); | 64 PostSetNeedsCommitToMainThread(); |
65 } | 65 } |
66 | 66 |
67 virtual void DidCommit() OVERRIDE { | 67 virtual void DidCommit() override { |
68 TestLayer* root = static_cast<TestLayer*>(layer_tree_host()->root_layer()); | 68 TestLayer* root = static_cast<TestLayer*>(layer_tree_host()->root_layer()); |
69 VerifyOcclusion(root); | 69 VerifyOcclusion(root); |
70 | 70 |
71 EndTest(); | 71 EndTest(); |
72 } | 72 } |
73 | 73 |
74 virtual void AfterTest() OVERRIDE {} | 74 virtual void AfterTest() override {} |
75 | 75 |
76 void VerifyOcclusion(TestLayer* layer) const { | 76 void VerifyOcclusion(TestLayer* layer) const { |
77 EXPECT_EQ(layer->expected_occlusion().ToString(), | 77 EXPECT_EQ(layer->expected_occlusion().ToString(), |
78 layer->occlusion().ToString()); | 78 layer->occlusion().ToString()); |
79 | 79 |
80 for (size_t i = 0; i < layer->children().size(); ++i) { | 80 for (size_t i = 0; i < layer->children().size(); ++i) { |
81 TestLayer* child = static_cast<TestLayer*>(layer->children()[i].get()); | 81 TestLayer* child = static_cast<TestLayer*>(layer->children()[i].get()); |
82 VerifyOcclusion(child); | 82 VerifyOcclusion(child); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 void SetLayerPropertiesForTesting(TestLayer* layer, | 86 void SetLayerPropertiesForTesting(TestLayer* layer, |
87 TestLayer* parent, | 87 TestLayer* parent, |
88 const gfx::Transform& transform, | 88 const gfx::Transform& transform, |
89 const gfx::PointF& position, | 89 const gfx::PointF& position, |
90 const gfx::Size& bounds, | 90 const gfx::Size& bounds, |
91 bool opaque) const { | 91 bool opaque) const { |
92 layer->RemoveAllChildren(); | 92 layer->RemoveAllChildren(); |
93 if (parent) | 93 if (parent) |
94 parent->AddChild(layer); | 94 parent->AddChild(layer); |
95 layer->SetTransform(transform); | 95 layer->SetTransform(transform); |
96 layer->SetPosition(position); | 96 layer->SetPosition(position); |
97 layer->SetBounds(bounds); | 97 layer->SetBounds(bounds); |
98 layer->SetContentsOpaque(opaque); | 98 layer->SetContentsOpaque(opaque); |
99 } | 99 } |
100 | 100 |
101 protected: | 101 protected: |
102 virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { | 102 virtual void InitializeSettings(LayerTreeSettings* settings) override { |
103 settings->minimum_occlusion_tracking_size = gfx::Size(); | 103 settings->minimum_occlusion_tracking_size = gfx::Size(); |
104 } | 104 } |
105 | 105 |
106 scoped_refptr<TestLayer> root_; | 106 scoped_refptr<TestLayer> root_; |
107 scoped_refptr<TestLayer> child_; | 107 scoped_refptr<TestLayer> child_; |
108 scoped_refptr<TestLayer> child2_; | 108 scoped_refptr<TestLayer> child2_; |
109 scoped_refptr<TestLayer> grand_child_; | 109 scoped_refptr<TestLayer> grand_child_; |
110 scoped_refptr<TestLayer> mask_; | 110 scoped_refptr<TestLayer> mask_; |
111 | 111 |
112 gfx::Transform identity_matrix_; | 112 gfx::Transform identity_matrix_; |
113 }; | 113 }; |
114 | 114 |
115 | 115 |
116 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping | 116 class LayerTreeHostOcclusionTestOcclusionSurfaceClipping |
117 : public LayerTreeHostOcclusionTest { | 117 : public LayerTreeHostOcclusionTest { |
118 public: | 118 public: |
119 virtual void SetupTree() OVERRIDE { | 119 virtual void SetupTree() override { |
120 // The child layer is a surface and the grand_child is opaque, but clipped | 120 // The child layer is a surface and the grand_child is opaque, but clipped |
121 // to the child and root | 121 // to the child and root |
122 SetLayerPropertiesForTesting( | 122 SetLayerPropertiesForTesting( |
123 root_.get(), NULL, identity_matrix_, | 123 root_.get(), NULL, identity_matrix_, |
124 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 124 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
125 SetLayerPropertiesForTesting( | 125 SetLayerPropertiesForTesting( |
126 child_.get(), root_.get(), identity_matrix_, | 126 child_.get(), root_.get(), identity_matrix_, |
127 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); | 127 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); |
128 SetLayerPropertiesForTesting( | 128 SetLayerPropertiesForTesting( |
129 grand_child_.get(), child_.get(), identity_matrix_, | 129 grand_child_.get(), child_.get(), identity_matrix_, |
130 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 130 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
131 | 131 |
132 child_->SetMasksToBounds(true); | 132 child_->SetMasksToBounds(true); |
133 child_->SetForceRenderSurface(true); | 133 child_->SetForceRenderSurface(true); |
134 | 134 |
135 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); | 135 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); |
136 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190)); | 136 root_->set_expected_occlusion(gfx::Rect(10, 10, 10, 190)); |
137 | 137 |
138 layer_tree_host()->SetRootLayer(root_); | 138 layer_tree_host()->SetRootLayer(root_); |
139 LayerTreeTest::SetupTree(); | 139 LayerTreeTest::SetupTree(); |
140 } | 140 } |
141 }; | 141 }; |
142 | 142 |
143 SINGLE_AND_MULTI_THREAD_TEST_F( | 143 SINGLE_AND_MULTI_THREAD_TEST_F( |
144 LayerTreeHostOcclusionTestOcclusionSurfaceClipping); | 144 LayerTreeHostOcclusionTestOcclusionSurfaceClipping); |
145 | 145 |
146 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque | 146 class LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque |
147 : public LayerTreeHostOcclusionTest { | 147 : public LayerTreeHostOcclusionTest { |
148 public: | 148 public: |
149 virtual void SetupTree() OVERRIDE { | 149 virtual void SetupTree() override { |
150 // If the child layer is opaque, then it adds to the occlusion seen by the | 150 // If the child layer is opaque, then it adds to the occlusion seen by the |
151 // root_. | 151 // root_. |
152 SetLayerPropertiesForTesting( | 152 SetLayerPropertiesForTesting( |
153 root_.get(), NULL, identity_matrix_, | 153 root_.get(), NULL, identity_matrix_, |
154 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 154 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
155 SetLayerPropertiesForTesting( | 155 SetLayerPropertiesForTesting( |
156 child_.get(), root_.get(), identity_matrix_, | 156 child_.get(), root_.get(), identity_matrix_, |
157 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 157 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
158 SetLayerPropertiesForTesting( | 158 SetLayerPropertiesForTesting( |
159 grand_child_.get(), child_.get(), identity_matrix_, | 159 grand_child_.get(), child_.get(), identity_matrix_, |
160 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 160 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
161 | 161 |
162 child_->SetMasksToBounds(true); | 162 child_->SetMasksToBounds(true); |
163 child_->SetForceRenderSurface(true); | 163 child_->SetForceRenderSurface(true); |
164 | 164 |
165 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); | 165 child_->set_expected_occlusion(gfx::Rect(0, 0, 10, 190)); |
166 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); | 166 root_->set_expected_occlusion(gfx::Rect(10, 10, 190, 190)); |
167 | 167 |
168 layer_tree_host()->SetRootLayer(root_); | 168 layer_tree_host()->SetRootLayer(root_); |
169 LayerTreeTest::SetupTree(); | 169 LayerTreeTest::SetupTree(); |
170 } | 170 } |
171 }; | 171 }; |
172 | 172 |
173 SINGLE_AND_MULTI_THREAD_TEST_F( | 173 SINGLE_AND_MULTI_THREAD_TEST_F( |
174 LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque); | 174 LayerTreeHostOcclusionTestOcclusionSurfaceClippingOpaque); |
175 | 175 |
176 class LayerTreeHostOcclusionTestOcclusionTwoChildren | 176 class LayerTreeHostOcclusionTestOcclusionTwoChildren |
177 : public LayerTreeHostOcclusionTest { | 177 : public LayerTreeHostOcclusionTest { |
178 public: | 178 public: |
179 virtual void SetupTree() OVERRIDE { | 179 virtual void SetupTree() override { |
180 // Add a second child to the root layer and the regions should merge | 180 // Add a second child to the root layer and the regions should merge |
181 SetLayerPropertiesForTesting( | 181 SetLayerPropertiesForTesting( |
182 root_.get(), NULL, identity_matrix_, | 182 root_.get(), NULL, identity_matrix_, |
183 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 183 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
184 SetLayerPropertiesForTesting( | 184 SetLayerPropertiesForTesting( |
185 child_.get(), root_.get(), identity_matrix_, | 185 child_.get(), root_.get(), identity_matrix_, |
186 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); | 186 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), false); |
187 SetLayerPropertiesForTesting( | 187 SetLayerPropertiesForTesting( |
188 grand_child_.get(), child_.get(), identity_matrix_, | 188 grand_child_.get(), child_.get(), identity_matrix_, |
189 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); | 189 gfx::PointF(-10.f, -10.f), gfx::Size(20, 500), true); |
(...skipping 12 matching lines...) Expand all Loading... |
202 LayerTreeTest::SetupTree(); | 202 LayerTreeTest::SetupTree(); |
203 } | 203 } |
204 }; | 204 }; |
205 | 205 |
206 SINGLE_AND_MULTI_THREAD_TEST_F( | 206 SINGLE_AND_MULTI_THREAD_TEST_F( |
207 LayerTreeHostOcclusionTestOcclusionTwoChildren); | 207 LayerTreeHostOcclusionTestOcclusionTwoChildren); |
208 | 208 |
209 class LayerTreeHostOcclusionTestOcclusionMask | 209 class LayerTreeHostOcclusionTestOcclusionMask |
210 : public LayerTreeHostOcclusionTest { | 210 : public LayerTreeHostOcclusionTest { |
211 public: | 211 public: |
212 virtual void SetupTree() OVERRIDE { | 212 virtual void SetupTree() override { |
213 // If the child layer has a mask on it, then it shouldn't contribute to | 213 // If the child layer has a mask on it, then it shouldn't contribute to |
214 // occlusion on stuff below it. | 214 // occlusion on stuff below it. |
215 SetLayerPropertiesForTesting( | 215 SetLayerPropertiesForTesting( |
216 root_.get(), NULL, identity_matrix_, | 216 root_.get(), NULL, identity_matrix_, |
217 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 217 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
218 SetLayerPropertiesForTesting( | 218 SetLayerPropertiesForTesting( |
219 child2_.get(), root_.get(), identity_matrix_, | 219 child2_.get(), root_.get(), identity_matrix_, |
220 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 220 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
221 SetLayerPropertiesForTesting( | 221 SetLayerPropertiesForTesting( |
222 child_.get(), root_.get(), identity_matrix_, | 222 child_.get(), root_.get(), identity_matrix_, |
(...skipping 12 matching lines...) Expand all Loading... |
235 layer_tree_host()->SetRootLayer(root_); | 235 layer_tree_host()->SetRootLayer(root_); |
236 LayerTreeTest::SetupTree(); | 236 LayerTreeTest::SetupTree(); |
237 } | 237 } |
238 }; | 238 }; |
239 | 239 |
240 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask); | 240 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionMask); |
241 | 241 |
242 class LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion | 242 class LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion |
243 : public LayerTreeHostOcclusionTest { | 243 : public LayerTreeHostOcclusionTest { |
244 public: | 244 public: |
245 virtual void SetupTree() OVERRIDE { | 245 virtual void SetupTree() override { |
246 // If the child layer with a mask is below child2, then child2 should | 246 // If the child layer with a mask is below child2, then child2 should |
247 // contribute to occlusion on everything, and child shouldn't contribute | 247 // contribute to occlusion on everything, and child shouldn't contribute |
248 // to the root_. | 248 // to the root_. |
249 SetLayerPropertiesForTesting( | 249 SetLayerPropertiesForTesting( |
250 root_.get(), NULL, identity_matrix_, | 250 root_.get(), NULL, identity_matrix_, |
251 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 251 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
252 SetLayerPropertiesForTesting( | 252 SetLayerPropertiesForTesting( |
253 child_.get(), root_.get(), identity_matrix_, | 253 child_.get(), root_.get(), identity_matrix_, |
254 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 254 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
255 SetLayerPropertiesForTesting( | 255 SetLayerPropertiesForTesting( |
(...skipping 15 matching lines...) Expand all Loading... |
271 LayerTreeTest::SetupTree(); | 271 LayerTreeTest::SetupTree(); |
272 } | 272 } |
273 }; | 273 }; |
274 | 274 |
275 SINGLE_AND_MULTI_THREAD_TEST_F( | 275 SINGLE_AND_MULTI_THREAD_TEST_F( |
276 LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion); | 276 LayerTreeHostOcclusionTestOcclusionMaskBelowOcclusion); |
277 | 277 |
278 class LayerTreeHostOcclusionTestOcclusionOpacity | 278 class LayerTreeHostOcclusionTestOcclusionOpacity |
279 : public LayerTreeHostOcclusionTest { | 279 : public LayerTreeHostOcclusionTest { |
280 public: | 280 public: |
281 virtual void SetupTree() OVERRIDE { | 281 virtual void SetupTree() override { |
282 // If the child layer has a non-opaque opacity, then it shouldn't | 282 // If the child layer has a non-opaque opacity, then it shouldn't |
283 // contribute to occlusion on stuff below it | 283 // contribute to occlusion on stuff below it |
284 SetLayerPropertiesForTesting( | 284 SetLayerPropertiesForTesting( |
285 root_.get(), NULL, identity_matrix_, | 285 root_.get(), NULL, identity_matrix_, |
286 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 286 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
287 SetLayerPropertiesForTesting( | 287 SetLayerPropertiesForTesting( |
288 child2_.get(), root_.get(), identity_matrix_, | 288 child2_.get(), root_.get(), identity_matrix_, |
289 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 289 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
290 SetLayerPropertiesForTesting( | 290 SetLayerPropertiesForTesting( |
291 child_.get(), root_.get(), identity_matrix_, | 291 child_.get(), root_.get(), identity_matrix_, |
(...skipping 12 matching lines...) Expand all Loading... |
304 layer_tree_host()->SetRootLayer(root_); | 304 layer_tree_host()->SetRootLayer(root_); |
305 LayerTreeTest::SetupTree(); | 305 LayerTreeTest::SetupTree(); |
306 } | 306 } |
307 }; | 307 }; |
308 | 308 |
309 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity); | 309 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionOpacity); |
310 | 310 |
311 class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion | 311 class LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion |
312 : public LayerTreeHostOcclusionTest { | 312 : public LayerTreeHostOcclusionTest { |
313 public: | 313 public: |
314 virtual void SetupTree() OVERRIDE { | 314 virtual void SetupTree() override { |
315 // If the child layer with non-opaque opacity is below child2, then | 315 // If the child layer with non-opaque opacity is below child2, then |
316 // child2 should contribute to occlusion on everything, and child shouldn't | 316 // child2 should contribute to occlusion on everything, and child shouldn't |
317 // contribute to the root_. | 317 // contribute to the root_. |
318 SetLayerPropertiesForTesting( | 318 SetLayerPropertiesForTesting( |
319 root_.get(), NULL, identity_matrix_, | 319 root_.get(), NULL, identity_matrix_, |
320 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 320 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
321 SetLayerPropertiesForTesting( | 321 SetLayerPropertiesForTesting( |
322 child_.get(), root_.get(), identity_matrix_, | 322 child_.get(), root_.get(), identity_matrix_, |
323 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 323 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
324 SetLayerPropertiesForTesting( | 324 SetLayerPropertiesForTesting( |
(...skipping 15 matching lines...) Expand all Loading... |
340 LayerTreeTest::SetupTree(); | 340 LayerTreeTest::SetupTree(); |
341 } | 341 } |
342 }; | 342 }; |
343 | 343 |
344 SINGLE_AND_MULTI_THREAD_TEST_F( | 344 SINGLE_AND_MULTI_THREAD_TEST_F( |
345 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion); | 345 LayerTreeHostOcclusionTestOcclusionOpacityBelowOcclusion); |
346 | 346 |
347 class LayerTreeHostOcclusionTestOcclusionBlending | 347 class LayerTreeHostOcclusionTestOcclusionBlending |
348 : public LayerTreeHostOcclusionTest { | 348 : public LayerTreeHostOcclusionTest { |
349 public: | 349 public: |
350 virtual void SetupTree() OVERRIDE { | 350 virtual void SetupTree() override { |
351 // If the child layer has a blend mode, then it shouldn't | 351 // If the child layer has a blend mode, then it shouldn't |
352 // contribute to occlusion on stuff below it | 352 // contribute to occlusion on stuff below it |
353 SetLayerPropertiesForTesting( | 353 SetLayerPropertiesForTesting( |
354 root_.get(), NULL, identity_matrix_, | 354 root_.get(), NULL, identity_matrix_, |
355 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 355 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
356 SetLayerPropertiesForTesting( | 356 SetLayerPropertiesForTesting( |
357 child2_.get(), root_.get(), identity_matrix_, | 357 child2_.get(), root_.get(), identity_matrix_, |
358 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); | 358 gfx::PointF(20.f, 10.f), gfx::Size(10, 500), true); |
359 SetLayerPropertiesForTesting( | 359 SetLayerPropertiesForTesting( |
360 child_.get(), root_.get(), identity_matrix_, | 360 child_.get(), root_.get(), identity_matrix_, |
(...skipping 12 matching lines...) Expand all Loading... |
373 layer_tree_host()->SetRootLayer(root_); | 373 layer_tree_host()->SetRootLayer(root_); |
374 LayerTreeTest::SetupTree(); | 374 LayerTreeTest::SetupTree(); |
375 } | 375 } |
376 }; | 376 }; |
377 | 377 |
378 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending); | 378 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionBlending); |
379 | 379 |
380 class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion | 380 class LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion |
381 : public LayerTreeHostOcclusionTest { | 381 : public LayerTreeHostOcclusionTest { |
382 public: | 382 public: |
383 virtual void SetupTree() OVERRIDE { | 383 virtual void SetupTree() override { |
384 // If the child layer with a blend mode is below child2, then | 384 // If the child layer with a blend mode is below child2, then |
385 // child2 should contribute to occlusion on everything, and child shouldn't | 385 // child2 should contribute to occlusion on everything, and child shouldn't |
386 // contribute to the root_. | 386 // contribute to the root_. |
387 SetLayerPropertiesForTesting( | 387 SetLayerPropertiesForTesting( |
388 root_.get(), NULL, identity_matrix_, | 388 root_.get(), NULL, identity_matrix_, |
389 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 389 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
390 SetLayerPropertiesForTesting( | 390 SetLayerPropertiesForTesting( |
391 child_.get(), root_.get(), identity_matrix_, | 391 child_.get(), root_.get(), identity_matrix_, |
392 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); | 392 gfx::PointF(10.f, 10.f), gfx::Size(500, 500), true); |
393 SetLayerPropertiesForTesting( | 393 SetLayerPropertiesForTesting( |
(...skipping 14 matching lines...) Expand all Loading... |
408 LayerTreeTest::SetupTree(); | 408 LayerTreeTest::SetupTree(); |
409 } | 409 } |
410 }; | 410 }; |
411 | 411 |
412 SINGLE_AND_MULTI_THREAD_TEST_F( | 412 SINGLE_AND_MULTI_THREAD_TEST_F( |
413 LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion); | 413 LayerTreeHostOcclusionTestOcclusionBlendingBelowOcclusion); |
414 | 414 |
415 class LayerTreeHostOcclusionTestOcclusionOpacityFilter | 415 class LayerTreeHostOcclusionTestOcclusionOpacityFilter |
416 : public LayerTreeHostOcclusionTest { | 416 : public LayerTreeHostOcclusionTest { |
417 public: | 417 public: |
418 virtual void SetupTree() OVERRIDE { | 418 virtual void SetupTree() override { |
419 FilterOperations filters; | 419 FilterOperations filters; |
420 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); | 420 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
421 | 421 |
422 // If the child layer has a filter that changes alpha values, and is below | 422 // If the child layer has a filter that changes alpha values, and is below |
423 // child2, then child2 should contribute to occlusion on everything, | 423 // child2, then child2 should contribute to occlusion on everything, |
424 // and child shouldn't contribute to the root | 424 // and child shouldn't contribute to the root |
425 SetLayerPropertiesForTesting( | 425 SetLayerPropertiesForTesting( |
426 root_.get(), NULL, identity_matrix_, | 426 root_.get(), NULL, identity_matrix_, |
427 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); | 427 gfx::PointF(0.f, 0.f), gfx::Size(200, 200), true); |
428 SetLayerPropertiesForTesting(child_.get(), | 428 SetLayerPropertiesForTesting(child_.get(), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 LayerTreeTest::SetupTree(); | 460 LayerTreeTest::SetupTree(); |
461 } | 461 } |
462 }; | 462 }; |
463 | 463 |
464 SINGLE_AND_MULTI_THREAD_TEST_F( | 464 SINGLE_AND_MULTI_THREAD_TEST_F( |
465 LayerTreeHostOcclusionTestOcclusionOpacityFilter); | 465 LayerTreeHostOcclusionTestOcclusionOpacityFilter); |
466 | 466 |
467 class LayerTreeHostOcclusionTestOcclusionBlurFilter | 467 class LayerTreeHostOcclusionTestOcclusionBlurFilter |
468 : public LayerTreeHostOcclusionTest { | 468 : public LayerTreeHostOcclusionTest { |
469 public: | 469 public: |
470 virtual void SetupTree() OVERRIDE { | 470 virtual void SetupTree() override { |
471 gfx::Transform child_transform; | 471 gfx::Transform child_transform; |
472 child_transform.Translate(250.0, 250.0); | 472 child_transform.Translate(250.0, 250.0); |
473 child_transform.Rotate(90.0); | 473 child_transform.Rotate(90.0); |
474 child_transform.Translate(-250.0, -250.0); | 474 child_transform.Translate(-250.0, -250.0); |
475 | 475 |
476 FilterOperations filters; | 476 FilterOperations filters; |
477 filters.Append(FilterOperation::CreateBlurFilter(10.f)); | 477 filters.Append(FilterOperation::CreateBlurFilter(10.f)); |
478 | 478 |
479 // If the child layer has a filter that moves pixels/changes alpha, and is | 479 // If the child layer has a filter that moves pixels/changes alpha, and is |
480 // below child2, then child should not inherit occlusion from outside its | 480 // below child2, then child should not inherit occlusion from outside its |
(...skipping 23 matching lines...) Expand all Loading... |
504 }; | 504 }; |
505 | 505 |
506 SINGLE_AND_MULTI_THREAD_TEST_F( | 506 SINGLE_AND_MULTI_THREAD_TEST_F( |
507 LayerTreeHostOcclusionTestOcclusionBlurFilter); | 507 LayerTreeHostOcclusionTestOcclusionBlurFilter); |
508 | 508 |
509 class LayerTreeHostOcclusionTestOcclusionCopyRequest | 509 class LayerTreeHostOcclusionTestOcclusionCopyRequest |
510 : public LayerTreeHostOcclusionTest { | 510 : public LayerTreeHostOcclusionTest { |
511 public: | 511 public: |
512 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} | 512 static void CopyOutputCallback(scoped_ptr<CopyOutputResult> result) {} |
513 | 513 |
514 virtual void SetupTree() OVERRIDE { | 514 virtual void SetupTree() override { |
515 // If the child layer has copy request, and is below child2, | 515 // If the child layer has copy request, and is below child2, |
516 // then child should not inherit occlusion from outside its subtree. | 516 // then child should not inherit occlusion from outside its subtree. |
517 // The child layer will still receive occlusion from inside, and | 517 // The child layer will still receive occlusion from inside, and |
518 // the root layer will recive occlusion from child. | 518 // the root layer will recive occlusion from child. |
519 SetLayerPropertiesForTesting( | 519 SetLayerPropertiesForTesting( |
520 root_.get(), NULL, identity_matrix_, | 520 root_.get(), NULL, identity_matrix_, |
521 gfx::PointF(), gfx::Size(100, 100), true); | 521 gfx::PointF(), gfx::Size(100, 100), true); |
522 SetLayerPropertiesForTesting( | 522 SetLayerPropertiesForTesting( |
523 child_.get(), root_.get(), identity_matrix_, | 523 child_.get(), root_.get(), identity_matrix_, |
524 gfx::PointF(), gfx::Size(75, 75), true); | 524 gfx::PointF(), gfx::Size(75, 75), true); |
(...skipping 14 matching lines...) Expand all Loading... |
539 layer_tree_host()->SetRootLayer(root_); | 539 layer_tree_host()->SetRootLayer(root_); |
540 LayerTreeTest::SetupTree(); | 540 LayerTreeTest::SetupTree(); |
541 } | 541 } |
542 }; | 542 }; |
543 | 543 |
544 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionCopyRequest); | 544 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionCopyRequest); |
545 | 545 |
546 class LayerTreeHostOcclusionTestOcclusionReplica | 546 class LayerTreeHostOcclusionTestOcclusionReplica |
547 : public LayerTreeHostOcclusionTest { | 547 : public LayerTreeHostOcclusionTest { |
548 public: | 548 public: |
549 virtual void SetupTree() OVERRIDE { | 549 virtual void SetupTree() override { |
550 // If the child layer has copy request, and is below child2, | 550 // If the child layer has copy request, and is below child2, |
551 // then child should not inherit occlusion from outside its subtree. | 551 // then child should not inherit occlusion from outside its subtree. |
552 // The child layer will still receive occlusion from inside, and | 552 // The child layer will still receive occlusion from inside, and |
553 // the root layer will recive occlusion from child. | 553 // the root layer will recive occlusion from child. |
554 SetLayerPropertiesForTesting( | 554 SetLayerPropertiesForTesting( |
555 root_.get(), NULL, identity_matrix_, | 555 root_.get(), NULL, identity_matrix_, |
556 gfx::PointF(), gfx::Size(100, 100), true); | 556 gfx::PointF(), gfx::Size(100, 100), true); |
557 SetLayerPropertiesForTesting( | 557 SetLayerPropertiesForTesting( |
558 child_.get(), root_.get(), identity_matrix_, | 558 child_.get(), root_.get(), identity_matrix_, |
559 gfx::PointF(), gfx::Size(75, 75), true); | 559 gfx::PointF(), gfx::Size(75, 75), true); |
(...skipping 14 matching lines...) Expand all Loading... |
574 layer_tree_host()->SetRootLayer(root_); | 574 layer_tree_host()->SetRootLayer(root_); |
575 LayerTreeTest::SetupTree(); | 575 LayerTreeTest::SetupTree(); |
576 } | 576 } |
577 }; | 577 }; |
578 | 578 |
579 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionReplica); | 579 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestOcclusionReplica); |
580 | 580 |
581 class LayerTreeHostOcclusionTestManySurfaces | 581 class LayerTreeHostOcclusionTestManySurfaces |
582 : public LayerTreeHostOcclusionTest { | 582 : public LayerTreeHostOcclusionTest { |
583 public: | 583 public: |
584 virtual void SetupTree() OVERRIDE { | 584 virtual void SetupTree() override { |
585 // We create enough RenderSurfaces that it will trigger Vector reallocation | 585 // We create enough RenderSurfaces that it will trigger Vector reallocation |
586 // while computing occlusion. | 586 // while computing occlusion. |
587 std::vector<scoped_refptr<TestLayer> > layers; | 587 std::vector<scoped_refptr<TestLayer> > layers; |
588 int num_surfaces = 200; | 588 int num_surfaces = 200; |
589 int root_width = 400; | 589 int root_width = 400; |
590 int root_height = 400; | 590 int root_height = 400; |
591 | 591 |
592 for (int i = 0; i < num_surfaces; ++i) { | 592 for (int i = 0; i < num_surfaces; ++i) { |
593 layers.push_back(TestLayer::Create()); | 593 layers.push_back(TestLayer::Create()); |
594 if (i == 0) { | 594 if (i == 0) { |
(...skipping 25 matching lines...) Expand all Loading... |
620 | 620 |
621 layer_tree_host()->SetRootLayer(layers[0]); | 621 layer_tree_host()->SetRootLayer(layers[0]); |
622 LayerTreeTest::SetupTree(); | 622 LayerTreeTest::SetupTree(); |
623 } | 623 } |
624 }; | 624 }; |
625 | 625 |
626 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces); | 626 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostOcclusionTestManySurfaces); |
627 | 627 |
628 } // namespace | 628 } // namespace |
629 } // namespace cc | 629 } // namespace cc |
OLD | NEW |