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