| 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 4479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4490 FakeContentLayerClient client; | 4490 FakeContentLayerClient client; |
| 4491 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 4491 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 4492 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4492 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 4493 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); | 4493 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
| 4494 host->SetRootLayer(layer); | 4494 host->SetRootLayer(layer); |
| 4495 PicturePile* pile = layer->GetPicturePileForTesting(); | 4495 PicturePile* pile = layer->GetPicturePileForTesting(); |
| 4496 | 4496 |
| 4497 host_impl_.SetViewportSize(layer_bounds); | 4497 host_impl_.SetViewportSize(layer_bounds); |
| 4498 | 4498 |
| 4499 int frame_number = 0; | 4499 int frame_number = 0; |
| 4500 FakeRenderingStatsInstrumentation stats_instrumentation; | |
| 4501 | 4500 |
| 4502 client.set_fill_with_nonsolid_color(!test_for_solid); | 4501 client.set_fill_with_nonsolid_color(!test_for_solid); |
| 4503 | 4502 |
| 4504 Region invalidation(layer_rect); | 4503 Region invalidation(layer_rect); |
| 4505 pile->UpdateAndExpandInvalidation(&client, | 4504 pile->UpdateAndExpandInvalidation(&client, &invalidation, SK_ColorWHITE, |
| 4506 &invalidation, | 4505 false, false, layer_bounds, layer_rect, |
| 4507 SK_ColorWHITE, | 4506 frame_number++, Picture::RECORD_NORMALLY); |
| 4508 false, | |
| 4509 false, | |
| 4510 layer_bounds, | |
| 4511 layer_rect, | |
| 4512 frame_number++, | |
| 4513 Picture::RECORD_NORMALLY, | |
| 4514 &stats_instrumentation); | |
| 4515 | 4507 |
| 4516 scoped_refptr<PicturePileImpl> pending_pile = | 4508 scoped_refptr<PicturePileImpl> pending_pile = |
| 4517 PicturePileImpl::CreateFromOther(pile); | 4509 PicturePileImpl::CreateFromOther(pile); |
| 4518 | 4510 |
| 4519 SetupPendingTree(pending_pile); | 4511 SetupPendingTree(pending_pile); |
| 4520 ActivateTree(); | 4512 ActivateTree(); |
| 4521 | 4513 |
| 4522 active_layer_->set_fixed_tile_size(tile_size); | 4514 active_layer_->set_fixed_tile_size(tile_size); |
| 4523 host_impl_.active_tree()->UpdateDrawProperties(); | 4515 host_impl_.active_tree()->UpdateDrawProperties(); |
| 4524 if (test_for_solid) { | 4516 if (test_for_solid) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4565 FakeContentLayerClient client; | 4557 FakeContentLayerClient client; |
| 4566 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); | 4558 scoped_refptr<PictureLayer> layer = PictureLayer::Create(&client); |
| 4567 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); | 4559 FakeLayerTreeHostClient host_client(FakeLayerTreeHostClient::DIRECT_3D); |
| 4568 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); | 4560 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&host_client); |
| 4569 host->SetRootLayer(layer); | 4561 host->SetRootLayer(layer); |
| 4570 PicturePile* pile = layer->GetPicturePileForTesting(); | 4562 PicturePile* pile = layer->GetPicturePileForTesting(); |
| 4571 | 4563 |
| 4572 host_impl_.SetViewportSize(layer_bounds); | 4564 host_impl_.SetViewportSize(layer_bounds); |
| 4573 | 4565 |
| 4574 int frame_number = 0; | 4566 int frame_number = 0; |
| 4575 FakeRenderingStatsInstrumentation stats_instrumentation; | |
| 4576 | 4567 |
| 4577 client.set_fill_with_nonsolid_color(true); | 4568 client.set_fill_with_nonsolid_color(true); |
| 4578 | 4569 |
| 4579 Region invalidation1(layer_rect); | 4570 Region invalidation1(layer_rect); |
| 4580 pile->UpdateAndExpandInvalidation(&client, | 4571 pile->UpdateAndExpandInvalidation(&client, &invalidation1, SK_ColorWHITE, |
| 4581 &invalidation1, | 4572 false, false, layer_bounds, layer_rect, |
| 4582 SK_ColorWHITE, | 4573 frame_number++, Picture::RECORD_NORMALLY); |
| 4583 false, | |
| 4584 false, | |
| 4585 layer_bounds, | |
| 4586 layer_rect, | |
| 4587 frame_number++, | |
| 4588 Picture::RECORD_NORMALLY, | |
| 4589 &stats_instrumentation); | |
| 4590 | 4574 |
| 4591 scoped_refptr<PicturePileImpl> pending_pile1 = | 4575 scoped_refptr<PicturePileImpl> pending_pile1 = |
| 4592 PicturePileImpl::CreateFromOther(pile); | 4576 PicturePileImpl::CreateFromOther(pile); |
| 4593 | 4577 |
| 4594 SetupPendingTree(pending_pile1); | 4578 SetupPendingTree(pending_pile1); |
| 4595 ActivateTree(); | 4579 ActivateTree(); |
| 4596 host_impl_.active_tree()->UpdateDrawProperties(); | 4580 host_impl_.active_tree()->UpdateDrawProperties(); |
| 4597 | 4581 |
| 4598 // We've started with a solid layer that contains some tilings. | 4582 // We've started with a solid layer that contains some tilings. |
| 4599 ASSERT_TRUE(active_layer_->tilings()); | 4583 ASSERT_TRUE(active_layer_->tilings()); |
| 4600 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); | 4584 EXPECT_NE(0u, active_layer_->tilings()->num_tilings()); |
| 4601 | 4585 |
| 4602 client.set_fill_with_nonsolid_color(false); | 4586 client.set_fill_with_nonsolid_color(false); |
| 4603 | 4587 |
| 4604 Region invalidation2(layer_rect); | 4588 Region invalidation2(layer_rect); |
| 4605 pile->UpdateAndExpandInvalidation(&client, | 4589 pile->UpdateAndExpandInvalidation(&client, &invalidation2, SK_ColorWHITE, |
| 4606 &invalidation2, | 4590 false, false, layer_bounds, layer_rect, |
| 4607 SK_ColorWHITE, | 4591 frame_number++, Picture::RECORD_NORMALLY); |
| 4608 false, | |
| 4609 false, | |
| 4610 layer_bounds, | |
| 4611 layer_rect, | |
| 4612 frame_number++, | |
| 4613 Picture::RECORD_NORMALLY, | |
| 4614 &stats_instrumentation); | |
| 4615 | 4592 |
| 4616 scoped_refptr<PicturePileImpl> pending_pile2 = | 4593 scoped_refptr<PicturePileImpl> pending_pile2 = |
| 4617 PicturePileImpl::CreateFromOther(pile); | 4594 PicturePileImpl::CreateFromOther(pile); |
| 4618 | 4595 |
| 4619 SetupPendingTree(pending_pile2); | 4596 SetupPendingTree(pending_pile2); |
| 4620 ActivateTree(); | 4597 ActivateTree(); |
| 4621 | 4598 |
| 4622 // We've switched to a solid color, so we should end up with no tilings. | 4599 // We've switched to a solid color, so we should end up with no tilings. |
| 4623 ASSERT_TRUE(active_layer_->tilings()); | 4600 ASSERT_TRUE(active_layer_->tilings()); |
| 4624 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4601 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4743 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4720 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4744 EXPECT_EQ(result.width(), 448); | 4721 EXPECT_EQ(result.width(), 448); |
| 4745 EXPECT_EQ(result.height(), 448); | 4722 EXPECT_EQ(result.height(), 448); |
| 4746 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4723 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4747 EXPECT_EQ(result.width(), 512); | 4724 EXPECT_EQ(result.width(), 512); |
| 4748 EXPECT_EQ(result.height(), 500 + 2); | 4725 EXPECT_EQ(result.height(), 500 + 2); |
| 4749 } | 4726 } |
| 4750 | 4727 |
| 4751 } // namespace | 4728 } // namespace |
| 4752 } // namespace cc | 4729 } // namespace cc |
| OLD | NEW |