| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 | 121 |
| 122 void ActivateTree() { | 122 void ActivateTree() { |
| 123 host_impl_.ActivateSyncTree(); | 123 host_impl_.ActivateSyncTree(); |
| 124 CHECK(!host_impl_.pending_tree()); | 124 CHECK(!host_impl_.pending_tree()); |
| 125 CHECK(host_impl_.recycle_tree()); | 125 CHECK(host_impl_.recycle_tree()); |
| 126 old_pending_layer_ = pending_layer_; | 126 old_pending_layer_ = pending_layer_; |
| 127 pending_layer_ = nullptr; | 127 pending_layer_ = nullptr; |
| 128 active_layer_ = static_cast<FakePictureLayerImpl*>( | 128 active_layer_ = static_cast<FakePictureLayerImpl*>( |
| 129 host_impl_.active_tree()->LayerById(id_)); | 129 host_impl_.active_tree()->LayerById(id_)); |
| 130 | 130 |
| 131 bool update_lcd_text = false; | 131 bool first_update_after_commit = false; |
| 132 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 132 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, | 135 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, |
| 136 const gfx::Size& tile_size, | 136 const gfx::Size& tile_size, |
| 137 const Region& invalidation) { | 137 const Region& invalidation) { |
| 138 gfx::Size pile_tile_size(100, 100); | 138 gfx::Size pile_tile_size(100, 100); |
| 139 | 139 |
| 140 scoped_refptr<FakePicturePileImpl> pending_pile = | 140 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 141 FakePicturePileImpl::CreateFilledPile(pile_tile_size, layer_bounds); | 141 FakePicturePileImpl::CreateFilledPile(pile_tile_size, layer_bounds); |
| 142 scoped_refptr<FakePicturePileImpl> active_pile = | 142 scoped_refptr<FakePicturePileImpl> active_pile = |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 pending_layer->SetContentBounds(raster_source->GetSize()); | 217 pending_layer->SetContentBounds(raster_source->GetSize()); |
| 218 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); | 218 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); |
| 219 | 219 |
| 220 pending_root->AddChild(pending_layer.Pass()); | 220 pending_root->AddChild(pending_layer.Pass()); |
| 221 pending_tree->SetRootLayer(pending_root.Pass()); | 221 pending_tree->SetRootLayer(pending_root.Pass()); |
| 222 | 222 |
| 223 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 223 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
| 224 host_impl_.pending_tree()->LayerById(id_)); | 224 host_impl_.pending_tree()->LayerById(id_)); |
| 225 | 225 |
| 226 // Add tilings/tiles for the layer. | 226 // Add tilings/tiles for the layer. |
| 227 bool update_lcd_text = false; | 227 bool first_update_after_commit = false; |
| 228 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 228 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 229 } | 229 } |
| 230 | 230 |
| 231 void SetupDrawPropertiesAndUpdateTiles(FakePictureLayerImpl* layer, | 231 void SetupDrawPropertiesAndUpdateTiles(FakePictureLayerImpl* layer, |
| 232 float ideal_contents_scale, | 232 float ideal_contents_scale, |
| 233 float device_scale_factor, | 233 float device_scale_factor, |
| 234 float page_scale_factor, | 234 float page_scale_factor, |
| 235 float maximum_animation_contents_scale, | 235 float maximum_animation_contents_scale, |
| 236 bool animating_transform_to_screen) { | 236 bool animating_transform_to_screen) { |
| 237 layer->draw_properties().ideal_contents_scale = ideal_contents_scale; | 237 layer->draw_properties().ideal_contents_scale = ideal_contents_scale; |
| 238 layer->draw_properties().device_scale_factor = device_scale_factor; | 238 layer->draw_properties().device_scale_factor = device_scale_factor; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 gfx::Rect viewport = gfx::Rect(layer_bounds), | 426 gfx::Rect viewport = gfx::Rect(layer_bounds), |
| 427 viewport_rect_for_tile_priority = gfx::Rect(0, 0, 100, 100); | 427 viewport_rect_for_tile_priority = gfx::Rect(0, 0, 100, 100); |
| 428 gfx::Transform transform, transform_for_tile_priority; | 428 gfx::Transform transform, transform_for_tile_priority; |
| 429 | 429 |
| 430 host_impl_.SetExternalDrawConstraints(transform, | 430 host_impl_.SetExternalDrawConstraints(transform, |
| 431 viewport, | 431 viewport, |
| 432 viewport, | 432 viewport, |
| 433 viewport_rect_for_tile_priority, | 433 viewport_rect_for_tile_priority, |
| 434 transform_for_tile_priority, | 434 transform_for_tile_priority, |
| 435 resourceless_software_draw); | 435 resourceless_software_draw); |
| 436 bool update_lcd_text = false; | 436 bool first_update_after_commit = false; |
| 437 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 437 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 438 | 438 |
| 439 gfx::Rect viewport_rect_for_tile_priority_in_view_space = | 439 gfx::Rect viewport_rect_for_tile_priority_in_view_space = |
| 440 viewport_rect_for_tile_priority; | 440 viewport_rect_for_tile_priority; |
| 441 | 441 |
| 442 // Verify the viewport rect for tile priority is used in picture layer tiling. | 442 // Verify the viewport rect for tile priority is used in picture layer tiling. |
| 443 EXPECT_EQ(viewport_rect_for_tile_priority_in_view_space, | 443 EXPECT_EQ(viewport_rect_for_tile_priority_in_view_space, |
| 444 active_layer_->viewport_rect_for_tile_priority_in_content_space()); | 444 active_layer_->viewport_rect_for_tile_priority_in_content_space()); |
| 445 PictureLayerTilingSet* tilings = active_layer_->tilings(); | 445 PictureLayerTilingSet* tilings = active_layer_->tilings(); |
| 446 for (size_t i = 0; i < tilings->num_tilings(); i++) { | 446 for (size_t i = 0; i < tilings->num_tilings(); i++) { |
| 447 PictureLayerTiling* tiling = tilings->tiling_at(i); | 447 PictureLayerTiling* tiling = tilings->tiling_at(i); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 461 | 461 |
| 462 viewport_rect_for_tile_priority = gfx::Rect(200, 200, 100, 100); | 462 viewport_rect_for_tile_priority = gfx::Rect(200, 200, 100, 100); |
| 463 transform_for_tile_priority.Translate(100, 100); | 463 transform_for_tile_priority.Translate(100, 100); |
| 464 transform_for_tile_priority.Rotate(45); | 464 transform_for_tile_priority.Rotate(45); |
| 465 host_impl_.SetExternalDrawConstraints(transform, | 465 host_impl_.SetExternalDrawConstraints(transform, |
| 466 viewport, | 466 viewport, |
| 467 viewport, | 467 viewport, |
| 468 viewport_rect_for_tile_priority, | 468 viewport_rect_for_tile_priority, |
| 469 transform_for_tile_priority, | 469 transform_for_tile_priority, |
| 470 resourceless_software_draw); | 470 resourceless_software_draw); |
| 471 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 471 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 472 | 472 |
| 473 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); | 473 gfx::Transform screen_to_view(gfx::Transform::kSkipInitialization); |
| 474 bool success = transform_for_tile_priority.GetInverse(&screen_to_view); | 474 bool success = transform_for_tile_priority.GetInverse(&screen_to_view); |
| 475 EXPECT_TRUE(success); | 475 EXPECT_TRUE(success); |
| 476 | 476 |
| 477 // Note that we don't clip this to the layer bounds, since it is expected that | 477 // Note that we don't clip this to the layer bounds, since it is expected that |
| 478 // the rect will sometimes be outside of the layer bounds. If we clip to | 478 // the rect will sometimes be outside of the layer bounds. If we clip to |
| 479 // bounds, then tile priorities will end up being incorrect in cases of fully | 479 // bounds, then tile priorities will end up being incorrect in cases of fully |
| 480 // offscreen layer. | 480 // offscreen layer. |
| 481 viewport_rect_for_tile_priority_in_view_space = | 481 viewport_rect_for_tile_priority_in_view_space = |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 599 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 600 | 600 |
| 601 bool resourceless_software_draw = false; | 601 bool resourceless_software_draw = false; |
| 602 gfx::Rect viewport = gfx::Rect(layer_bounds); | 602 gfx::Rect viewport = gfx::Rect(layer_bounds); |
| 603 gfx::Rect viewport_rect_for_tile_priority(0, 0, 100, 100); | 603 gfx::Rect viewport_rect_for_tile_priority(0, 0, 100, 100); |
| 604 gfx::Transform transform, transform_for_tile_priority; | 604 gfx::Transform transform, transform_for_tile_priority; |
| 605 | 605 |
| 606 host_impl_.SetExternalDrawConstraints( | 606 host_impl_.SetExternalDrawConstraints( |
| 607 transform, viewport, viewport, viewport_rect_for_tile_priority, | 607 transform, viewport, viewport, viewport_rect_for_tile_priority, |
| 608 transform_for_tile_priority, resourceless_software_draw); | 608 transform_for_tile_priority, resourceless_software_draw); |
| 609 bool update_lcd_text = false; | 609 bool first_update_after_commit = false; |
| 610 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 610 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 611 | 611 |
| 612 EXPECT_EQ(viewport_rect_for_tile_priority, | 612 EXPECT_EQ(viewport_rect_for_tile_priority, |
| 613 active_layer_->viewport_rect_for_tile_priority_in_content_space()); | 613 active_layer_->viewport_rect_for_tile_priority_in_content_space()); |
| 614 | 614 |
| 615 time_ticks += base::TimeDelta::FromMilliseconds(200); | 615 time_ticks += base::TimeDelta::FromMilliseconds(200); |
| 616 host_impl_.SetCurrentBeginFrameArgs( | 616 host_impl_.SetCurrentBeginFrameArgs( |
| 617 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 617 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 618 | 618 |
| 619 gfx::Rect another_viewport_rect_for_tile_priority(11, 11, 50, 50); | 619 gfx::Rect another_viewport_rect_for_tile_priority(11, 11, 50, 50); |
| 620 host_impl_.SetExternalDrawConstraints( | 620 host_impl_.SetExternalDrawConstraints( |
| 621 transform, viewport, viewport, another_viewport_rect_for_tile_priority, | 621 transform, viewport, viewport, another_viewport_rect_for_tile_priority, |
| 622 transform_for_tile_priority, resourceless_software_draw); | 622 transform_for_tile_priority, resourceless_software_draw); |
| 623 | 623 |
| 624 // Didn't call UpdateDrawProperties yet. The viewport rect for tile priority | 624 // Didn't call UpdateDrawProperties yet. The viewport rect for tile priority |
| 625 // should remain to be the previously cached value. | 625 // should remain to be the previously cached value. |
| 626 EXPECT_EQ(viewport_rect_for_tile_priority, | 626 EXPECT_EQ(viewport_rect_for_tile_priority, |
| 627 active_layer_->viewport_rect_for_tile_priority_in_content_space()); | 627 active_layer_->viewport_rect_for_tile_priority_in_content_space()); |
| 628 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 628 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 629 | 629 |
| 630 // Now the UpdateDrawProperties is called. The viewport rect for tile | 630 // Now the UpdateDrawProperties is called. The viewport rect for tile |
| 631 // priority should be the latest value. | 631 // priority should be the latest value. |
| 632 EXPECT_EQ(another_viewport_rect_for_tile_priority, | 632 EXPECT_EQ(another_viewport_rect_for_tile_priority, |
| 633 active_layer_->viewport_rect_for_tile_priority_in_content_space()); | 633 active_layer_->viewport_rect_for_tile_priority_in_content_space()); |
| 634 } | 634 } |
| 635 | 635 |
| 636 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { | 636 TEST_F(PictureLayerImplTest, ClonePartialInvalidation) { |
| 637 gfx::Size tile_size(100, 100); | 637 gfx::Size tile_size(100, 100); |
| 638 gfx::Size layer_bounds(400, 400); | 638 gfx::Size layer_bounds(400, 400); |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 host_impl_.pending_tree(), 3, valid_pile); | 1309 host_impl_.pending_tree(), 3, valid_pile); |
| 1310 mask_ptr->SetBounds(layer_bounds); | 1310 mask_ptr->SetBounds(layer_bounds); |
| 1311 mask_ptr->SetContentBounds(layer_bounds); | 1311 mask_ptr->SetContentBounds(layer_bounds); |
| 1312 mask_ptr->SetDrawsContent(true); | 1312 mask_ptr->SetDrawsContent(true); |
| 1313 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1313 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
| 1314 pending_layer_->SetHasRenderSurface(true); | 1314 pending_layer_->SetHasRenderSurface(true); |
| 1315 | 1315 |
| 1316 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1316 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1317 host_impl_.SetCurrentBeginFrameArgs( | 1317 host_impl_.SetCurrentBeginFrameArgs( |
| 1318 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1318 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1319 bool update_lcd_text = false; | 1319 bool first_update_after_commit = false; |
| 1320 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1320 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 1321 | 1321 |
| 1322 FakePictureLayerImpl* pending_mask = | 1322 FakePictureLayerImpl* pending_mask = |
| 1323 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1323 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
| 1324 | 1324 |
| 1325 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); | 1325 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); |
| 1326 EXPECT_EQ(1u, pending_mask->num_tilings()); | 1326 EXPECT_EQ(1u, pending_mask->num_tilings()); |
| 1327 | 1327 |
| 1328 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( | 1328 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( |
| 1329 pending_mask->HighResTiling()->AllTilesForTesting()); | 1329 pending_mask->HighResTiling()->AllTilesForTesting()); |
| 1330 | 1330 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1360 FakePicturePileImpl::CreateFilledPile(tile_size, huge_bounds); | 1360 FakePicturePileImpl::CreateFilledPile(tile_size, huge_bounds); |
| 1361 | 1361 |
| 1362 SetupPendingTree(huge_pile); | 1362 SetupPendingTree(huge_pile); |
| 1363 pending_mask->SetBounds(huge_bounds); | 1363 pending_mask->SetBounds(huge_bounds); |
| 1364 pending_mask->SetContentBounds(huge_bounds); | 1364 pending_mask->SetContentBounds(huge_bounds); |
| 1365 pending_mask->SetRasterSourceOnPending(huge_pile, Region()); | 1365 pending_mask->SetRasterSourceOnPending(huge_pile, Region()); |
| 1366 | 1366 |
| 1367 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1367 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1368 host_impl_.SetCurrentBeginFrameArgs( | 1368 host_impl_.SetCurrentBeginFrameArgs( |
| 1369 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1369 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1370 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1370 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 1371 | 1371 |
| 1372 // The mask tiling gets scaled down. | 1372 // The mask tiling gets scaled down. |
| 1373 EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f); | 1373 EXPECT_LT(pending_mask->HighResTiling()->contents_scale(), 1.f); |
| 1374 EXPECT_EQ(1u, pending_mask->num_tilings()); | 1374 EXPECT_EQ(1u, pending_mask->num_tilings()); |
| 1375 | 1375 |
| 1376 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( | 1376 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( |
| 1377 pending_mask->HighResTiling()->AllTilesForTesting()); | 1377 pending_mask->HighResTiling()->AllTilesForTesting()); |
| 1378 | 1378 |
| 1379 ActivateTree(); | 1379 ActivateTree(); |
| 1380 | 1380 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 SetupPendingTree(extra_huge_pile); | 1416 SetupPendingTree(extra_huge_pile); |
| 1417 pending_mask->SetBounds(extra_huge_bounds); | 1417 pending_mask->SetBounds(extra_huge_bounds); |
| 1418 pending_mask->SetContentBounds(extra_huge_bounds); | 1418 pending_mask->SetContentBounds(extra_huge_bounds); |
| 1419 pending_mask->SetRasterSourceOnPending(extra_huge_pile, Region()); | 1419 pending_mask->SetRasterSourceOnPending(extra_huge_pile, Region()); |
| 1420 | 1420 |
| 1421 EXPECT_FALSE(pending_mask->CanHaveTilings()); | 1421 EXPECT_FALSE(pending_mask->CanHaveTilings()); |
| 1422 | 1422 |
| 1423 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1423 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1424 host_impl_.SetCurrentBeginFrameArgs( | 1424 host_impl_.SetCurrentBeginFrameArgs( |
| 1425 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1425 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1426 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1426 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 1427 | 1427 |
| 1428 EXPECT_EQ(0u, pending_mask->num_tilings()); | 1428 EXPECT_EQ(0u, pending_mask->num_tilings()); |
| 1429 } | 1429 } |
| 1430 | 1430 |
| 1431 TEST_F(PictureLayerImplTest, ScaledMaskLayer) { | 1431 TEST_F(PictureLayerImplTest, ScaledMaskLayer) { |
| 1432 base::TimeTicks time_ticks; | 1432 base::TimeTicks time_ticks; |
| 1433 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1433 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1434 host_impl_.SetCurrentBeginFrameArgs( | 1434 host_impl_.SetCurrentBeginFrameArgs( |
| 1435 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1435 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1436 | 1436 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1448 host_impl_.pending_tree(), 3, valid_pile); | 1448 host_impl_.pending_tree(), 3, valid_pile); |
| 1449 mask_ptr->SetBounds(layer_bounds); | 1449 mask_ptr->SetBounds(layer_bounds); |
| 1450 mask_ptr->SetContentBounds(layer_bounds); | 1450 mask_ptr->SetContentBounds(layer_bounds); |
| 1451 mask_ptr->SetDrawsContent(true); | 1451 mask_ptr->SetDrawsContent(true); |
| 1452 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1452 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
| 1453 pending_layer_->SetHasRenderSurface(true); | 1453 pending_layer_->SetHasRenderSurface(true); |
| 1454 | 1454 |
| 1455 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1455 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1456 host_impl_.SetCurrentBeginFrameArgs( | 1456 host_impl_.SetCurrentBeginFrameArgs( |
| 1457 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1457 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1458 bool update_lcd_text = false; | 1458 bool first_update_after_commit = false; |
| 1459 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1459 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 1460 | 1460 |
| 1461 FakePictureLayerImpl* pending_mask = | 1461 FakePictureLayerImpl* pending_mask = |
| 1462 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1462 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
| 1463 | 1463 |
| 1464 // Masks are scaled, and do not have a low res tiling. | 1464 // Masks are scaled, and do not have a low res tiling. |
| 1465 EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale()); | 1465 EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale()); |
| 1466 EXPECT_EQ(1u, pending_mask->num_tilings()); | 1466 EXPECT_EQ(1u, pending_mask->num_tilings()); |
| 1467 | 1467 |
| 1468 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( | 1468 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting( |
| 1469 pending_mask->HighResTiling()->AllTilesForTesting()); | 1469 pending_mask->HighResTiling()->AllTilesForTesting()); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 bool resourceless_software_draw = false; | 1770 bool resourceless_software_draw = false; |
| 1771 host_impl_.SetExternalDrawConstraints(transform, | 1771 host_impl_.SetExternalDrawConstraints(transform, |
| 1772 viewport, | 1772 viewport, |
| 1773 viewport, | 1773 viewport, |
| 1774 external_viewport_for_tile_priority, | 1774 external_viewport_for_tile_priority, |
| 1775 transform_for_tile_priority, | 1775 transform_for_tile_priority, |
| 1776 resourceless_software_draw); | 1776 resourceless_software_draw); |
| 1777 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1777 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1778 host_impl_.SetCurrentBeginFrameArgs( | 1778 host_impl_.SetCurrentBeginFrameArgs( |
| 1779 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1779 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1780 bool update_lcd_text = false; | 1780 bool first_update_after_commit = false; |
| 1781 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1781 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 1782 | 1782 |
| 1783 // Set visible content rect that is different from | 1783 // Set visible content rect that is different from |
| 1784 // external_viewport_for_tile_priority. | 1784 // external_viewport_for_tile_priority. |
| 1785 pending_layer_->draw_properties().visible_content_rect = visible_content_rect; | 1785 pending_layer_->draw_properties().visible_content_rect = visible_content_rect; |
| 1786 time_ticks += base::TimeDelta::FromMilliseconds(200); | 1786 time_ticks += base::TimeDelta::FromMilliseconds(200); |
| 1787 host_impl_.SetCurrentBeginFrameArgs( | 1787 host_impl_.SetCurrentBeginFrameArgs( |
| 1788 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1788 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1789 pending_layer_->UpdateTiles(resourceless_software_draw); | 1789 pending_layer_->UpdateTiles(resourceless_software_draw); |
| 1790 | 1790 |
| 1791 // Intersect the two rects. Any tile outside should not be required for | 1791 // Intersect the two rects. Any tile outside should not be required for |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1811 num_outside++; | 1811 num_outside++; |
| 1812 EXPECT_FALSE(tile->required_for_activation()); | 1812 EXPECT_FALSE(tile->required_for_activation()); |
| 1813 } | 1813 } |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 EXPECT_GT(num_inside, 0); | 1816 EXPECT_GT(num_inside, 0); |
| 1817 EXPECT_GT(num_outside, 0); | 1817 EXPECT_GT(num_outside, 0); |
| 1818 | 1818 |
| 1819 // Activate and draw active layer. | 1819 // Activate and draw active layer. |
| 1820 host_impl_.ActivateSyncTree(); | 1820 host_impl_.ActivateSyncTree(); |
| 1821 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 1821 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 1822 active_layer_->draw_properties().visible_content_rect = visible_content_rect; | 1822 active_layer_->draw_properties().visible_content_rect = visible_content_rect; |
| 1823 | 1823 |
| 1824 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); | 1824 scoped_ptr<RenderPass> render_pass = RenderPass::Create(); |
| 1825 AppendQuadsData data; | 1825 AppendQuadsData data; |
| 1826 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); | 1826 active_layer_->WillDraw(DRAW_MODE_SOFTWARE, nullptr); |
| 1827 active_layer_->AppendQuads(render_pass.get(), &data); | 1827 active_layer_->AppendQuads(render_pass.get(), &data); |
| 1828 active_layer_->DidDraw(nullptr); | 1828 active_layer_->DidDraw(nullptr); |
| 1829 | 1829 |
| 1830 // All tiles in activation rect is ready to draw. | 1830 // All tiles in activation rect is ready to draw. |
| 1831 EXPECT_EQ(0u, data.num_missing_tiles); | 1831 EXPECT_EQ(0u, data.num_missing_tiles); |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2415 // Toggling the gpu rasterization clears all tilings on both trees. | 2415 // Toggling the gpu rasterization clears all tilings on both trees. |
| 2416 host_impl_.SetUseGpuRasterization(true); | 2416 host_impl_.SetUseGpuRasterization(true); |
| 2417 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); | 2417 EXPECT_EQ(0u, pending_layer_->tilings()->num_tilings()); |
| 2418 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 2418 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 2419 | 2419 |
| 2420 // Make sure that we can still add tiling to the pending layer, | 2420 // Make sure that we can still add tiling to the pending layer, |
| 2421 // that gets synced to the active layer. | 2421 // that gets synced to the active layer. |
| 2422 time_ticks += base::TimeDelta::FromMilliseconds(1); | 2422 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 2423 host_impl_.SetCurrentBeginFrameArgs( | 2423 host_impl_.SetCurrentBeginFrameArgs( |
| 2424 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 2424 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 2425 bool update_lcd_text = false; | 2425 bool first_update_after_commit = false; |
| 2426 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 2426 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 2427 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f)); | 2427 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f)); |
| 2428 | 2428 |
| 2429 ActivateTree(); | 2429 ActivateTree(); |
| 2430 EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f)); | 2430 EXPECT_TRUE(active_layer_->tilings()->FindTilingWithScale(1.f)); |
| 2431 | 2431 |
| 2432 SetupPendingTree(pending_pile); | 2432 SetupPendingTree(pending_pile); |
| 2433 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f)); | 2433 EXPECT_TRUE(pending_layer_->tilings()->FindTilingWithScale(1.f)); |
| 2434 | 2434 |
| 2435 // Toggling the gpu rasterization clears all tilings on both trees. | 2435 // Toggling the gpu rasterization clears all tilings on both trees. |
| 2436 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); | 2436 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); |
| (...skipping 1419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3856 // raster on demand is not allowed and tile is OOM. | 3856 // raster on demand is not allowed and tile is OOM. |
| 3857 gfx::Size tile_size = host_impl_.settings().default_tile_size; | 3857 gfx::Size tile_size = host_impl_.settings().default_tile_size; |
| 3858 gfx::Size layer_bounds(1000, 1000); | 3858 gfx::Size layer_bounds(1000, 1000); |
| 3859 | 3859 |
| 3860 // Create tiles. | 3860 // Create tiles. |
| 3861 scoped_refptr<FakePicturePileImpl> pending_pile = | 3861 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 3862 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 3862 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 3863 SetupPendingTree(pending_pile); | 3863 SetupPendingTree(pending_pile); |
| 3864 pending_layer_->SetBounds(layer_bounds); | 3864 pending_layer_->SetBounds(layer_bounds); |
| 3865 ActivateTree(); | 3865 ActivateTree(); |
| 3866 bool update_lcd_text = false; | 3866 bool first_update_after_commit = false; |
| 3867 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 3867 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 3868 std::vector<Tile*> tiles = | 3868 std::vector<Tile*> tiles = |
| 3869 active_layer_->HighResTiling()->AllTilesForTesting(); | 3869 active_layer_->HighResTiling()->AllTilesForTesting(); |
| 3870 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 3870 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
| 3871 | 3871 |
| 3872 // Force tiles after max_tiles to be OOM. TileManager uses | 3872 // Force tiles after max_tiles to be OOM. TileManager uses |
| 3873 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot | 3873 // GlobalStateThatImpactsTilesPriority from LayerTreeHostImpl, and we cannot |
| 3874 // directly set state to host_impl_, so we set policy that would change the | 3874 // directly set state to host_impl_, so we set policy that would change the |
| 3875 // state. We also need to update tree priority separately. | 3875 // state. We also need to update tree priority separately. |
| 3876 GlobalStateThatImpactsTilePriority state; | 3876 GlobalStateThatImpactsTilePriority state; |
| 3877 size_t max_tiles = 1; | 3877 size_t max_tiles = 1; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4067 LayerImpl* layer1 = pending_layer_->children()[0]; | 4067 LayerImpl* layer1 = pending_layer_->children()[0]; |
| 4068 layer1->SetBounds(layer_bounds); | 4068 layer1->SetBounds(layer_bounds); |
| 4069 layer1->SetContentBounds(layer_bounds); | 4069 layer1->SetContentBounds(layer_bounds); |
| 4070 layer1->SetDrawsContent(true); | 4070 layer1->SetDrawsContent(true); |
| 4071 layer1->SetContentsOpaque(true); | 4071 layer1->SetContentsOpaque(true); |
| 4072 layer1->SetPosition(occluding_layer_position); | 4072 layer1->SetPosition(occluding_layer_position); |
| 4073 | 4073 |
| 4074 time_ticks += base::TimeDelta::FromMilliseconds(200); | 4074 time_ticks += base::TimeDelta::FromMilliseconds(200); |
| 4075 host_impl_.SetCurrentBeginFrameArgs( | 4075 host_impl_.SetCurrentBeginFrameArgs( |
| 4076 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4076 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 4077 bool update_lcd_text = false; | 4077 bool first_update_after_commit = false; |
| 4078 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 4078 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 4079 | 4079 |
| 4080 unoccluded_tile_count = 0; | 4080 unoccluded_tile_count = 0; |
| 4081 queue.reset(new TilingSetRasterQueueAll( | 4081 queue.reset(new TilingSetRasterQueueAll( |
| 4082 pending_layer_->picture_layer_tiling_set(), false)); | 4082 pending_layer_->picture_layer_tiling_set(), false)); |
| 4083 while (!queue->IsEmpty()) { | 4083 while (!queue->IsEmpty()) { |
| 4084 Tile* tile = queue->Top(); | 4084 Tile* tile = queue->Top(); |
| 4085 | 4085 |
| 4086 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); | 4086 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); |
| 4087 | 4087 |
| 4088 bool tile_is_visible = | 4088 bool tile_is_visible = |
| 4089 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); | 4089 tile->content_rect().Intersects(pending_layer_->visible_content_rect()); |
| 4090 if (tile_is_visible) | 4090 if (tile_is_visible) |
| 4091 unoccluded_tile_count++; | 4091 unoccluded_tile_count++; |
| 4092 queue->Pop(); | 4092 queue->Pop(); |
| 4093 } | 4093 } |
| 4094 EXPECT_EQ(20, unoccluded_tile_count); | 4094 EXPECT_EQ(20, unoccluded_tile_count); |
| 4095 | 4095 |
| 4096 // Full occlusion. | 4096 // Full occlusion. |
| 4097 layer1->SetPosition(gfx::Point(0, 0)); | 4097 layer1->SetPosition(gfx::Point(0, 0)); |
| 4098 | 4098 |
| 4099 time_ticks += base::TimeDelta::FromMilliseconds(200); | 4099 time_ticks += base::TimeDelta::FromMilliseconds(200); |
| 4100 host_impl_.SetCurrentBeginFrameArgs( | 4100 host_impl_.SetCurrentBeginFrameArgs( |
| 4101 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4101 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 4102 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 4102 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 4103 | 4103 |
| 4104 unoccluded_tile_count = 0; | 4104 unoccluded_tile_count = 0; |
| 4105 queue.reset(new TilingSetRasterQueueAll( | 4105 queue.reset(new TilingSetRasterQueueAll( |
| 4106 pending_layer_->picture_layer_tiling_set(), false)); | 4106 pending_layer_->picture_layer_tiling_set(), false)); |
| 4107 while (!queue->IsEmpty()) { | 4107 while (!queue->IsEmpty()) { |
| 4108 Tile* tile = queue->Top(); | 4108 Tile* tile = queue->Top(); |
| 4109 | 4109 |
| 4110 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); | 4110 EXPECT_FALSE(tile->is_occluded(PENDING_TREE)); |
| 4111 | 4111 |
| 4112 bool tile_is_visible = | 4112 bool tile_is_visible = |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4166 LayerImpl* layer1 = pending_layer_->children()[0]; | 4166 LayerImpl* layer1 = pending_layer_->children()[0]; |
| 4167 layer1->SetBounds(layer_bounds); | 4167 layer1->SetBounds(layer_bounds); |
| 4168 layer1->SetContentBounds(layer_bounds); | 4168 layer1->SetContentBounds(layer_bounds); |
| 4169 layer1->SetDrawsContent(true); | 4169 layer1->SetDrawsContent(true); |
| 4170 layer1->SetContentsOpaque(true); | 4170 layer1->SetContentsOpaque(true); |
| 4171 layer1->SetPosition(occluding_layer_position); | 4171 layer1->SetPosition(occluding_layer_position); |
| 4172 | 4172 |
| 4173 time_ticks += base::TimeDelta::FromMilliseconds(200); | 4173 time_ticks += base::TimeDelta::FromMilliseconds(200); |
| 4174 host_impl_.SetCurrentBeginFrameArgs( | 4174 host_impl_.SetCurrentBeginFrameArgs( |
| 4175 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4175 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 4176 bool update_lcd_text = false; | 4176 bool first_update_after_commit = false; |
| 4177 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 4177 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 4178 | 4178 |
| 4179 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 4179 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
| 4180 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 4180 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
| 4181 tiling->UpdateAllTilePrioritiesForTesting(); | 4181 tiling->UpdateAllTilePrioritiesForTesting(); |
| 4182 | 4182 |
| 4183 occluded_tile_count = 0; | 4183 occluded_tile_count = 0; |
| 4184 for (PictureLayerTiling::CoverageIterator iter( | 4184 for (PictureLayerTiling::CoverageIterator iter( |
| 4185 tiling, | 4185 tiling, |
| 4186 pending_layer_->contents_scale_x(), | 4186 pending_layer_->contents_scale_x(), |
| 4187 gfx::Rect(layer_bounds)); | 4187 gfx::Rect(layer_bounds)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 4207 NOTREACHED(); | 4207 NOTREACHED(); |
| 4208 } | 4208 } |
| 4209 } | 4209 } |
| 4210 | 4210 |
| 4211 // Full occlusion. | 4211 // Full occlusion. |
| 4212 layer1->SetPosition(gfx::PointF(0, 0)); | 4212 layer1->SetPosition(gfx::PointF(0, 0)); |
| 4213 | 4213 |
| 4214 time_ticks += base::TimeDelta::FromMilliseconds(200); | 4214 time_ticks += base::TimeDelta::FromMilliseconds(200); |
| 4215 host_impl_.SetCurrentBeginFrameArgs( | 4215 host_impl_.SetCurrentBeginFrameArgs( |
| 4216 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4216 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 4217 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 4217 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 4218 | 4218 |
| 4219 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 4219 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
| 4220 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 4220 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
| 4221 tiling->UpdateAllTilePrioritiesForTesting(); | 4221 tiling->UpdateAllTilePrioritiesForTesting(); |
| 4222 | 4222 |
| 4223 occluded_tile_count = 0; | 4223 occluded_tile_count = 0; |
| 4224 for (PictureLayerTiling::CoverageIterator iter( | 4224 for (PictureLayerTiling::CoverageIterator iter( |
| 4225 tiling, | 4225 tiling, |
| 4226 pending_layer_->contents_scale_x(), | 4226 pending_layer_->contents_scale_x(), |
| 4227 gfx::Rect(layer_bounds)); | 4227 gfx::Rect(layer_bounds)); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4281 pending_layer_->AddTiling(low_res_factor); | 4281 pending_layer_->AddTiling(low_res_factor); |
| 4282 pending_layer_->AddTiling(0.3f); | 4282 pending_layer_->AddTiling(0.3f); |
| 4283 pending_layer_->AddTiling(0.7f); | 4283 pending_layer_->AddTiling(0.7f); |
| 4284 pending_layer_->AddTiling(1.0f); | 4284 pending_layer_->AddTiling(1.0f); |
| 4285 pending_layer_->AddTiling(2.0f); | 4285 pending_layer_->AddTiling(2.0f); |
| 4286 | 4286 |
| 4287 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4287 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 4288 host_impl_.SetCurrentBeginFrameArgs( | 4288 host_impl_.SetCurrentBeginFrameArgs( |
| 4289 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4289 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 4290 // UpdateDrawProperties with the occluding layer. | 4290 // UpdateDrawProperties with the occluding layer. |
| 4291 bool update_lcd_text = false; | 4291 bool first_update_after_commit = false; |
| 4292 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 4292 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 4293 | 4293 |
| 4294 EXPECT_EQ(5u, pending_layer_->num_tilings()); | 4294 EXPECT_EQ(5u, pending_layer_->num_tilings()); |
| 4295 | 4295 |
| 4296 int occluded_tile_count = 0; | 4296 int occluded_tile_count = 0; |
| 4297 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 4297 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { |
| 4298 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 4298 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); |
| 4299 tiling->UpdateAllTilePrioritiesForTesting(); | 4299 tiling->UpdateAllTilePrioritiesForTesting(); |
| 4300 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 4300 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
| 4301 | 4301 |
| 4302 occluded_tile_count = 0; | 4302 occluded_tile_count = 0; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4481 pending_occluding_layer->SetContentsOpaque(true); | 4481 pending_occluding_layer->SetContentsOpaque(true); |
| 4482 pending_occluding_layer->SetPosition(pending_occluding_layer_position); | 4482 pending_occluding_layer->SetPosition(pending_occluding_layer_position); |
| 4483 | 4483 |
| 4484 EXPECT_EQ(2u, pending_layer_->num_tilings()); | 4484 EXPECT_EQ(2u, pending_layer_->num_tilings()); |
| 4485 EXPECT_EQ(2u, active_layer_->num_tilings()); | 4485 EXPECT_EQ(2u, active_layer_->num_tilings()); |
| 4486 | 4486 |
| 4487 time_ticks += base::TimeDelta::FromMilliseconds(1); | 4487 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 4488 host_impl_.SetCurrentBeginFrameArgs( | 4488 host_impl_.SetCurrentBeginFrameArgs( |
| 4489 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 4489 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 4490 // UpdateDrawProperties with the occluding layer. | 4490 // UpdateDrawProperties with the occluding layer. |
| 4491 bool update_lcd_text = false; | 4491 bool first_update_after_commit = false; |
| 4492 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 4492 host_impl_.pending_tree()->UpdateDrawProperties(first_update_after_commit); |
| 4493 | 4493 |
| 4494 // The expected number of occluded tiles on each of the 2 tilings for each of | 4494 // The expected number of occluded tiles on each of the 2 tilings for each of |
| 4495 // the 3 tree priorities. | 4495 // the 3 tree priorities. |
| 4496 size_t expected_occluded_tile_count_on_both[] = {9u, 1u}; | 4496 size_t expected_occluded_tile_count_on_both[] = {9u, 1u}; |
| 4497 size_t expected_occluded_tile_count_on_active[] = {30u, 3u}; | 4497 size_t expected_occluded_tile_count_on_active[] = {30u, 3u}; |
| 4498 size_t expected_occluded_tile_count_on_pending[] = {30u, 3u}; | 4498 size_t expected_occluded_tile_count_on_pending[] = {30u, 3u}; |
| 4499 | 4499 |
| 4500 size_t total_expected_occluded_tile_count_on_trees[] = {33u, 33u}; | 4500 size_t total_expected_occluded_tile_count_on_trees[] = {33u, 33u}; |
| 4501 | 4501 |
| 4502 // Verify number of occluded tiles on the pending layer for each tiling. | 4502 // Verify number of occluded tiles on the pending layer for each tiling. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4744 Region invalidation1(layer_rect); | 4744 Region invalidation1(layer_rect); |
| 4745 recording_source->UpdateAndExpandInvalidation( | 4745 recording_source->UpdateAndExpandInvalidation( |
| 4746 &client, &invalidation1, layer_bounds, layer_rect, frame_number++, | 4746 &client, &invalidation1, layer_bounds, layer_rect, frame_number++, |
| 4747 RecordingSource::RECORD_NORMALLY); | 4747 RecordingSource::RECORD_NORMALLY); |
| 4748 | 4748 |
| 4749 scoped_refptr<RasterSource> raster_source1 = | 4749 scoped_refptr<RasterSource> raster_source1 = |
| 4750 recording_source->CreateRasterSource(true); | 4750 recording_source->CreateRasterSource(true); |
| 4751 | 4751 |
| 4752 SetupPendingTree(raster_source1); | 4752 SetupPendingTree(raster_source1); |
| 4753 ActivateTree(); | 4753 ActivateTree(); |
| 4754 bool update_lcd_text = false; | 4754 bool first_update_after_commit = false; |
| 4755 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | 4755 host_impl_.active_tree()->UpdateDrawProperties(first_update_after_commit); |
| 4756 | 4756 |
| 4757 // We've started with a solid layer that contains some tilings. | 4757 // We've started with a solid layer that contains some tilings. |
| 4758 ASSERT_TRUE(active_layer_->tilings()); | 4758 ASSERT_TRUE(active_layer_->tilings()); |
| 4759 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); | 4759 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); |
| 4760 | 4760 |
| 4761 client.set_fill_with_nonsolid_color(false); | 4761 client.set_fill_with_nonsolid_color(false); |
| 4762 | 4762 |
| 4763 Region invalidation2(layer_rect); | 4763 Region invalidation2(layer_rect); |
| 4764 recording_source->UpdateAndExpandInvalidation( | 4764 recording_source->UpdateAndExpandInvalidation( |
| 4765 &client, &invalidation2, layer_bounds, layer_rect, frame_number++, | 4765 &client, &invalidation2, layer_bounds, layer_rect, frame_number++, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4958 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4958 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4959 EXPECT_EQ(result.width(), 448); | 4959 EXPECT_EQ(result.width(), 448); |
| 4960 EXPECT_EQ(result.height(), 448); | 4960 EXPECT_EQ(result.height(), 448); |
| 4961 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4961 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4962 EXPECT_EQ(result.width(), 512); | 4962 EXPECT_EQ(result.width(), 512); |
| 4963 EXPECT_EQ(result.height(), 500 + 2); | 4963 EXPECT_EQ(result.height(), 500 + 2); |
| 4964 } | 4964 } |
| 4965 | 4965 |
| 4966 } // namespace | 4966 } // namespace |
| 4967 } // namespace cc | 4967 } // namespace cc |
| OLD | NEW |