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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 pending_mask->HighResTiling()->AllTilesForTesting()); | 1363 pending_mask->HighResTiling()->AllTilesForTesting()); |
1364 | 1364 |
1365 ActivateTree(); | 1365 ActivateTree(); |
1366 | 1366 |
1367 FakePictureLayerImpl* active_mask = | 1367 FakePictureLayerImpl* active_mask = |
1368 static_cast<FakePictureLayerImpl*>(active_layer_->mask_layer()); | 1368 static_cast<FakePictureLayerImpl*>(active_layer_->mask_layer()); |
1369 | 1369 |
1370 // Mask layers have a tiling with a single tile in it. | 1370 // Mask layers have a tiling with a single tile in it. |
1371 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size()); | 1371 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size()); |
1372 // The mask resource exists. | 1372 // The mask resource exists. |
1373 ResourceProvider::ResourceId mask_resource_id; | 1373 ResourceId mask_resource_id; |
1374 gfx::Size mask_texture_size; | 1374 gfx::Size mask_texture_size; |
1375 active_mask->GetContentsResourceId(&mask_resource_id, &mask_texture_size); | 1375 active_mask->GetContentsResourceId(&mask_resource_id, &mask_texture_size); |
1376 EXPECT_NE(0u, mask_resource_id); | 1376 EXPECT_NE(0u, mask_resource_id); |
1377 EXPECT_EQ(active_mask->bounds(), mask_texture_size); | 1377 EXPECT_EQ(active_mask->bounds(), mask_texture_size); |
1378 | 1378 |
1379 // Drop resources and recreate them, still the same. | 1379 // Drop resources and recreate them, still the same. |
1380 pending_mask->ReleaseResources(); | 1380 pending_mask->ReleaseResources(); |
1381 active_mask->ReleaseResources(); | 1381 active_mask->ReleaseResources(); |
1382 pending_mask->RecreateResources(); | 1382 pending_mask->RecreateResources(); |
1383 active_mask->RecreateResources(); | 1383 active_mask->RecreateResources(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 pending_mask->HighResTiling()->AllTilesForTesting()); | 1505 pending_mask->HighResTiling()->AllTilesForTesting()); |
1506 | 1506 |
1507 ActivateTree(); | 1507 ActivateTree(); |
1508 | 1508 |
1509 FakePictureLayerImpl* active_mask = | 1509 FakePictureLayerImpl* active_mask = |
1510 static_cast<FakePictureLayerImpl*>(active_layer_->mask_layer()); | 1510 static_cast<FakePictureLayerImpl*>(active_layer_->mask_layer()); |
1511 | 1511 |
1512 // Mask layers have a tiling with a single tile in it. | 1512 // Mask layers have a tiling with a single tile in it. |
1513 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size()); | 1513 EXPECT_EQ(1u, active_mask->HighResTiling()->AllTilesForTesting().size()); |
1514 // The mask resource exists. | 1514 // The mask resource exists. |
1515 ResourceProvider::ResourceId mask_resource_id; | 1515 ResourceId mask_resource_id; |
1516 gfx::Size mask_texture_size; | 1516 gfx::Size mask_texture_size; |
1517 active_mask->GetContentsResourceId(&mask_resource_id, &mask_texture_size); | 1517 active_mask->GetContentsResourceId(&mask_resource_id, &mask_texture_size); |
1518 EXPECT_NE(0u, mask_resource_id); | 1518 EXPECT_NE(0u, mask_resource_id); |
1519 gfx::Size expected_mask_texture_size = | 1519 gfx::Size expected_mask_texture_size = |
1520 gfx::ToCeiledSize(gfx::ScaleSize(active_mask->bounds(), 1.3f)); | 1520 gfx::ToCeiledSize(gfx::ScaleSize(active_mask->bounds(), 1.3f)); |
1521 EXPECT_EQ(mask_texture_size, expected_mask_texture_size); | 1521 EXPECT_EQ(mask_texture_size, expected_mask_texture_size); |
1522 } | 1522 } |
1523 | 1523 |
1524 TEST_F(PictureLayerImplTest, ReleaseResources) { | 1524 TEST_F(PictureLayerImplTest, ReleaseResources) { |
1525 gfx::Size tile_size(400, 400); | 1525 gfx::Size tile_size(400, 400); |
(...skipping 3556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5082 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 5082 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
5083 EXPECT_EQ(result.width(), 448); | 5083 EXPECT_EQ(result.width(), 448); |
5084 EXPECT_EQ(result.height(), 448); | 5084 EXPECT_EQ(result.height(), 448); |
5085 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 5085 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
5086 EXPECT_EQ(result.width(), 512); | 5086 EXPECT_EQ(result.width(), 512); |
5087 EXPECT_EQ(result.height(), 500 + 2); | 5087 EXPECT_EQ(result.height(), 500 + 2); |
5088 } | 5088 } |
5089 | 5089 |
5090 } // namespace | 5090 } // namespace |
5091 } // namespace cc | 5091 } // namespace cc |
OLD | NEW |