| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 pending_layer = FakePictureLayerImpl::Create(pending_tree, id_); | 202 pending_layer = FakePictureLayerImpl::Create(pending_tree, id_); |
| 203 if (!tile_size.IsEmpty()) | 203 if (!tile_size.IsEmpty()) |
| 204 pending_layer->set_fixed_tile_size(tile_size); | 204 pending_layer->set_fixed_tile_size(tile_size); |
| 205 pending_layer->SetDrawsContent(true); | 205 pending_layer->SetDrawsContent(true); |
| 206 } else { | 206 } else { |
| 207 pending_layer.reset(static_cast<FakePictureLayerImpl*>( | 207 pending_layer.reset(static_cast<FakePictureLayerImpl*>( |
| 208 pending_root->RemoveChild(pending_root->children()[0]).release())); | 208 pending_root->RemoveChild(pending_root->children()[0]).release())); |
| 209 if (!tile_size.IsEmpty()) | 209 if (!tile_size.IsEmpty()) |
| 210 pending_layer->set_fixed_tile_size(tile_size); | 210 pending_layer->set_fixed_tile_size(tile_size); |
| 211 } | 211 } |
| 212 pending_root->SetHasRenderSurface(true); |
| 212 // The bounds() just mirror the pile size. | 213 // The bounds() just mirror the pile size. |
| 213 pending_layer->SetBounds(raster_source->GetSize()); | 214 pending_layer->SetBounds(raster_source->GetSize()); |
| 214 pending_layer->SetContentBounds(raster_source->GetSize()); | 215 pending_layer->SetContentBounds(raster_source->GetSize()); |
| 215 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); | 216 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); |
| 216 | 217 |
| 217 pending_root->AddChild(pending_layer.Pass()); | 218 pending_root->AddChild(pending_layer.Pass()); |
| 218 pending_tree->SetRootLayer(pending_root.Pass()); | 219 pending_tree->SetRootLayer(pending_root.Pass()); |
| 219 | 220 |
| 220 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 221 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
| 221 host_impl_.pending_tree()->LayerById(id_)); | 222 host_impl_.pending_tree()->LayerById(id_)); |
| (...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1203 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1203 SetupPendingTree(valid_pile); | 1204 SetupPendingTree(valid_pile); |
| 1204 | 1205 |
| 1205 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1206 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
| 1206 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1207 FakePictureLayerImpl::CreateMaskWithRasterSource( |
| 1207 host_impl_.pending_tree(), 3, valid_pile); | 1208 host_impl_.pending_tree(), 3, valid_pile); |
| 1208 mask_ptr->SetBounds(layer_bounds); | 1209 mask_ptr->SetBounds(layer_bounds); |
| 1209 mask_ptr->SetContentBounds(layer_bounds); | 1210 mask_ptr->SetContentBounds(layer_bounds); |
| 1210 mask_ptr->SetDrawsContent(true); | 1211 mask_ptr->SetDrawsContent(true); |
| 1211 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1212 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
| 1213 pending_layer_->SetHasRenderSurface(true); |
| 1212 | 1214 |
| 1213 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1215 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1214 host_impl_.SetCurrentBeginFrameArgs( | 1216 host_impl_.SetCurrentBeginFrameArgs( |
| 1215 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1217 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1216 host_impl_.pending_tree()->UpdateDrawProperties(); | 1218 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 1217 | 1219 |
| 1218 FakePictureLayerImpl* pending_mask = | 1220 FakePictureLayerImpl* pending_mask = |
| 1219 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1221 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
| 1220 | 1222 |
| 1221 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); | 1223 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1337 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1336 SetupPendingTree(valid_pile); | 1338 SetupPendingTree(valid_pile); |
| 1337 | 1339 |
| 1338 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1340 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
| 1339 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1341 FakePictureLayerImpl::CreateMaskWithRasterSource( |
| 1340 host_impl_.pending_tree(), 3, valid_pile); | 1342 host_impl_.pending_tree(), 3, valid_pile); |
| 1341 mask_ptr->SetBounds(layer_bounds); | 1343 mask_ptr->SetBounds(layer_bounds); |
| 1342 mask_ptr->SetContentBounds(layer_bounds); | 1344 mask_ptr->SetContentBounds(layer_bounds); |
| 1343 mask_ptr->SetDrawsContent(true); | 1345 mask_ptr->SetDrawsContent(true); |
| 1344 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1346 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
| 1347 pending_layer_->SetHasRenderSurface(true); |
| 1345 | 1348 |
| 1346 time_ticks += base::TimeDelta::FromMilliseconds(1); | 1349 time_ticks += base::TimeDelta::FromMilliseconds(1); |
| 1347 host_impl_.SetCurrentBeginFrameArgs( | 1350 host_impl_.SetCurrentBeginFrameArgs( |
| 1348 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 1351 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
| 1349 host_impl_.pending_tree()->UpdateDrawProperties(); | 1352 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 1350 | 1353 |
| 1351 FakePictureLayerImpl* pending_mask = | 1354 FakePictureLayerImpl* pending_mask = |
| 1352 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1355 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
| 1353 | 1356 |
| 1354 // Masks are scaled, and do not have a low res tiling. | 1357 // Masks are scaled, and do not have a low res tiling. |
| (...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4730 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4733 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 4731 EXPECT_EQ(result.width(), 448); | 4734 EXPECT_EQ(result.width(), 448); |
| 4732 EXPECT_EQ(result.height(), 448); | 4735 EXPECT_EQ(result.height(), 448); |
| 4733 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4736 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 4734 EXPECT_EQ(result.width(), 512); | 4737 EXPECT_EQ(result.width(), 512); |
| 4735 EXPECT_EQ(result.height(), 500 + 2); | 4738 EXPECT_EQ(result.height(), 500 + 2); |
| 4736 } | 4739 } |
| 4737 | 4740 |
| 4738 } // namespace | 4741 } // namespace |
| 4739 } // namespace cc | 4742 } // namespace cc |
| OLD | NEW |