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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 scoped_ptr<FakePictureLayerImpl> pending_layer; | 146 scoped_ptr<FakePictureLayerImpl> pending_layer; |
147 if (old_pending_root) { | 147 if (old_pending_root) { |
148 pending_layer.reset( | 148 pending_layer.reset( |
149 static_cast<FakePictureLayerImpl*>(old_pending_root.release())); | 149 static_cast<FakePictureLayerImpl*>(old_pending_root.release())); |
150 pending_layer->SetRasterSource(raster_source); | 150 pending_layer->SetRasterSource(raster_source); |
151 } else { | 151 } else { |
152 pending_layer = FakePictureLayerImpl::CreateWithRasterSource( | 152 pending_layer = FakePictureLayerImpl::CreateWithRasterSource( |
153 pending_tree, id_, raster_source); | 153 pending_tree, id_, raster_source); |
154 pending_layer->SetDrawsContent(true); | 154 pending_layer->SetDrawsContent(true); |
| 155 pending_layer->SetHasRenderSurface(true); |
155 } | 156 } |
156 // The bounds() just mirror the pile size. | 157 // The bounds() just mirror the pile size. |
157 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | 158 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); |
158 pending_tree->SetRootLayer(pending_layer.Pass()); | 159 pending_tree->SetRootLayer(pending_layer.Pass()); |
159 | 160 |
160 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 161 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
161 host_impl_.pending_tree()->LayerById(id_)); | 162 host_impl_.pending_tree()->LayerById(id_)); |
162 pending_layer_->DoPostCommitInitializationIfNeeded(); | 163 pending_layer_->DoPostCommitInitializationIfNeeded(); |
163 } | 164 } |
164 | 165 |
(...skipping 3555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3720 scoped_ptr<FakePictureLayerImpl> mask = | 3721 scoped_ptr<FakePictureLayerImpl> mask = |
3721 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 3, | 3722 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 3, |
3722 pending_pile); | 3723 pending_pile); |
3723 | 3724 |
3724 mask->SetBounds(bounds); | 3725 mask->SetBounds(bounds); |
3725 mask->SetContentBounds(bounds); | 3726 mask->SetContentBounds(bounds); |
3726 mask->SetDrawsContent(true); | 3727 mask->SetDrawsContent(true); |
3727 | 3728 |
3728 FakePictureLayerImpl* pending_mask_content = mask.get(); | 3729 FakePictureLayerImpl* pending_mask_content = mask.get(); |
3729 layer_with_mask->SetMaskLayer(mask.Pass()); | 3730 layer_with_mask->SetMaskLayer(mask.Pass()); |
| 3731 layer_with_mask->SetHasRenderSurface(true); |
3730 | 3732 |
3731 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = | 3733 scoped_ptr<FakePictureLayerImpl> child_of_layer_with_mask = |
3732 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); | 3734 FakePictureLayerImpl::Create(host_impl_.pending_tree(), 4); |
3733 | 3735 |
3734 child_of_layer_with_mask->SetBounds(bounds); | 3736 child_of_layer_with_mask->SetBounds(bounds); |
3735 child_of_layer_with_mask->SetContentBounds(bounds); | 3737 child_of_layer_with_mask->SetContentBounds(bounds); |
3736 child_of_layer_with_mask->SetDrawsContent(true); | 3738 child_of_layer_with_mask->SetDrawsContent(true); |
3737 | 3739 |
3738 layer_with_mask->AddChild(child_of_layer_with_mask.Pass()); | 3740 layer_with_mask->AddChild(child_of_layer_with_mask.Pass()); |
3739 | 3741 |
3740 root->AddChild(layer_with_mask.Pass()); | 3742 root->AddChild(layer_with_mask.Pass()); |
| 3743 root->SetHasRenderSurface(true); |
3741 | 3744 |
3742 host_impl_.pending_tree()->SetRootLayer(root.Pass()); | 3745 host_impl_.pending_tree()->SetRootLayer(root.Pass()); |
3743 | 3746 |
3744 EXPECT_FALSE(pending_mask_content->tilings()); | 3747 EXPECT_FALSE(pending_mask_content->tilings()); |
3745 host_impl_.pending_tree()->UpdateDrawProperties(); | 3748 host_impl_.pending_tree()->UpdateDrawProperties(); |
3746 EXPECT_NE(0u, pending_mask_content->num_tilings()); | 3749 EXPECT_NE(0u, pending_mask_content->num_tilings()); |
3747 } | 3750 } |
3748 | 3751 |
3749 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { | 3752 class PictureLayerImplTestWithDelegatingRenderer : public PictureLayerImplTest { |
3750 public: | 3753 public: |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4722 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4725 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4723 EXPECT_EQ(result.width(), 448); | 4726 EXPECT_EQ(result.width(), 448); |
4724 EXPECT_EQ(result.height(), 448); | 4727 EXPECT_EQ(result.height(), 448); |
4725 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4728 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4726 EXPECT_EQ(result.width(), 512); | 4729 EXPECT_EQ(result.width(), 512); |
4727 EXPECT_EQ(result.height(), 500 + 2); | 4730 EXPECT_EQ(result.height(), 500 + 2); |
4728 } | 4731 } |
4729 | 4732 |
4730 } // namespace | 4733 } // namespace |
4731 } // namespace cc | 4734 } // namespace cc |
OLD | NEW |