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/layer_iterator.h" | 5 #include "cc/layer_iterator.h" |
6 | 6 |
7 #include "cc/layer.h" | 7 #include "cc/layer.h" |
8 #include "cc/layer_tree_host_common.h" | 8 #include "cc/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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 scoped_refptr<TestLayer> fourth = TestLayer::create(); | 121 scoped_refptr<TestLayer> fourth = TestLayer::create(); |
122 | 122 |
123 rootLayer->createRenderSurface(); | 123 rootLayer->createRenderSurface(); |
124 | 124 |
125 rootLayer->addChild(first); | 125 rootLayer->addChild(first); |
126 rootLayer->addChild(second); | 126 rootLayer->addChild(second); |
127 rootLayer->addChild(third); | 127 rootLayer->addChild(third); |
128 rootLayer->addChild(fourth); | 128 rootLayer->addChild(fourth); |
129 | 129 |
130 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 130 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
131 LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bou
nds(), 1, 1, 256, renderSurfaceLayerList); | 131 LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bou
nds(), 1, 1, 256, false, renderSurfaceLayerList); |
132 | 132 |
133 iterateBackToFront(&renderSurfaceLayerList); | 133 iterateBackToFront(&renderSurfaceLayerList); |
134 EXPECT_COUNT(rootLayer, 0, -1, 1); | 134 EXPECT_COUNT(rootLayer, 0, -1, 1); |
135 EXPECT_COUNT(first, -1, -1, 2); | 135 EXPECT_COUNT(first, -1, -1, 2); |
136 EXPECT_COUNT(second, -1, -1, 3); | 136 EXPECT_COUNT(second, -1, -1, 3); |
137 EXPECT_COUNT(third, -1, -1, 4); | 137 EXPECT_COUNT(third, -1, -1, 4); |
138 EXPECT_COUNT(fourth, -1, -1, 5); | 138 EXPECT_COUNT(fourth, -1, -1, 5); |
139 | 139 |
140 iterateFrontToBack(&renderSurfaceLayerList); | 140 iterateFrontToBack(&renderSurfaceLayerList); |
141 EXPECT_COUNT(rootLayer, 5, -1, 4); | 141 EXPECT_COUNT(rootLayer, 5, -1, 4); |
(...skipping 21 matching lines...) Expand all Loading... |
163 rootLayer->addChild(root1); | 163 rootLayer->addChild(root1); |
164 rootLayer->addChild(root2); | 164 rootLayer->addChild(root2); |
165 rootLayer->addChild(root3); | 165 rootLayer->addChild(root3); |
166 root2->addChild(root21); | 166 root2->addChild(root21); |
167 root2->addChild(root22); | 167 root2->addChild(root22); |
168 root2->addChild(root23); | 168 root2->addChild(root23); |
169 root22->addChild(root221); | 169 root22->addChild(root221); |
170 root23->addChild(root231); | 170 root23->addChild(root231); |
171 | 171 |
172 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 172 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
173 LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bou
nds(), 1, 1, 256, renderSurfaceLayerList); | 173 LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bou
nds(), 1, 1, 256, false, renderSurfaceLayerList); |
174 | 174 |
175 iterateBackToFront(&renderSurfaceLayerList); | 175 iterateBackToFront(&renderSurfaceLayerList); |
176 EXPECT_COUNT(rootLayer, 0, -1, 1); | 176 EXPECT_COUNT(rootLayer, 0, -1, 1); |
177 EXPECT_COUNT(root1, -1, -1, 2); | 177 EXPECT_COUNT(root1, -1, -1, 2); |
178 EXPECT_COUNT(root2, -1, -1, 3); | 178 EXPECT_COUNT(root2, -1, -1, 3); |
179 EXPECT_COUNT(root21, -1, -1, 4); | 179 EXPECT_COUNT(root21, -1, -1, 4); |
180 EXPECT_COUNT(root22, -1, -1, 5); | 180 EXPECT_COUNT(root22, -1, -1, 5); |
181 EXPECT_COUNT(root221, -1, -1, 6); | 181 EXPECT_COUNT(root221, -1, -1, 6); |
182 EXPECT_COUNT(root23, -1, -1, 7); | 182 EXPECT_COUNT(root23, -1, -1, 7); |
183 EXPECT_COUNT(root231, -1, -1, 8); | 183 EXPECT_COUNT(root231, -1, -1, 8); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 root2->setOpacity(0.5); // Force the layer to own a new surface. | 218 root2->setOpacity(0.5); // Force the layer to own a new surface. |
219 root2->addChild(root21); | 219 root2->addChild(root21); |
220 root2->addChild(root22); | 220 root2->addChild(root22); |
221 root2->addChild(root23); | 221 root2->addChild(root23); |
222 root22->setOpacity(0.5); | 222 root22->setOpacity(0.5); |
223 root22->addChild(root221); | 223 root22->addChild(root221); |
224 root23->setOpacity(0.5); | 224 root23->setOpacity(0.5); |
225 root23->addChild(root231); | 225 root23->addChild(root231); |
226 | 226 |
227 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; | 227 std::vector<scoped_refptr<Layer> > renderSurfaceLayerList; |
228 LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bou
nds(), 1, 1, 256, renderSurfaceLayerList); | 228 LayerTreeHostCommon::calculateDrawTransforms(rootLayer.get(), rootLayer->bou
nds(), 1, 1, 256, false, renderSurfaceLayerList); |
229 | 229 |
230 iterateBackToFront(&renderSurfaceLayerList); | 230 iterateBackToFront(&renderSurfaceLayerList); |
231 EXPECT_COUNT(rootLayer, 0, -1, 1); | 231 EXPECT_COUNT(rootLayer, 0, -1, 1); |
232 EXPECT_COUNT(root1, -1, -1, 2); | 232 EXPECT_COUNT(root1, -1, -1, 2); |
233 EXPECT_COUNT(root2, 4, 3, -1); | 233 EXPECT_COUNT(root2, 4, 3, -1); |
234 EXPECT_COUNT(root21, -1, -1, 5); | 234 EXPECT_COUNT(root21, -1, -1, 5); |
235 EXPECT_COUNT(root22, 7, 6, 8); | 235 EXPECT_COUNT(root22, 7, 6, 8); |
236 EXPECT_COUNT(root221, -1, -1, 9); | 236 EXPECT_COUNT(root221, -1, -1, 9); |
237 EXPECT_COUNT(root23, 11, 10, 12); | 237 EXPECT_COUNT(root23, 11, 10, 12); |
238 EXPECT_COUNT(root231, -1, -1, 13); | 238 EXPECT_COUNT(root231, -1, -1, 13); |
239 EXPECT_COUNT(root3, -1, -1, 14); | 239 EXPECT_COUNT(root3, -1, -1, 14); |
240 | 240 |
241 iterateFrontToBack(&renderSurfaceLayerList); | 241 iterateFrontToBack(&renderSurfaceLayerList); |
242 EXPECT_COUNT(rootLayer, 14, -1, 13); | 242 EXPECT_COUNT(rootLayer, 14, -1, 13); |
243 EXPECT_COUNT(root1, -1, -1, 12); | 243 EXPECT_COUNT(root1, -1, -1, 12); |
244 EXPECT_COUNT(root2, 10, 11, -1); | 244 EXPECT_COUNT(root2, 10, 11, -1); |
245 EXPECT_COUNT(root21, -1, -1, 9); | 245 EXPECT_COUNT(root21, -1, -1, 9); |
246 EXPECT_COUNT(root22, 7, 8, 6); | 246 EXPECT_COUNT(root22, 7, 8, 6); |
247 EXPECT_COUNT(root221, -1, -1, 5); | 247 EXPECT_COUNT(root221, -1, -1, 5); |
248 EXPECT_COUNT(root23, 3, 4, 2); | 248 EXPECT_COUNT(root23, 3, 4, 2); |
249 EXPECT_COUNT(root231, -1, -1, 1); | 249 EXPECT_COUNT(root231, -1, -1, 1); |
250 EXPECT_COUNT(root3, -1, -1, 0); | 250 EXPECT_COUNT(root3, -1, -1, 0); |
251 } | 251 } |
252 | 252 |
253 } // namespace | 253 } // namespace |
254 } // namespace cc | 254 } // namespace cc |
OLD | NEW |