| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 scoped_ptr<FakePictureLayerImpl> pending_layer; | 144 scoped_ptr<FakePictureLayerImpl> pending_layer; |
| 145 if (old_pending_root) { | 145 if (old_pending_root) { |
| 146 pending_layer.reset( | 146 pending_layer.reset( |
| 147 static_cast<FakePictureLayerImpl*>(old_pending_root.release())); | 147 static_cast<FakePictureLayerImpl*>(old_pending_root.release())); |
| 148 pending_layer->SetRasterSource(raster_source); | 148 pending_layer->SetRasterSource(raster_source); |
| 149 } else { | 149 } else { |
| 150 pending_layer = FakePictureLayerImpl::CreateWithRasterSource( | 150 pending_layer = FakePictureLayerImpl::CreateWithRasterSource( |
| 151 pending_tree, id_, raster_source); | 151 pending_tree, id_, raster_source); |
| 152 pending_layer->SetDrawsContent(true); | 152 pending_layer->SetDrawsContent(true); |
| 153 pending_layer->SetHasRenderSurface(true); |
| 153 } | 154 } |
| 154 // The bounds() just mirror the pile size. | 155 // The bounds() just mirror the pile size. |
| 155 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | 156 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); |
| 156 pending_tree->SetRootLayer(pending_layer.Pass()); | 157 pending_tree->SetRootLayer(pending_layer.Pass()); |
| 157 | 158 |
| 158 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 159 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
| 159 host_impl_.pending_tree()->LayerById(id_)); | 160 host_impl_.pending_tree()->LayerById(id_)); |
| 160 pending_layer_->DoPostCommitInitializationIfNeeded(); | 161 pending_layer_->DoPostCommitInitializationIfNeeded(); |
| 161 } | 162 } |
| 162 | 163 |
| (...skipping 3571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3734 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 3, | 3735 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 3, |
| 3735 pending_pile); | 3736 pending_pile); |
| 3736 mask->set_is_mask(true); | 3737 mask->set_is_mask(true); |
| 3737 | 3738 |
| 3738 mask->SetBounds(bounds); | 3739 mask->SetBounds(bounds); |
| 3739 mask->SetContentBounds(bounds); | 3740 mask->SetContentBounds(bounds); |
| 3740 mask->SetDrawsContent(true); | 3741 mask->SetDrawsContent(true); |
| 3741 | 3742 |
| 3742 FakePictureLayerImpl* pending_mask_content = mask.get(); | 3743 FakePictureLayerImpl* pending_mask_content = mask.get(); |
| 3743 layer_with_mask->SetMaskLayer(mask.Pass()); | 3744 layer_with_mask->SetMaskLayer(mask.Pass()); |
| 3745 layer_with_mask->SetHasRenderSurface(true); |
| 3744 | 3746 |
| 3745 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = | 3747 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = |
| 3746 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); | 3748 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); |
| 3747 | 3749 |
| 3748 child_of_layer_with_mask->SetBounds(bounds); | 3750 child_of_layer_with_mask->SetBounds(bounds); |
| 3749 child_of_layer_with_mask->SetContentBounds(bounds); | 3751 child_of_layer_with_mask->SetContentBounds(bounds); |
| 3750 child_of_layer_with_mask->SetDrawsContent(true); | 3752 child_of_layer_with_mask->SetDrawsContent(true); |
| 3751 | 3753 |
| 3752 layer_with_mask->AddChild(child_of_layer_with_mask.Pass()); | 3754 layer_with_mask->AddChild(child_of_layer_with_mask.Pass()); |
| 3753 | 3755 |
| 3754 root->AddChild(layer_with_mask.Pass()); | 3756 root->AddChild(layer_with_mask.Pass()); |
| 3757 root->SetHasRenderSurface(true); |
| 3755 | 3758 |
| 3756 host_impl_.pending_tree()->SetRootLayer(root.Pass()); | 3759 host_impl_.pending_tree()->SetRootLayer(root.Pass()); |
| 3757 | 3760 |
| 3758 EXPECT_FALSE(pending_mask_content->tilings()); | 3761 EXPECT_FALSE(pending_mask_content->tilings()); |
| 3759 host_impl_.pending_tree()->UpdateDrawProperties(); | 3762 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 3760 EXPECT_NE(0u, pending_mask_content->num_tilings()); | 3763 EXPECT_NE(0u, pending_mask_content->num_tilings()); |
| 3761 } | 3764 } |
| 3762 | 3765 |
| 3763 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { | 3766 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { |
| 3764 public: | 3767 public: |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4735 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4738 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4736 EXPECT_EQ(result.width(), 448); | 4739 EXPECT_EQ(result.width(), 448); |
| 4737 EXPECT_EQ(result.height(), 448); | 4740 EXPECT_EQ(result.height(), 448); |
| 4738 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4741 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4739 EXPECT_EQ(result.width(), 512); | 4742 EXPECT_EQ(result.width(), 512); |
| 4740 EXPECT_EQ(result.height(), 500 + 2); | 4743 EXPECT_EQ(result.height(), 500 + 2); |
| 4741 } | 4744 } |
| 4742 | 4745 |
| 4743 } // namespace | 4746 } // namespace |
| 4744 } // namespace cc | 4747 } // namespace cc |
| OLD | NEW |