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/layers/picture_layer.h" | 8 #include "cc/layers/picture_layer.h" |
9 #include "cc/test/fake_content_layer_client.h" | 9 #include "cc/test/fake_content_layer_client.h" |
10 #include "cc/test/layer_tree_test.h" | 10 #include "cc/test/layer_tree_test.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 root->SetBounds(gfx::Size(100, 100)); | 34 root->SetBounds(gfx::Size(100, 100)); |
35 root->SetIsDrawable(true); | 35 root->SetIsDrawable(true); |
36 | 36 |
37 child_ = Layer::Create(); | 37 child_ = Layer::Create(); |
38 child_->SetBounds(gfx::Size(50, 60)); | 38 child_->SetBounds(gfx::Size(50, 60)); |
39 child_->SetPosition(gfx::PointF(10.f, 5.5f)); | 39 child_->SetPosition(gfx::PointF(10.f, 5.5f)); |
40 child_->SetContentsOpaque(true); | 40 child_->SetContentsOpaque(true); |
41 child_->SetIsDrawable(true); | 41 child_->SetIsDrawable(true); |
42 root->AddChild(child_); | 42 root->AddChild(child_); |
43 | 43 |
44 layer_tree_host()->SetRootLayer(root); | 44 layer_tree()->SetRootLayer(root); |
45 LayerTreeTest::SetupTree(); | 45 LayerTreeTest::SetupTree(); |
46 } | 46 } |
47 | 47 |
48 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 48 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
49 | 49 |
50 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 50 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
51 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); | 51 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
52 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 52 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
53 | 53 |
54 // Verify the draw properties are valid. | 54 // Verify the draw properties are valid. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 child_->SetForceRenderSurfaceForTesting(true); | 90 child_->SetForceRenderSurfaceForTesting(true); |
91 root->AddChild(child_); | 91 root->AddChild(child_); |
92 | 92 |
93 scoped_refptr<Layer> child2 = Layer::Create(); | 93 scoped_refptr<Layer> child2 = Layer::Create(); |
94 child2->SetBounds(gfx::Size(10, 12)); | 94 child2->SetBounds(gfx::Size(10, 12)); |
95 child2->SetPosition(gfx::PointF(13.f, 8.5f)); | 95 child2->SetPosition(gfx::PointF(13.f, 8.5f)); |
96 child2->SetContentsOpaque(true); | 96 child2->SetContentsOpaque(true); |
97 child2->SetIsDrawable(true); | 97 child2->SetIsDrawable(true); |
98 root->AddChild(child2); | 98 root->AddChild(child2); |
99 | 99 |
100 layer_tree_host()->SetRootLayer(root); | 100 layer_tree()->SetRootLayer(root); |
101 LayerTreeTest::SetupTree(); | 101 LayerTreeTest::SetupTree(); |
102 } | 102 } |
103 | 103 |
104 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 104 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
105 | 105 |
106 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 106 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
107 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); | 107 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
108 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 108 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
109 RenderSurfaceImpl* surface = child->render_surface(); | 109 RenderSurfaceImpl* surface = child->render_surface(); |
110 | 110 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 mask->SetIsDrawable(true); | 156 mask->SetIsDrawable(true); |
157 child_->SetMaskLayer(mask.get()); | 157 child_->SetMaskLayer(mask.get()); |
158 | 158 |
159 scoped_refptr<Layer> child2 = Layer::Create(); | 159 scoped_refptr<Layer> child2 = Layer::Create(); |
160 child2->SetBounds(gfx::Size(10, 12)); | 160 child2->SetBounds(gfx::Size(10, 12)); |
161 child2->SetPosition(gfx::PointF(13.f, 8.5f)); | 161 child2->SetPosition(gfx::PointF(13.f, 8.5f)); |
162 child2->SetContentsOpaque(true); | 162 child2->SetContentsOpaque(true); |
163 child2->SetIsDrawable(true); | 163 child2->SetIsDrawable(true); |
164 root->AddChild(child2); | 164 root->AddChild(child2); |
165 | 165 |
166 layer_tree_host()->SetRootLayer(root); | 166 layer_tree()->SetRootLayer(root); |
167 LayerTreeTest::SetupTree(); | 167 LayerTreeTest::SetupTree(); |
168 client_.set_bounds(root->bounds()); | 168 client_.set_bounds(root->bounds()); |
169 } | 169 } |
170 | 170 |
171 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 171 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
172 | 172 |
173 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 173 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
174 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); | 174 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
175 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 175 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
176 RenderSurfaceImpl* surface = child->render_surface(); | 176 RenderSurfaceImpl* surface = child->render_surface(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 mask->SetIsDrawable(true); | 229 mask->SetIsDrawable(true); |
230 child_->SetMaskLayer(mask.get()); | 230 child_->SetMaskLayer(mask.get()); |
231 | 231 |
232 scoped_refptr<Layer> child2 = Layer::Create(); | 232 scoped_refptr<Layer> child2 = Layer::Create(); |
233 child2->SetBounds(gfx::Size(10, 11)); | 233 child2->SetBounds(gfx::Size(10, 11)); |
234 child2->SetPosition(gfx::PointF(13.f, 15.f)); | 234 child2->SetPosition(gfx::PointF(13.f, 15.f)); |
235 child2->SetContentsOpaque(true); | 235 child2->SetContentsOpaque(true); |
236 child2->SetIsDrawable(true); | 236 child2->SetIsDrawable(true); |
237 root->AddChild(child2); | 237 root->AddChild(child2); |
238 | 238 |
239 layer_tree_host()->SetRootLayer(root); | 239 layer_tree()->SetRootLayer(root); |
240 LayerTreeTest::SetupTree(); | 240 LayerTreeTest::SetupTree(); |
241 client_.set_bounds(root->bounds()); | 241 client_.set_bounds(root->bounds()); |
242 } | 242 } |
243 | 243 |
244 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 244 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
245 | 245 |
246 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 246 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
247 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 247 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
248 LayerImpl* mask = child->render_surface()->MaskLayer(); | 248 LayerImpl* mask = child->render_surface()->MaskLayer(); |
249 | 249 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 mask->SetIsDrawable(true); | 297 mask->SetIsDrawable(true); |
298 child_->SetMaskLayer(mask.get()); | 298 child_->SetMaskLayer(mask.get()); |
299 | 299 |
300 scoped_refptr<Layer> child2 = Layer::Create(); | 300 scoped_refptr<Layer> child2 = Layer::Create(); |
301 child2->SetBounds(gfx::Size(10, 12)); | 301 child2->SetBounds(gfx::Size(10, 12)); |
302 child2->SetPosition(gfx::PointF(13.f, 8.5f)); | 302 child2->SetPosition(gfx::PointF(13.f, 8.5f)); |
303 child2->SetContentsOpaque(true); | 303 child2->SetContentsOpaque(true); |
304 child2->SetIsDrawable(true); | 304 child2->SetIsDrawable(true); |
305 root->AddChild(child2); | 305 root->AddChild(child2); |
306 | 306 |
307 layer_tree_host()->SetRootLayer(root); | 307 layer_tree()->SetRootLayer(root); |
308 LayerTreeTest::SetupTree(); | 308 LayerTreeTest::SetupTree(); |
309 client_.set_bounds(root->bounds()); | 309 client_.set_bounds(root->bounds()); |
310 } | 310 } |
311 | 311 |
312 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 312 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
313 | 313 |
314 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { | 314 void DrawLayersOnThread(LayerTreeHostImpl* impl) override { |
315 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); | 315 LayerImpl* root = impl->active_tree()->root_layer_for_testing(); |
316 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); | 316 LayerImpl* child = impl->active_tree()->LayerById(child_->id()); |
317 RenderSurfaceImpl* surface = child->render_surface(); | 317 RenderSurfaceImpl* surface = child->render_surface(); |
(...skipping 24 matching lines...) Expand all Loading... |
342 private: | 342 private: |
343 FakeContentLayerClient client_; | 343 FakeContentLayerClient client_; |
344 scoped_refptr<Layer> child_; | 344 scoped_refptr<Layer> child_; |
345 }; | 345 }; |
346 | 346 |
347 SINGLE_AND_MULTI_THREAD_TEST_F( | 347 SINGLE_AND_MULTI_THREAD_TEST_F( |
348 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); | 348 LayerTreeHostOcclusionTestDrawPropertiesInsideReplica); |
349 | 349 |
350 } // namespace | 350 } // namespace |
351 } // namespace cc | 351 } // namespace cc |
OLD | NEW |