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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 pending_layer->SetDrawsContent(true); | 216 pending_layer->SetDrawsContent(true); |
217 } else { | 217 } else { |
218 pending_layer.reset(static_cast<FakePictureLayerImpl*>( | 218 pending_layer.reset(static_cast<FakePictureLayerImpl*>( |
219 pending_root->RemoveChild(pending_root->children()[0]).release())); | 219 pending_root->RemoveChild(pending_root->children()[0]).release())); |
220 if (!tile_size.IsEmpty()) | 220 if (!tile_size.IsEmpty()) |
221 pending_layer->set_fixed_tile_size(tile_size); | 221 pending_layer->set_fixed_tile_size(tile_size); |
222 } | 222 } |
223 pending_root->SetHasRenderSurface(true); | 223 pending_root->SetHasRenderSurface(true); |
224 // The bounds() just mirror the pile size. | 224 // The bounds() just mirror the pile size. |
225 pending_layer->SetBounds(raster_source->GetSize()); | 225 pending_layer->SetBounds(raster_source->GetSize()); |
226 pending_layer->SetContentBounds(raster_source->GetSize()); | |
227 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); | 226 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); |
228 | 227 |
229 pending_root->AddChild(pending_layer.Pass()); | 228 pending_root->AddChild(pending_layer.Pass()); |
230 pending_tree->SetRootLayer(pending_root.Pass()); | 229 pending_tree->SetRootLayer(pending_root.Pass()); |
231 | 230 |
232 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 231 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
233 host_impl_.pending_tree()->LayerById(id_)); | 232 host_impl_.pending_tree()->LayerById(id_)); |
234 | 233 |
235 // Add tilings/tiles for the layer. | 234 // Add tilings/tiles for the layer. |
236 bool update_lcd_text = false; | 235 bool update_lcd_text = false; |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); | 1287 EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), contents_scale); |
1289 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), | 1288 EXPECT_BOTH_EQ(LowResTiling()->contents_scale(), |
1290 contents_scale * low_res_factor); | 1289 contents_scale * low_res_factor); |
1291 EXPECT_BOTH_EQ(num_tilings(), 2u); | 1290 EXPECT_BOTH_EQ(num_tilings(), 2u); |
1292 | 1291 |
1293 // Mask layers dont create low res since they always fit on one tile. | 1292 // Mask layers dont create low res since they always fit on one tile. |
1294 scoped_ptr<FakePictureLayerImpl> mask = | 1293 scoped_ptr<FakePictureLayerImpl> mask = |
1295 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1294 FakePictureLayerImpl::CreateMaskWithRasterSource( |
1296 host_impl_.pending_tree(), 3, pending_pile); | 1295 host_impl_.pending_tree(), 3, pending_pile); |
1297 mask->SetBounds(layer_bounds); | 1296 mask->SetBounds(layer_bounds); |
1298 mask->SetContentBounds(layer_bounds); | |
1299 mask->SetDrawsContent(true); | 1297 mask->SetDrawsContent(true); |
1300 | 1298 |
1301 SetupDrawPropertiesAndUpdateTiles( | 1299 SetupDrawPropertiesAndUpdateTiles( |
1302 mask.get(), contents_scale, device_scale, page_scale, | 1300 mask.get(), contents_scale, device_scale, page_scale, |
1303 maximum_animation_scale, starting_animation_scale, animating_transform); | 1301 maximum_animation_scale, starting_animation_scale, animating_transform); |
1304 EXPECT_EQ(mask->HighResTiling()->contents_scale(), contents_scale); | 1302 EXPECT_EQ(mask->HighResTiling()->contents_scale(), contents_scale); |
1305 EXPECT_EQ(mask->num_tilings(), 1u); | 1303 EXPECT_EQ(mask->num_tilings(), 1u); |
1306 } | 1304 } |
1307 | 1305 |
1308 TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { | 1306 TEST_F(PictureLayerImplTest, HugeMasksGetScaledDown) { |
1309 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1307 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1310 | 1308 |
1311 gfx::Size tile_size(100, 100); | 1309 gfx::Size tile_size(100, 100); |
1312 gfx::Size layer_bounds(1000, 1000); | 1310 gfx::Size layer_bounds(1000, 1000); |
1313 | 1311 |
1314 scoped_refptr<FakePicturePileImpl> valid_pile = | 1312 scoped_refptr<FakePicturePileImpl> valid_pile = |
1315 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1313 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1316 SetupPendingTree(valid_pile); | 1314 SetupPendingTree(valid_pile); |
1317 | 1315 |
1318 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1316 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
1319 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1317 FakePictureLayerImpl::CreateMaskWithRasterSource( |
1320 host_impl_.pending_tree(), 3, valid_pile); | 1318 host_impl_.pending_tree(), 3, valid_pile); |
1321 mask_ptr->SetBounds(layer_bounds); | 1319 mask_ptr->SetBounds(layer_bounds); |
1322 mask_ptr->SetContentBounds(layer_bounds); | |
1323 mask_ptr->SetDrawsContent(true); | 1320 mask_ptr->SetDrawsContent(true); |
1324 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1321 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
1325 pending_layer_->SetHasRenderSurface(true); | 1322 pending_layer_->SetHasRenderSurface(true); |
1326 | 1323 |
1327 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1324 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1328 bool update_lcd_text = false; | 1325 bool update_lcd_text = false; |
1329 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1326 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1330 | 1327 |
1331 FakePictureLayerImpl* pending_mask = | 1328 FakePictureLayerImpl* pending_mask = |
1332 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1329 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 EXPECT_EQ(active_mask->bounds(), mask_texture_size); | 1361 EXPECT_EQ(active_mask->bounds(), mask_texture_size); |
1365 | 1362 |
1366 // Resize larger than the max texture size. | 1363 // Resize larger than the max texture size. |
1367 int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size; | 1364 int max_texture_size = host_impl_.GetRendererCapabilities().max_texture_size; |
1368 gfx::Size huge_bounds(max_texture_size + 1, 10); | 1365 gfx::Size huge_bounds(max_texture_size + 1, 10); |
1369 scoped_refptr<FakePicturePileImpl> huge_pile = | 1366 scoped_refptr<FakePicturePileImpl> huge_pile = |
1370 FakePicturePileImpl::CreateFilledPile(tile_size, huge_bounds); | 1367 FakePicturePileImpl::CreateFilledPile(tile_size, huge_bounds); |
1371 | 1368 |
1372 SetupPendingTree(huge_pile); | 1369 SetupPendingTree(huge_pile); |
1373 pending_mask->SetBounds(huge_bounds); | 1370 pending_mask->SetBounds(huge_bounds); |
1374 pending_mask->SetContentBounds(huge_bounds); | |
1375 pending_mask->SetRasterSourceOnPending(huge_pile, Region()); | 1371 pending_mask->SetRasterSourceOnPending(huge_pile, Region()); |
1376 | 1372 |
1377 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1373 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1378 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1374 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1379 | 1375 |
1380 // The mask tiling gets scaled down. | 1376 // The mask tiling gets scaled down. |
1381 EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f); | 1377 EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f); |
1382 EXPECT_EQ(1u, pending_mask->num_tilings()); | 1378 EXPECT_EQ(1u, pending_mask->num_tilings()); |
1383 | 1379 |
1384 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( | 1380 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 | 1413 |
1418 // Resize even larger, so that the scale would be smaller than the minimum | 1414 // Resize even larger, so that the scale would be smaller than the minimum |
1419 // contents scale. Then the layer should no longer have any tiling. | 1415 // contents scale. Then the layer should no longer have any tiling. |
1420 float min_contents_scale = host_impl_.settings().minimum_contents_scale; | 1416 float min_contents_scale = host_impl_.settings().minimum_contents_scale; |
1421 gfx::Size extra_huge_bounds(max_texture_size / min_contents_scale + 1, 10); | 1417 gfx::Size extra_huge_bounds(max_texture_size / min_contents_scale + 1, 10); |
1422 scoped_refptr<FakePicturePileImpl> extra_huge_pile = | 1418 scoped_refptr<FakePicturePileImpl> extra_huge_pile = |
1423 FakePicturePileImpl::CreateFilledPile(tile_size, extra_huge_bounds); | 1419 FakePicturePileImpl::CreateFilledPile(tile_size, extra_huge_bounds); |
1424 | 1420 |
1425 SetupPendingTree(extra_huge_pile); | 1421 SetupPendingTree(extra_huge_pile); |
1426 pending_mask->SetBounds(extra_huge_bounds); | 1422 pending_mask->SetBounds(extra_huge_bounds); |
1427 pending_mask->SetContentBounds(extra_huge_bounds); | |
1428 pending_mask->SetRasterSourceOnPending(extra_huge_pile, Region()); | 1423 pending_mask->SetRasterSourceOnPending(extra_huge_pile, Region()); |
1429 | 1424 |
1430 EXPECT_FALSE(pending_mask->CanHaveTilings()); | 1425 EXPECT_FALSE(pending_mask->CanHaveTilings()); |
1431 | 1426 |
1432 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1427 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1433 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1428 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1434 | 1429 |
1435 EXPECT_EQ(0u, pending_mask->num_tilings()); | 1430 EXPECT_EQ(0u, pending_mask->num_tilings()); |
1436 } | 1431 } |
1437 | 1432 |
1438 TEST_F(PictureLayerImplTest, ScaledMaskLayer) { | 1433 TEST_F(PictureLayerImplTest, ScaledMaskLayer) { |
1439 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1434 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1440 | 1435 |
1441 gfx::Size tile_size(100, 100); | 1436 gfx::Size tile_size(100, 100); |
1442 gfx::Size layer_bounds(1000, 1000); | 1437 gfx::Size layer_bounds(1000, 1000); |
1443 | 1438 |
1444 host_impl_.SetDeviceScaleFactor(1.3f); | 1439 host_impl_.SetDeviceScaleFactor(1.3f); |
1445 | 1440 |
1446 scoped_refptr<FakePicturePileImpl> valid_pile = | 1441 scoped_refptr<FakePicturePileImpl> valid_pile = |
1447 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1442 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
1448 SetupPendingTree(valid_pile); | 1443 SetupPendingTree(valid_pile); |
1449 | 1444 |
1450 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1445 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
1451 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1446 FakePictureLayerImpl::CreateMaskWithRasterSource( |
1452 host_impl_.pending_tree(), 3, valid_pile); | 1447 host_impl_.pending_tree(), 3, valid_pile); |
1453 mask_ptr->SetBounds(layer_bounds); | 1448 mask_ptr->SetBounds(layer_bounds); |
1454 mask_ptr->SetContentBounds(layer_bounds); | |
1455 mask_ptr->SetDrawsContent(true); | 1449 mask_ptr->SetDrawsContent(true); |
1456 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1450 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
1457 pending_layer_->SetHasRenderSurface(true); | 1451 pending_layer_->SetHasRenderSurface(true); |
1458 | 1452 |
1459 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1453 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1460 bool update_lcd_text = false; | 1454 bool update_lcd_text = false; |
1461 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1455 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1462 | 1456 |
1463 FakePictureLayerImpl* pending_mask = | 1457 FakePictureLayerImpl* pending_mask = |
1464 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1458 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
(...skipping 2504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3969 if (tile_is_visible) | 3963 if (tile_is_visible) |
3970 unoccluded_tile_count++; | 3964 unoccluded_tile_count++; |
3971 queue->Pop(); | 3965 queue->Pop(); |
3972 } | 3966 } |
3973 EXPECT_EQ(unoccluded_tile_count, 25); | 3967 EXPECT_EQ(unoccluded_tile_count, 25); |
3974 | 3968 |
3975 // Partial occlusion. | 3969 // Partial occlusion. |
3976 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); | 3970 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); |
3977 LayerImpl* layer1 = pending_layer_->children()[0]; | 3971 LayerImpl* layer1 = pending_layer_->children()[0]; |
3978 layer1->SetBounds(layer_bounds); | 3972 layer1->SetBounds(layer_bounds); |
3979 layer1->SetContentBounds(layer_bounds); | |
3980 layer1->SetDrawsContent(true); | 3973 layer1->SetDrawsContent(true); |
3981 layer1->SetContentsOpaque(true); | 3974 layer1->SetContentsOpaque(true); |
3982 layer1->SetPosition(occluding_layer_position); | 3975 layer1->SetPosition(occluding_layer_position); |
3983 | 3976 |
3984 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); | 3977 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); |
3985 bool update_lcd_text = false; | 3978 bool update_lcd_text = false; |
3986 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 3979 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
3987 | 3980 |
3988 unoccluded_tile_count = 0; | 3981 unoccluded_tile_count = 0; |
3989 queue.reset(new TilingSetRasterQueueAll( | 3982 queue.reset(new TilingSetRasterQueueAll( |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4065 occluded_tile_count++; | 4058 occluded_tile_count++; |
4066 } | 4059 } |
4067 } | 4060 } |
4068 EXPECT_EQ(occluded_tile_count, 0); | 4061 EXPECT_EQ(occluded_tile_count, 0); |
4069 } | 4062 } |
4070 | 4063 |
4071 // Partial occlusion. | 4064 // Partial occlusion. |
4072 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); | 4065 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); |
4073 LayerImpl* layer1 = pending_layer_->children()[0]; | 4066 LayerImpl* layer1 = pending_layer_->children()[0]; |
4074 layer1->SetBounds(layer_bounds); | 4067 layer1->SetBounds(layer_bounds); |
4075 layer1->SetContentBounds(layer_bounds); | |
4076 layer1->SetDrawsContent(true); | 4068 layer1->SetDrawsContent(true); |
4077 layer1->SetContentsOpaque(true); | 4069 layer1->SetContentsOpaque(true); |
4078 layer1->SetPosition(occluding_layer_position); | 4070 layer1->SetPosition(occluding_layer_position); |
4079 | 4071 |
4080 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); | 4072 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(200)); |
4081 bool update_lcd_text = false; | 4073 bool update_lcd_text = false; |
4082 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 4074 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
4083 | 4075 |
4084 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 4076 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
4085 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 4077 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4166 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4158 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4167 | 4159 |
4168 host_impl_.SetViewportSize(viewport_size); | 4160 host_impl_.SetViewportSize(viewport_size); |
4169 | 4161 |
4170 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); | 4162 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, Region()); |
4171 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | 4163 ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
4172 | 4164 |
4173 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); | 4165 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 1)); |
4174 LayerImpl* layer1 = pending_layer_->children()[0]; | 4166 LayerImpl* layer1 = pending_layer_->children()[0]; |
4175 layer1->SetBounds(layer_bounds); | 4167 layer1->SetBounds(layer_bounds); |
4176 layer1->SetContentBounds(layer_bounds); | |
4177 layer1->SetDrawsContent(true); | 4168 layer1->SetDrawsContent(true); |
4178 layer1->SetContentsOpaque(true); | 4169 layer1->SetContentsOpaque(true); |
4179 layer1->SetPosition(occluding_layer_position); | 4170 layer1->SetPosition(occluding_layer_position); |
4180 | 4171 |
4181 pending_layer_->tilings()->RemoveAllTilings(); | 4172 pending_layer_->tilings()->RemoveAllTilings(); |
4182 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; | 4173 float low_res_factor = host_impl_.settings().low_res_contents_scale_factor; |
4183 pending_layer_->AddTiling(low_res_factor); | 4174 pending_layer_->AddTiling(low_res_factor); |
4184 pending_layer_->AddTiling(0.3f); | 4175 pending_layer_->AddTiling(0.3f); |
4185 pending_layer_->AddTiling(0.7f); | 4176 pending_layer_->AddTiling(0.7f); |
4186 pending_layer_->AddTiling(1.0f); | 4177 pending_layer_->AddTiling(1.0f); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4242 scoped_refptr<FakePicturePileImpl> active_pile = | 4233 scoped_refptr<FakePicturePileImpl> active_pile = |
4243 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4234 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4244 | 4235 |
4245 host_impl_.SetViewportSize(viewport_size); | 4236 host_impl_.SetViewportSize(viewport_size); |
4246 SetupPendingTree(active_pile); | 4237 SetupPendingTree(active_pile); |
4247 | 4238 |
4248 // Partially occlude the active layer. | 4239 // Partially occlude the active layer. |
4249 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2)); | 4240 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2)); |
4250 LayerImpl* layer1 = pending_layer_->children()[0]; | 4241 LayerImpl* layer1 = pending_layer_->children()[0]; |
4251 layer1->SetBounds(layer_bounds); | 4242 layer1->SetBounds(layer_bounds); |
4252 layer1->SetContentBounds(layer_bounds); | |
4253 layer1->SetDrawsContent(true); | 4243 layer1->SetDrawsContent(true); |
4254 layer1->SetContentsOpaque(true); | 4244 layer1->SetContentsOpaque(true); |
4255 layer1->SetPosition(occluding_layer_position); | 4245 layer1->SetPosition(occluding_layer_position); |
4256 | 4246 |
4257 ActivateTree(); | 4247 ActivateTree(); |
4258 | 4248 |
4259 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { | 4249 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { |
4260 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); | 4250 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); |
4261 auto prioritized_tiles = | 4251 auto prioritized_tiles = |
4262 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 4252 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4336 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4326 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4337 scoped_refptr<FakePicturePileImpl> active_pile = | 4327 scoped_refptr<FakePicturePileImpl> active_pile = |
4338 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 4328 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
4339 | 4329 |
4340 SetupPendingTreeWithFixedTileSize(active_pile, tile_size, Region()); | 4330 SetupPendingTreeWithFixedTileSize(active_pile, tile_size, Region()); |
4341 | 4331 |
4342 // Partially occlude the active layer. | 4332 // Partially occlude the active layer. |
4343 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2)); | 4333 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 2)); |
4344 LayerImpl* active_occluding_layer = pending_layer_->children()[0]; | 4334 LayerImpl* active_occluding_layer = pending_layer_->children()[0]; |
4345 active_occluding_layer->SetBounds(layer_bounds); | 4335 active_occluding_layer->SetBounds(layer_bounds); |
4346 active_occluding_layer->SetContentBounds(layer_bounds); | |
4347 active_occluding_layer->SetDrawsContent(true); | 4336 active_occluding_layer->SetDrawsContent(true); |
4348 active_occluding_layer->SetContentsOpaque(true); | 4337 active_occluding_layer->SetContentsOpaque(true); |
4349 active_occluding_layer->SetPosition(active_occluding_layer_position); | 4338 active_occluding_layer->SetPosition(active_occluding_layer_position); |
4350 | 4339 |
4351 ActivateTree(); | 4340 ActivateTree(); |
4352 | 4341 |
4353 // Partially invalidate the pending layer. Tiles inside the invalidation rect | 4342 // Partially invalidate the pending layer. Tiles inside the invalidation rect |
4354 // are created. | 4343 // are created. |
4355 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, invalidation_rect); | 4344 SetupPendingTreeWithFixedTileSize(pending_pile, tile_size, invalidation_rect); |
4356 | 4345 |
4357 // Partially occlude the pending layer in a different way. | 4346 // Partially occlude the pending layer in a different way. |
4358 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 3)); | 4347 pending_layer_->AddChild(LayerImpl::Create(host_impl_.pending_tree(), 3)); |
4359 LayerImpl* pending_occluding_layer = pending_layer_->children()[0]; | 4348 LayerImpl* pending_occluding_layer = pending_layer_->children()[0]; |
4360 pending_occluding_layer->SetBounds(layer_bounds); | 4349 pending_occluding_layer->SetBounds(layer_bounds); |
4361 pending_occluding_layer->SetContentBounds(layer_bounds); | |
4362 pending_occluding_layer->SetDrawsContent(true); | 4350 pending_occluding_layer->SetDrawsContent(true); |
4363 pending_occluding_layer->SetContentsOpaque(true); | 4351 pending_occluding_layer->SetContentsOpaque(true); |
4364 pending_occluding_layer->SetPosition(pending_occluding_layer_position); | 4352 pending_occluding_layer->SetPosition(pending_occluding_layer_position); |
4365 | 4353 |
4366 EXPECT_EQ(2u, pending_layer_->num_tilings()); | 4354 EXPECT_EQ(2u, pending_layer_->num_tilings()); |
4367 EXPECT_EQ(2u, active_layer_->num_tilings()); | 4355 EXPECT_EQ(2u, active_layer_->num_tilings()); |
4368 | 4356 |
4369 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 4357 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
4370 // UpdateDrawProperties with the occluding layer. | 4358 // UpdateDrawProperties with the occluding layer. |
4371 bool update_lcd_text = false; | 4359 bool update_lcd_text = false; |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4983 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4971 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4984 EXPECT_EQ(result.width(), 448); | 4972 EXPECT_EQ(result.width(), 448); |
4985 EXPECT_EQ(result.height(), 448); | 4973 EXPECT_EQ(result.height(), 448); |
4986 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4974 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4987 EXPECT_EQ(result.width(), 512); | 4975 EXPECT_EQ(result.width(), 512); |
4988 EXPECT_EQ(result.height(), 500 + 2); | 4976 EXPECT_EQ(result.height(), 500 + 2); |
4989 } | 4977 } |
4990 | 4978 |
4991 } // namespace | 4979 } // namespace |
4992 } // namespace cc | 4980 } // namespace cc |
OLD | NEW |