OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "cc/debug/test_web_graphics_context_3d.h" | 9 #include "cc/debug/test_web_graphics_context_3d.h" |
10 #include "cc/layers/append_quads_data.h" | 10 #include "cc/layers/append_quads_data.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 EXPECT_EQ(pending_layer_->tilings()->num_tilings(), | 235 EXPECT_EQ(pending_layer_->tilings()->num_tilings(), |
236 active_layer_->tilings()->num_tilings()); | 236 active_layer_->tilings()->num_tilings()); |
237 | 237 |
238 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); | 238 const PictureLayerTilingSet* tilings = pending_layer_->tilings(); |
239 EXPECT_GT(tilings->num_tilings(), 0u); | 239 EXPECT_GT(tilings->num_tilings(), 0u); |
240 for (size_t i = 0; i < tilings->num_tilings(); ++i) | 240 for (size_t i = 0; i < tilings->num_tilings(); ++i) |
241 VerifyAllTilesExistAndHavePile(tilings->tiling_at(i), active_pile.get()); | 241 VerifyAllTilesExistAndHavePile(tilings->tiling_at(i), active_pile.get()); |
242 } | 242 } |
243 | 243 |
| 244 TEST_F(PictureLayerImplTest, SuppressUpdateTilePriorities) { |
| 245 gfx::Size tile_size(100, 100); |
| 246 gfx::Size layer_bounds(400, 400); |
| 247 |
| 248 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 249 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 250 scoped_refptr<FakePicturePileImpl> active_pile = |
| 251 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 252 |
| 253 SetupTrees(pending_pile, active_pile); |
| 254 |
| 255 Region invalidation; |
| 256 AddDefaultTilingsWithInvalidation(invalidation); |
| 257 EXPECT_TRUE(host_impl_.manage_tiles_needed()); |
| 258 host_impl_.ManageTiles(); |
| 259 EXPECT_FALSE(host_impl_.manage_tiles_needed()); |
| 260 |
| 261 // Setting this boolean should cause an early out in UpdateTilePriorities. |
| 262 bool valid_for_tile_management = false; |
| 263 host_impl_.SetExternalDrawConstraints(gfx::Transform(), |
| 264 gfx::Rect(layer_bounds), |
| 265 gfx::Rect(layer_bounds), |
| 266 valid_for_tile_management); |
| 267 active_layer_->UpdateTilePriorities(); |
| 268 EXPECT_FALSE(host_impl_.manage_tiles_needed()); |
| 269 |
| 270 valid_for_tile_management = true; |
| 271 host_impl_.SetExternalDrawConstraints(gfx::Transform(), |
| 272 gfx::Rect(layer_bounds), |
| 273 gfx::Rect(layer_bounds), |
| 274 valid_for_tile_management); |
| 275 active_layer_->UpdateTilePriorities(); |
| 276 EXPECT_TRUE(host_impl_.manage_tiles_needed()); |
| 277 } |
| 278 |
244 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { | 279 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { |
245 gfx::Size tile_size(100, 100); | 280 gfx::Size tile_size(100, 100); |
246 gfx::Size layer_bounds(400, 400); | 281 gfx::Size layer_bounds(400, 400); |
247 gfx::Rect layer_invalidation(150, 200, 30, 180); | 282 gfx::Rect layer_invalidation(150, 200, 30, 180); |
248 | 283 |
249 scoped_refptr<FakePicturePileImpl> pending_pile = | 284 scoped_refptr<FakePicturePileImpl> pending_pile = |
250 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 285 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
251 scoped_refptr<FakePicturePileImpl> active_pile = | 286 scoped_refptr<FakePicturePileImpl> active_pile = |
252 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 287 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
253 | 288 |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 active_layer_ = static_cast<FakePictureLayerImpl*>( | 1072 active_layer_ = static_cast<FakePictureLayerImpl*>( |
1038 host_impl_.active_tree()->LayerById(id_)); | 1073 host_impl_.active_tree()->LayerById(id_)); |
1039 | 1074 |
1040 EXPECT_EQ(0u, active_layer_->num_tilings()); | 1075 EXPECT_EQ(0u, active_layer_->num_tilings()); |
1041 EXPECT_EQ(!default_lcd_text_setting, active_layer_->is_using_lcd_text()); | 1076 EXPECT_EQ(!default_lcd_text_setting, active_layer_->is_using_lcd_text()); |
1042 EXPECT_FALSE(active_layer_->needs_post_commit_initialization()); | 1077 EXPECT_FALSE(active_layer_->needs_post_commit_initialization()); |
1043 } | 1078 } |
1044 | 1079 |
1045 } // namespace | 1080 } // namespace |
1046 } // namespace cc | 1081 } // namespace cc |
OLD | NEW |