| 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/layers/layer_iterator.h" | 5 #include "cc/layers/layer_iterator.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/test/fake_layer_tree_host.h" | 10 #include "cc/test/fake_layer_tree_host.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 scoped_refptr<TestLayer> first = TestLayer::Create(); | 104 scoped_refptr<TestLayer> first = TestLayer::Create(); |
| 105 scoped_refptr<TestLayer> second = TestLayer::Create(); | 105 scoped_refptr<TestLayer> second = TestLayer::Create(); |
| 106 scoped_refptr<TestLayer> third = TestLayer::Create(); | 106 scoped_refptr<TestLayer> third = TestLayer::Create(); |
| 107 scoped_refptr<TestLayer> fourth = TestLayer::Create(); | 107 scoped_refptr<TestLayer> fourth = TestLayer::Create(); |
| 108 | 108 |
| 109 root_layer->AddChild(first); | 109 root_layer->AddChild(first); |
| 110 root_layer->AddChild(second); | 110 root_layer->AddChild(second); |
| 111 root_layer->AddChild(third); | 111 root_layer->AddChild(third); |
| 112 root_layer->AddChild(fourth); | 112 root_layer->AddChild(fourth); |
| 113 | 113 |
| 114 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 114 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
| 115 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | |
| 116 host->SetRootLayer(root_layer); | 115 host->SetRootLayer(root_layer); |
| 117 | 116 |
| 118 RenderSurfaceLayerList render_surface_layer_list; | 117 RenderSurfaceLayerList render_surface_layer_list; |
| 119 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 118 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 120 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); | 119 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); |
| 121 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 120 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 122 | 121 |
| 123 IterateFrontToBack(&render_surface_layer_list); | 122 IterateFrontToBack(&render_surface_layer_list); |
| 124 EXPECT_COUNT(root_layer, 5, -1, 4); | 123 EXPECT_COUNT(root_layer, 5, -1, 4); |
| 125 EXPECT_COUNT(first, -1, -1, 3); | 124 EXPECT_COUNT(first, -1, -1, 3); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 141 | 140 |
| 142 root_layer->AddChild(root1); | 141 root_layer->AddChild(root1); |
| 143 root_layer->AddChild(root2); | 142 root_layer->AddChild(root2); |
| 144 root_layer->AddChild(root3); | 143 root_layer->AddChild(root3); |
| 145 root2->AddChild(root21); | 144 root2->AddChild(root21); |
| 146 root2->AddChild(root22); | 145 root2->AddChild(root22); |
| 147 root2->AddChild(root23); | 146 root2->AddChild(root23); |
| 148 root22->AddChild(root221); | 147 root22->AddChild(root221); |
| 149 root23->AddChild(root231); | 148 root23->AddChild(root231); |
| 150 | 149 |
| 151 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 150 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
| 152 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | |
| 153 host->SetRootLayer(root_layer); | 151 host->SetRootLayer(root_layer); |
| 154 | 152 |
| 155 RenderSurfaceLayerList render_surface_layer_list; | 153 RenderSurfaceLayerList render_surface_layer_list; |
| 156 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 154 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 157 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); | 155 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); |
| 158 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 156 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 159 | 157 |
| 160 IterateFrontToBack(&render_surface_layer_list); | 158 IterateFrontToBack(&render_surface_layer_list); |
| 161 EXPECT_COUNT(root_layer, 9, -1, 8); | 159 EXPECT_COUNT(root_layer, 9, -1, 8); |
| 162 EXPECT_COUNT(root1, -1, -1, 7); | 160 EXPECT_COUNT(root1, -1, -1, 7); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 187 root2->SetOpacity(0.5f); | 185 root2->SetOpacity(0.5f); |
| 188 root2->SetForceRenderSurface(true); // Force the layer to own a new surface. | 186 root2->SetForceRenderSurface(true); // Force the layer to own a new surface. |
| 189 root2->AddChild(root21); | 187 root2->AddChild(root21); |
| 190 root2->AddChild(root22); | 188 root2->AddChild(root22); |
| 191 root2->AddChild(root23); | 189 root2->AddChild(root23); |
| 192 root22->SetOpacity(0.5f); | 190 root22->SetOpacity(0.5f); |
| 193 root22->AddChild(root221); | 191 root22->AddChild(root221); |
| 194 root23->SetOpacity(0.5f); | 192 root23->SetOpacity(0.5f); |
| 195 root23->AddChild(root231); | 193 root23->AddChild(root231); |
| 196 | 194 |
| 197 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 195 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(); |
| 198 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | |
| 199 host->SetRootLayer(root_layer); | 196 host->SetRootLayer(root_layer); |
| 200 | 197 |
| 201 RenderSurfaceLayerList render_surface_layer_list; | 198 RenderSurfaceLayerList render_surface_layer_list; |
| 202 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( | 199 LayerTreeHostCommon::CalcDrawPropsMainInputsForTesting inputs( |
| 203 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); | 200 root_layer.get(), root_layer->bounds(), &render_surface_layer_list); |
| 204 LayerTreeHostCommon::CalculateDrawProperties(&inputs); | 201 LayerTreeHostCommon::CalculateDrawProperties(&inputs); |
| 205 | 202 |
| 206 IterateFrontToBack(&render_surface_layer_list); | 203 IterateFrontToBack(&render_surface_layer_list); |
| 207 EXPECT_COUNT(root_layer, 14, -1, 13); | 204 EXPECT_COUNT(root_layer, 14, -1, 13); |
| 208 EXPECT_COUNT(root1, -1, -1, 12); | 205 EXPECT_COUNT(root1, -1, -1, 12); |
| 209 EXPECT_COUNT(root2, 10, 11, -1); | 206 EXPECT_COUNT(root2, 10, 11, -1); |
| 210 EXPECT_COUNT(root21, -1, -1, 9); | 207 EXPECT_COUNT(root21, -1, -1, 9); |
| 211 EXPECT_COUNT(root22, 7, 8, 6); | 208 EXPECT_COUNT(root22, 7, 8, 6); |
| 212 EXPECT_COUNT(root221, -1, -1, 5); | 209 EXPECT_COUNT(root221, -1, -1, 5); |
| 213 EXPECT_COUNT(root23, 3, 4, 2); | 210 EXPECT_COUNT(root23, 3, 4, 2); |
| 214 EXPECT_COUNT(root231, -1, -1, 1); | 211 EXPECT_COUNT(root231, -1, -1, 1); |
| 215 EXPECT_COUNT(root3, -1, -1, 0); | 212 EXPECT_COUNT(root3, -1, -1, 0); |
| 216 } | 213 } |
| 217 | 214 |
| 218 } // namespace | 215 } // namespace |
| 219 } // namespace cc | 216 } // namespace cc |
| OLD | NEW |