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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 void SetupPendingTreeInternal(scoped_refptr<RasterSource> raster_source, | 200 void SetupPendingTreeInternal(scoped_refptr<RasterSource> raster_source, |
201 const gfx::Size& tile_size, | 201 const gfx::Size& tile_size, |
202 const Region& invalidation) { | 202 const Region& invalidation) { |
203 host_impl_.CreatePendingTree(); | 203 host_impl_.CreatePendingTree(); |
204 host_impl_.pending_tree()->PushPageScaleFromMainThread(1.f, 0.25f, 100.f); | 204 host_impl_.pending_tree()->PushPageScaleFromMainThread(1.f, 0.25f, 100.f); |
205 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | 205 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); |
206 | 206 |
207 // Steal from the recycled tree if possible. | 207 // Steal from the recycled tree if possible. |
208 scoped_ptr<LayerImpl> pending_root = pending_tree->DetachLayerTree(); | 208 scoped_ptr<LayerImpl> pending_root = pending_tree->DetachLayerTree(); |
209 scoped_ptr<FakePictureLayerImpl> pending_layer; | 209 scoped_ptr<FakePictureLayerImpl> pending_layer; |
210 DCHECK_IMPLIES(pending_root, pending_root->id() == root_id_); | 210 DCHECK(!pending_root || pending_root->id() == root_id_); |
211 if (!pending_root) { | 211 if (!pending_root) { |
212 pending_root = LayerImpl::Create(pending_tree, root_id_); | 212 pending_root = LayerImpl::Create(pending_tree, root_id_); |
213 pending_layer = FakePictureLayerImpl::Create(pending_tree, id_); | 213 pending_layer = FakePictureLayerImpl::Create(pending_tree, id_); |
214 if (!tile_size.IsEmpty()) | 214 if (!tile_size.IsEmpty()) |
215 pending_layer->set_fixed_tile_size(tile_size); | 215 pending_layer->set_fixed_tile_size(tile_size); |
216 pending_layer->SetDrawsContent(true); | 216 pending_layer->SetDrawsContent(true); |
217 } else { | 217 } else { |
218 pending_layer.reset(static_cast<FakePictureLayerImpl*>( | 218 pending_layer.reset(static_cast<FakePictureLayerImpl*>( |
219 pending_root->RemoveChild(pending_root->children()[0]).release())); | 219 pending_root->RemoveChild(pending_root->children()[0]).release())); |
220 if (!tile_size.IsEmpty()) | 220 if (!tile_size.IsEmpty()) |
(...skipping 4730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4951 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4951 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4952 EXPECT_EQ(result.width(), 448); | 4952 EXPECT_EQ(result.width(), 448); |
4953 EXPECT_EQ(result.height(), 448); | 4953 EXPECT_EQ(result.height(), 448); |
4954 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4954 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4955 EXPECT_EQ(result.width(), 512); | 4955 EXPECT_EQ(result.width(), 512); |
4956 EXPECT_EQ(result.height(), 500 + 2); | 4956 EXPECT_EQ(result.height(), 500 + 2); |
4957 } | 4957 } |
4958 | 4958 |
4959 } // namespace | 4959 } // namespace |
4960 } // namespace cc | 4960 } // namespace cc |
OLD | NEW |