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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 SetupPendingTree(valid_pile); | 1316 SetupPendingTree(valid_pile); |
1317 | 1317 |
1318 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1318 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
1319 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1319 FakePictureLayerImpl::CreateMaskWithRasterSource( |
1320 host_impl_.pending_tree(), 3, valid_pile); | 1320 host_impl_.pending_tree(), 3, valid_pile); |
1321 mask_ptr->SetBounds(layer_bounds); | 1321 mask_ptr->SetBounds(layer_bounds); |
1322 mask_ptr->SetDrawsContent(true); | 1322 mask_ptr->SetDrawsContent(true); |
1323 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1323 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
1324 pending_layer_->SetHasRenderSurface(true); | 1324 pending_layer_->SetHasRenderSurface(true); |
1325 | 1325 |
| 1326 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); |
1326 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1327 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1327 bool update_lcd_text = false; | 1328 bool update_lcd_text = false; |
1328 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1329 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1329 | 1330 |
1330 FakePictureLayerImpl* pending_mask = | 1331 FakePictureLayerImpl* pending_mask = |
1331 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1332 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
1332 | 1333 |
1333 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); | 1334 EXPECT_EQ(1.f, pending_mask->HighResTiling()->contents_scale()); |
1334 EXPECT_EQ(1u, pending_mask->num_tilings()); | 1335 EXPECT_EQ(1u, pending_mask->num_tilings()); |
1335 | 1336 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 SetupPendingTree(valid_pile); | 1446 SetupPendingTree(valid_pile); |
1446 | 1447 |
1447 scoped_ptr<FakePictureLayerImpl> mask_ptr = | 1448 scoped_ptr<FakePictureLayerImpl> mask_ptr = |
1448 FakePictureLayerImpl::CreateMaskWithRasterSource( | 1449 FakePictureLayerImpl::CreateMaskWithRasterSource( |
1449 host_impl_.pending_tree(), 3, valid_pile); | 1450 host_impl_.pending_tree(), 3, valid_pile); |
1450 mask_ptr->SetBounds(layer_bounds); | 1451 mask_ptr->SetBounds(layer_bounds); |
1451 mask_ptr->SetDrawsContent(true); | 1452 mask_ptr->SetDrawsContent(true); |
1452 pending_layer_->SetMaskLayer(mask_ptr.Pass()); | 1453 pending_layer_->SetMaskLayer(mask_ptr.Pass()); |
1453 pending_layer_->SetHasRenderSurface(true); | 1454 pending_layer_->SetHasRenderSurface(true); |
1454 | 1455 |
| 1456 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); |
1455 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1457 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1456 bool update_lcd_text = false; | 1458 bool update_lcd_text = false; |
1457 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 1459 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
1458 | 1460 |
1459 FakePictureLayerImpl* pending_mask = | 1461 FakePictureLayerImpl* pending_mask = |
1460 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); | 1462 static_cast<FakePictureLayerImpl*>(pending_layer_->mask_layer()); |
1461 | 1463 |
1462 // Masks are scaled, and do not have a low res tiling. | 1464 // Masks are scaled, and do not have a low res tiling. |
1463 EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale()); | 1465 EXPECT_EQ(1.3f, pending_mask->HighResTiling()->contents_scale()); |
1464 EXPECT_EQ(1u, pending_mask->num_tilings()); | 1466 EXPECT_EQ(1u, pending_mask->num_tilings()); |
(...skipping 3486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4951 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4953 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4952 EXPECT_EQ(result.width(), 448); | 4954 EXPECT_EQ(result.width(), 448); |
4953 EXPECT_EQ(result.height(), 448); | 4955 EXPECT_EQ(result.height(), 448); |
4954 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4956 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4955 EXPECT_EQ(result.width(), 512); | 4957 EXPECT_EQ(result.width(), 512); |
4956 EXPECT_EQ(result.height(), 500 + 2); | 4958 EXPECT_EQ(result.height(), 500 + 2); |
4957 } | 4959 } |
4958 | 4960 |
4959 } // namespace | 4961 } // namespace |
4960 } // namespace cc | 4962 } // namespace cc |
OLD | NEW |