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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if (!tile_size.IsEmpty()) | 247 if (!tile_size.IsEmpty()) |
248 pending_layer->set_fixed_tile_size(tile_size); | 248 pending_layer->set_fixed_tile_size(tile_size); |
249 pending_layer->SetDrawsContent(true); | 249 pending_layer->SetDrawsContent(true); |
250 } else { | 250 } else { |
251 pending_layer.reset(static_cast<FakePictureLayerImpl*>( | 251 pending_layer.reset(static_cast<FakePictureLayerImpl*>( |
252 pending_root->RemoveChild(pending_root->children()[0].get()) | 252 pending_root->RemoveChild(pending_root->children()[0].get()) |
253 .release())); | 253 .release())); |
254 if (!tile_size.IsEmpty()) | 254 if (!tile_size.IsEmpty()) |
255 pending_layer->set_fixed_tile_size(tile_size); | 255 pending_layer->set_fixed_tile_size(tile_size); |
256 } | 256 } |
257 pending_root->SetHasRenderSurface(true); | 257 pending_root->SetForceRenderSurface(true); |
258 // The bounds() just mirror the raster source size. | 258 // The bounds() just mirror the raster source size. |
259 pending_layer->SetBounds(raster_source->GetSize()); | 259 pending_layer->SetBounds(raster_source->GetSize()); |
260 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); | 260 pending_layer->SetRasterSourceOnPending(raster_source, invalidation); |
261 | 261 |
262 pending_root->AddChild(std::move(pending_layer)); | 262 pending_root->AddChild(std::move(pending_layer)); |
263 pending_tree->SetRootLayer(std::move(pending_root)); | 263 pending_tree->SetRootLayer(std::move(pending_root)); |
264 | 264 |
265 pending_layer_ = static_cast<FakePictureLayerImpl*>( | 265 pending_layer_ = static_cast<FakePictureLayerImpl*>( |
266 host_impl_.pending_tree()->LayerById(id_)); | 266 host_impl_.pending_tree()->LayerById(id_)); |
267 | 267 |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1393 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source = | 1393 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source = |
1394 FakeDisplayListRasterSource::CreateFilled(layer_bounds); | 1394 FakeDisplayListRasterSource::CreateFilled(layer_bounds); |
1395 SetupPendingTree(valid_raster_source); | 1395 SetupPendingTree(valid_raster_source); |
1396 | 1396 |
1397 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1397 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
1398 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1398 FakePictureLayerImpl::CreateMaskWithRasterSource( |
1399 host_impl_.pending_tree(), 3, valid_raster_source); | 1399 host_impl_.pending_tree(), 3, valid_raster_source); |
1400 mask_ptr->SetBounds(layer_bounds); | 1400 mask_ptr->SetBounds(layer_bounds); |
1401 mask_ptr->SetDrawsContent(true); | 1401 mask_ptr->SetDrawsContent(true); |
1402 pending_layer_->SetMaskLayer(std::move(mask_ptr)); | 1402 pending_layer_->SetMaskLayer(std::move(mask_ptr)); |
1403 pending_layer_->SetHasRenderSurface(true); | 1403 pending_layer_->SetForceRenderSurface(true); |
1404 | 1404 |
1405 RebuildPropertyTreesOnPendingTree(); | 1405 RebuildPropertyTreesOnPendingTree(); |
1406 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1406 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1407 bool update_lcd_text = false; | 1407 bool update_lcd_text = false; |
1408 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1408 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1409 | 1409 |
1410 FakePictureLayerImpl* pending_mask = | 1410 FakePictureLayerImpl* pending_mask = |
1411 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1411 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
1412 | 1412 |
1413 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); | 1413 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source = | 1522 scoped_refptr<FakeDisplayListRasterSource> valid_raster_source = |
1523 FakeDisplayListRasterSource::CreateFilled(layer_bounds); | 1523 FakeDisplayListRasterSource::CreateFilled(layer_bounds); |
1524 SetupPendingTree(valid_raster_source); | 1524 SetupPendingTree(valid_raster_source); |
1525 | 1525 |
1526 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1526 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
1527 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1527 FakePictureLayerImpl::CreateMaskWithRasterSource( |
1528 host_impl_.pending_tree(), 3, valid_raster_source); | 1528 host_impl_.pending_tree(), 3, valid_raster_source); |
1529 mask_ptr->SetBounds(layer_bounds); | 1529 mask_ptr->SetBounds(layer_bounds); |
1530 mask_ptr->SetDrawsContent(true); | 1530 mask_ptr->SetDrawsContent(true); |
1531 pending_layer_->SetMaskLayer(std::move(mask_ptr)); | 1531 pending_layer_->SetMaskLayer(std::move(mask_ptr)); |
1532 pending_layer_->SetHasRenderSurface(true); | 1532 pending_layer_->SetForceRenderSurface(true); |
1533 | 1533 |
1534 RebuildPropertyTreesOnPendingTree(); | 1534 RebuildPropertyTreesOnPendingTree(); |
1535 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1535 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1536 bool update_lcd_text = false; | 1536 bool update_lcd_text = false; |
1537 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1537 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1538 | 1538 |
1539 FakePictureLayerImpl* pending_mask = | 1539 FakePictureLayerImpl* pending_mask = |
1540 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1540 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
1541 | 1541 |
1542 // Masks are scaled, and do not have a low res tiling. | 1542 // Masks are scaled, and do not have a low res tiling. |
(...skipping 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5084 // New low res tiling. | 5084 // New low res tiling. |
5085 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); | 5085 EXPECT_TRUE(tilings->tiling_at(2)->may_contain_low_resolution_tiles()); |
5086 | 5086 |
5087 // This tiling will be high res now, it won't contain low res content since it | 5087 // This tiling will be high res now, it won't contain low res content since it |
5088 // was all destroyed. | 5088 // was all destroyed. |
5089 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); | 5089 EXPECT_FALSE(tilings->tiling_at(1)->may_contain_low_resolution_tiles()); |
5090 } | 5090 } |
5091 | 5091 |
5092 } // namespace | 5092 } // namespace |
5093 } // namespace cc | 5093 } // namespace cc |
OLD | NEW |