| 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 3599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3610 } | 3610 } |
| 3611 | 3611 |
| 3612 TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) { | 3612 TEST_F(PictureLayerImplTest, UpdateTilesForMasksWithNoVisibleContent) { |
| 3613 gfx::Size tile_size(400, 400); | 3613 gfx::Size tile_size(400, 400); |
| 3614 gfx::Size bounds(100000, 100); | 3614 gfx::Size bounds(100000, 100); |
| 3615 | 3615 |
| 3616 host_impl_.CreatePendingTree(); | 3616 host_impl_.CreatePendingTree(); |
| 3617 | 3617 |
| 3618 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.pending_tree(), 1); | 3618 scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl_.pending_tree(), 1); |
| 3619 | 3619 |
| 3620 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 3621 FakePicturePileImpl::CreateFilledPile(tile_size, bounds); |
| 3620 scoped_ptr<FakePictureLayerImpl> layer_with_mask = | 3622 scoped_ptr<FakePictureLayerImpl> layer_with_mask = |
| 3621 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 2); | 3623 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2, |
| 3624 pending_pile); |
| 3622 layer_with_mask->SetBounds(bounds); | 3625 layer_with_mask->SetBounds(bounds); |
| 3623 layer_with_mask->SetContentBounds(bounds); | 3626 layer_with_mask->SetContentBounds(bounds); |
| 3624 | 3627 |
| 3625 scoped_refptr<FakePicturePileImpl> pending_pile = | 3628 scoped_refptr<FakePicturePileImpl> mask_pile = |
| 3626 FakePicturePileImpl::CreateFilledPile(tile_size, bounds); | 3629 FakePicturePileImpl::CreateFilledPile(tile_size, bounds); |
| 3627 scoped_ptr<FakePictureLayerImpl> mask = | 3630 scoped_ptr<FakePictureLayerImpl> mask = |
| 3628 FakePictureLayerImpl::CreateMaskWithRasterSource( | 3631 FakePictureLayerImpl::CreateMaskWithRasterSource( |
| 3629 host_impl_.pending_tree(), 3, pending_pile); | 3632 host_impl_.pending_tree(), 3, mask_pile); |
| 3630 mask->SetBounds(bounds); | 3633 mask->SetBounds(bounds); |
| 3631 mask->SetContentBounds(bounds); | 3634 mask->SetContentBounds(bounds); |
| 3632 mask->SetDrawsContent(true); | 3635 mask->SetDrawsContent(true); |
| 3633 layer_with_mask->SetMaskLayer(mask.Pass()); | 3636 layer_with_mask->SetMaskLayer(mask.Pass()); |
| 3634 | 3637 |
| 3635 FakePictureLayerImpl* pending_mask = | 3638 FakePictureLayerImpl* pending_mask = |
| 3636 static_cast<FakePictureLayerImpl*>(layer_with_mask->mask_layer()); | 3639 static_cast<FakePictureLayerImpl*>(layer_with_mask->mask_layer()); |
| 3637 | 3640 |
| 3638 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = | 3641 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = |
| 3639 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); | 3642 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 4, |
| 3643 pending_pile); |
| 3640 child_of_layer_with_mask->SetBounds(bounds); | 3644 child_of_layer_with_mask->SetBounds(bounds); |
| 3641 child_of_layer_with_mask->SetContentBounds(bounds); | 3645 child_of_layer_with_mask->SetContentBounds(bounds); |
| 3642 child_of_layer_with_mask->SetDrawsContent(true); | 3646 child_of_layer_with_mask->SetDrawsContent(true); |
| 3643 layer_with_mask->AddChild(child_of_layer_with_mask.Pass()); | 3647 layer_with_mask->AddChild(child_of_layer_with_mask.Pass()); |
| 3644 root->AddChild(layer_with_mask.Pass()); | 3648 root->AddChild(layer_with_mask.Pass()); |
| 3645 | 3649 |
| 3646 host_impl_.pending_tree()->SetRootLayer(root.Pass()); | 3650 host_impl_.pending_tree()->SetRootLayer(root.Pass()); |
| 3647 | 3651 |
| 3648 EXPECT_EQ(0u, pending_mask->num_tilings()); | 3652 EXPECT_EQ(0u, pending_mask->num_tilings()); |
| 3649 host_impl_.pending_tree()->UpdateDrawProperties(); | 3653 host_impl_.pending_tree()->UpdateDrawProperties(); |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4697 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4701 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4698 EXPECT_EQ(result.width(), 448); | 4702 EXPECT_EQ(result.width(), 448); |
| 4699 EXPECT_EQ(result.height(), 448); | 4703 EXPECT_EQ(result.height(), 448); |
| 4700 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4704 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4701 EXPECT_EQ(result.width(), 512); | 4705 EXPECT_EQ(result.width(), 512); |
| 4702 EXPECT_EQ(result.height(), 500 + 2); | 4706 EXPECT_EQ(result.height(), 500 + 2); |
| 4703 } | 4707 } |
| 4704 | 4708 |
| 4705 } // namespace | 4709 } // namespace |
| 4706 } // namespace cc | 4710 } // namespace cc |
| OLD | NEW |