| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { | 133 void SetupPendingTree(scoped_refptr<PicturePileImpl> pile) { |
| 134 host_impl_.CreatePendingTree(); | 134 host_impl_.CreatePendingTree(); |
| 135 host_impl_.pending_tree()->SetPageScaleFactorAndLimits(1.f, 0.25f, 100.f); | 135 host_impl_.pending_tree()->SetPageScaleFactorAndLimits(1.f, 0.25f, 100.f); |
| 136 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 136 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
| 137 // Clear recycled tree. | 137 // Clear recycled tree. |
| 138 pending_tree->DetachLayerTree(); | 138 pending_tree->DetachLayerTree(); |
| 139 | 139 |
| 140 scoped_ptr<FakePictureLayerImpl> pending_layer = | 140 scoped_ptr<FakePictureLayerImpl> pending_layer = |
| 141 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); | 141 FakePictureLayerImpl::CreateWithPile(pending_tree, id_, pile); |
| 142 pending_layer->SetDrawsContent(true); | 142 pending_layer->SetDrawsContent(true); |
| 143 pending_layer->SetHasRenderSurface(true); |
| 143 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); | 144 pending_tree->SetRootLayer(pending_layer.PassAs<LayerImpl>()); |
| 144 | 145 |
| 145 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 146 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
| 146 host_impl_.pending_tree()->LayerById(id_)); | 147 host_impl_.pending_tree()->LayerById(id_)); |
| 147 pending_layer_->DoPostCommitInitializationIfNeeded(); | 148 pending_layer_->DoPostCommitInitializationIfNeeded(); |
| 148 } | 149 } |
| 149 | 150 |
| 150 void SetupDrawPropertiesAndUpdateTiles(FakePictureLayerImpl* layer, | 151 void SetupDrawPropertiesAndUpdateTiles(FakePictureLayerImpl* layer, |
| 151 float ideal_contents_scale, | 152 float ideal_contents_scale, |
| 152 float device_scale_factor, | 153 float device_scale_factor, |
| (...skipping 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3452 pending_pile->set_is_mask(true); | 3453 pending_pile->set_is_mask(true); |
| 3453 scoped_ptr<FakePictureLayerImpl> mask = FakePictureLayerImpl::CreateWithPile( | 3454 scoped_ptr<FakePictureLayerImpl> mask = FakePictureLayerImpl::CreateWithPile( |
| 3454 host_impl_.pending_tree(), 3, pending_pile); | 3455 host_impl_.pending_tree(), 3, pending_pile); |
| 3455 | 3456 |
| 3456 mask->SetBounds(bounds); | 3457 mask->SetBounds(bounds); |
| 3457 mask->SetContentBounds(bounds); | 3458 mask->SetContentBounds(bounds); |
| 3458 mask->SetDrawsContent(true); | 3459 mask->SetDrawsContent(true); |
| 3459 | 3460 |
| 3460 FakePictureLayerImpl* pending_mask_content = mask.get(); | 3461 FakePictureLayerImpl* pending_mask_content = mask.get(); |
| 3461 layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); | 3462 layer_with_mask->SetMaskLayer(mask.PassAs<LayerImpl>()); |
| 3462 | 3463 layer_with_mask->SetHasRenderSurface(true); |
| 3463 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = | 3464 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = |
| 3464 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); | 3465 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); |
| 3465 | 3466 |
| 3466 child_of_layer_with_mask->SetBounds(bounds); | 3467 child_of_layer_with_mask->SetBounds(bounds); |
| 3467 child_of_layer_with_mask->SetContentBounds(bounds); | 3468 child_of_layer_with_mask->SetContentBounds(bounds); |
| 3468 child_of_layer_with_mask->SetDrawsContent(true); | 3469 child_of_layer_with_mask->SetDrawsContent(true); |
| 3469 | 3470 |
| 3470 layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); | 3471 layer_with_mask->AddChild(child_of_layer_with_mask.PassAs<LayerImpl>()); |
| 3471 | 3472 |
| 3472 root->AddChild(layer_with_mask.PassAs<LayerImpl>()); | 3473 root->AddChild(layer_with_mask.PassAs<LayerImpl>()); |
| 3473 | 3474 root->SetHasRenderSurface(true); |
| 3474 host_impl_.pending_tree()->SetRootLayer(root.Pass()); | 3475 host_impl_.pending_tree()->SetRootLayer(root.Pass()); |
| 3475 | 3476 |
| 3476 EXPECT_FALSE(pending_mask_content->tilings()); | 3477 EXPECT_FALSE(pending_mask_content->tilings()); |
| 3477 host_impl_.pending_tree()->UpdateDrawProperties(); | 3478 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 3478 EXPECT_NE(0u, pending_mask_content->num_tilings()); | 3479 EXPECT_NE(0u, pending_mask_content->num_tilings()); |
| 3479 } | 3480 } |
| 3480 | 3481 |
| 3481 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { | 3482 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { |
| 3482 public: | 3483 public: |
| 3483 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {} | 3484 PictureLayerImplTestWithDelegatingRenderer() : PictureLayerImplTest() {} |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4173 ActivateTree(); | 4174 ActivateTree(); |
| 4174 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); | 4175 EXPECT_TRUE(active_layer_->GetRecycledTwinLayer()); |
| 4175 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); | 4176 EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer()); |
| 4176 | 4177 |
| 4177 host_impl_.ResetRecycleTreeForTesting(); | 4178 host_impl_.ResetRecycleTreeForTesting(); |
| 4178 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); | 4179 EXPECT_FALSE(active_layer_->GetRecycledTwinLayer()); |
| 4179 } | 4180 } |
| 4180 | 4181 |
| 4181 } // namespace | 4182 } // namespace |
| 4182 } // namespace cc | 4183 } // namespace cc |
| OLD | NEW |