| 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 "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "cc/trees/layer_tree_host_common.h" | 8 #include "cc/trees/layer_tree_host_common.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 scoped_refptr<TestLayer> fourth = TestLayer::Create(); | 130 scoped_refptr<TestLayer> fourth = TestLayer::Create(); |
| 131 | 131 |
| 132 root_layer->CreateRenderSurface(); | 132 root_layer->CreateRenderSurface(); |
| 133 | 133 |
| 134 root_layer->AddChild(first); | 134 root_layer->AddChild(first); |
| 135 root_layer->AddChild(second); | 135 root_layer->AddChild(second); |
| 136 root_layer->AddChild(third); | 136 root_layer->AddChild(third); |
| 137 root_layer->AddChild(fourth); | 137 root_layer->AddChild(fourth); |
| 138 | 138 |
| 139 std::vector<scoped_refptr<Layer> > render_surface_layerList; | 139 std::vector<scoped_refptr<Layer> > render_surface_layerList; |
| 140 LayerTreeHostCommon::CalculateDrawProperties(root_layer.get(), | 140 LayerTreeHostCommon::calculateDrawProperties(root_layer.get(), |
| 141 root_layer->bounds(), | 141 root_layer->bounds(), |
| 142 1, | 142 1, |
| 143 1, | 143 1, |
| 144 256, | 144 256, |
| 145 false, | 145 false, |
| 146 &render_surface_layerList); | 146 render_surface_layerList); |
| 147 | 147 |
| 148 IterateBackToFront(&render_surface_layerList); | 148 IterateBackToFront(&render_surface_layerList); |
| 149 EXPECT_COUNT(root_layer, 0, -1, 1); | 149 EXPECT_COUNT(root_layer, 0, -1, 1); |
| 150 EXPECT_COUNT(first, -1, -1, 2); | 150 EXPECT_COUNT(first, -1, -1, 2); |
| 151 EXPECT_COUNT(second, -1, -1, 3); | 151 EXPECT_COUNT(second, -1, -1, 3); |
| 152 EXPECT_COUNT(third, -1, -1, 4); | 152 EXPECT_COUNT(third, -1, -1, 4); |
| 153 EXPECT_COUNT(fourth, -1, -1, 5); | 153 EXPECT_COUNT(fourth, -1, -1, 5); |
| 154 | 154 |
| 155 IterateFrontToBack(&render_surface_layerList); | 155 IterateFrontToBack(&render_surface_layerList); |
| 156 EXPECT_COUNT(root_layer, 5, -1, 4); | 156 EXPECT_COUNT(root_layer, 5, -1, 4); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 177 root_layer->AddChild(root1); | 177 root_layer->AddChild(root1); |
| 178 root_layer->AddChild(root2); | 178 root_layer->AddChild(root2); |
| 179 root_layer->AddChild(root3); | 179 root_layer->AddChild(root3); |
| 180 root2->AddChild(root21); | 180 root2->AddChild(root21); |
| 181 root2->AddChild(root22); | 181 root2->AddChild(root22); |
| 182 root2->AddChild(root23); | 182 root2->AddChild(root23); |
| 183 root22->AddChild(root221); | 183 root22->AddChild(root221); |
| 184 root23->AddChild(root231); | 184 root23->AddChild(root231); |
| 185 | 185 |
| 186 std::vector<scoped_refptr<Layer> > render_surface_layerList; | 186 std::vector<scoped_refptr<Layer> > render_surface_layerList; |
| 187 LayerTreeHostCommon::CalculateDrawProperties(root_layer.get(), | 187 LayerTreeHostCommon::calculateDrawProperties(root_layer.get(), |
| 188 root_layer->bounds(), | 188 root_layer->bounds(), |
| 189 1, | 189 1, |
| 190 1, | 190 1, |
| 191 256, | 191 256, |
| 192 false, | 192 false, |
| 193 &render_surface_layerList); | 193 render_surface_layerList); |
| 194 | 194 |
| 195 IterateBackToFront(&render_surface_layerList); | 195 IterateBackToFront(&render_surface_layerList); |
| 196 EXPECT_COUNT(root_layer, 0, -1, 1); | 196 EXPECT_COUNT(root_layer, 0, -1, 1); |
| 197 EXPECT_COUNT(root1, -1, -1, 2); | 197 EXPECT_COUNT(root1, -1, -1, 2); |
| 198 EXPECT_COUNT(root2, -1, -1, 3); | 198 EXPECT_COUNT(root2, -1, -1, 3); |
| 199 EXPECT_COUNT(root21, -1, -1, 4); | 199 EXPECT_COUNT(root21, -1, -1, 4); |
| 200 EXPECT_COUNT(root22, -1, -1, 5); | 200 EXPECT_COUNT(root22, -1, -1, 5); |
| 201 EXPECT_COUNT(root221, -1, -1, 6); | 201 EXPECT_COUNT(root221, -1, -1, 6); |
| 202 EXPECT_COUNT(root23, -1, -1, 7); | 202 EXPECT_COUNT(root23, -1, -1, 7); |
| 203 EXPECT_COUNT(root231, -1, -1, 8); | 203 EXPECT_COUNT(root231, -1, -1, 8); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 root2->SetForceRenderSurface(true); // Force the layer to own a new surface. | 239 root2->SetForceRenderSurface(true); // Force the layer to own a new surface. |
| 240 root2->AddChild(root21); | 240 root2->AddChild(root21); |
| 241 root2->AddChild(root22); | 241 root2->AddChild(root22); |
| 242 root2->AddChild(root23); | 242 root2->AddChild(root23); |
| 243 root22->SetOpacity(0.5f); | 243 root22->SetOpacity(0.5f); |
| 244 root22->AddChild(root221); | 244 root22->AddChild(root221); |
| 245 root23->SetOpacity(0.5f); | 245 root23->SetOpacity(0.5f); |
| 246 root23->AddChild(root231); | 246 root23->AddChild(root231); |
| 247 | 247 |
| 248 std::vector<scoped_refptr<Layer> > render_surface_layerList; | 248 std::vector<scoped_refptr<Layer> > render_surface_layerList; |
| 249 LayerTreeHostCommon::CalculateDrawProperties(root_layer.get(), | 249 LayerTreeHostCommon::calculateDrawProperties(root_layer.get(), |
| 250 root_layer->bounds(), | 250 root_layer->bounds(), |
| 251 1, | 251 1, |
| 252 1, | 252 1, |
| 253 256, | 253 256, |
| 254 false, | 254 false, |
| 255 &render_surface_layerList); | 255 render_surface_layerList); |
| 256 | 256 |
| 257 IterateBackToFront(&render_surface_layerList); | 257 IterateBackToFront(&render_surface_layerList); |
| 258 EXPECT_COUNT(root_layer, 0, -1, 1); | 258 EXPECT_COUNT(root_layer, 0, -1, 1); |
| 259 EXPECT_COUNT(root1, -1, -1, 2); | 259 EXPECT_COUNT(root1, -1, -1, 2); |
| 260 EXPECT_COUNT(root2, 4, 3, -1); | 260 EXPECT_COUNT(root2, 4, 3, -1); |
| 261 EXPECT_COUNT(root21, -1, -1, 5); | 261 EXPECT_COUNT(root21, -1, -1, 5); |
| 262 EXPECT_COUNT(root22, 7, 6, 8); | 262 EXPECT_COUNT(root22, 7, 6, 8); |
| 263 EXPECT_COUNT(root221, -1, -1, 9); | 263 EXPECT_COUNT(root221, -1, -1, 9); |
| 264 EXPECT_COUNT(root23, 11, 10, 12); | 264 EXPECT_COUNT(root23, 11, 10, 12); |
| 265 EXPECT_COUNT(root231, -1, -1, 13); | 265 EXPECT_COUNT(root231, -1, -1, 13); |
| 266 EXPECT_COUNT(root3, -1, -1, 14); | 266 EXPECT_COUNT(root3, -1, -1, 14); |
| 267 | 267 |
| 268 IterateFrontToBack(&render_surface_layerList); | 268 IterateFrontToBack(&render_surface_layerList); |
| 269 EXPECT_COUNT(root_layer, 14, -1, 13); | 269 EXPECT_COUNT(root_layer, 14, -1, 13); |
| 270 EXPECT_COUNT(root1, -1, -1, 12); | 270 EXPECT_COUNT(root1, -1, -1, 12); |
| 271 EXPECT_COUNT(root2, 10, 11, -1); | 271 EXPECT_COUNT(root2, 10, 11, -1); |
| 272 EXPECT_COUNT(root21, -1, -1, 9); | 272 EXPECT_COUNT(root21, -1, -1, 9); |
| 273 EXPECT_COUNT(root22, 7, 8, 6); | 273 EXPECT_COUNT(root22, 7, 8, 6); |
| 274 EXPECT_COUNT(root221, -1, -1, 5); | 274 EXPECT_COUNT(root221, -1, -1, 5); |
| 275 EXPECT_COUNT(root23, 3, 4, 2); | 275 EXPECT_COUNT(root23, 3, 4, 2); |
| 276 EXPECT_COUNT(root231, -1, -1, 1); | 276 EXPECT_COUNT(root231, -1, -1, 1); |
| 277 EXPECT_COUNT(root3, -1, -1, 0); | 277 EXPECT_COUNT(root3, -1, -1, 0); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace | 280 } // namespace |
| 281 } // namespace cc | 281 } // namespace cc |
| OLD | NEW |