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 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2481 | 2481 |
2482 gfx::Size layer_bounds(4000, 4000); | 2482 gfx::Size layer_bounds(4000, 4000); |
2483 SetupDefaultTrees(layer_bounds); | 2483 SetupDefaultTrees(layer_bounds); |
2484 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); | 2484 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); |
2485 | 2485 |
2486 // Should only have the high-res tiling. | 2486 // Should only have the high-res tiling. |
2487 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings()); | 2487 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings()); |
2488 | 2488 |
2489 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); | 2489 active_layer_->HighResTiling()->UpdateAllRequiredStateForTesting(); |
2490 | 2490 |
2491 // High res tiling should have 36 tiles (3X12 tile grid). | 2491 // High res tiling should have 64 tiles (4x16 tile grid). |
2492 EXPECT_EQ(36u, active_layer_->HighResTiling()->AllTilesForTesting().size()); | 2492 EXPECT_EQ(64u, active_layer_->HighResTiling()->AllTilesForTesting().size()); |
2493 | 2493 |
2494 // Visible viewport should be covered by 4 tiles. No other | 2494 // Visible viewport should be covered by 4 tiles. No other |
2495 // tiles should be required for activation. | 2495 // tiles should be required for activation. |
2496 EXPECT_EQ(4u, NumberOfTilesRequired(active_layer_->HighResTiling())); | 2496 EXPECT_EQ(4u, NumberOfTilesRequired(active_layer_->HighResTiling())); |
2497 } | 2497 } |
2498 | 2498 |
2499 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) { | 2499 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) { |
2500 // Set up layers with tilings. | 2500 // Set up layers with tilings. |
2501 SetupDefaultTrees(gfx::Size(10, 10)); | 2501 SetupDefaultTrees(gfx::Size(10, 10)); |
2502 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, 1.f, 0.f, false); | 2502 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, 1.f, 0.f, false); |
(...skipping 2448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4951 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 4951 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
4952 EXPECT_EQ(result.width(), 448); | 4952 EXPECT_EQ(result.width(), 448); |
4953 EXPECT_EQ(result.height(), 448); | 4953 EXPECT_EQ(result.height(), 448); |
4954 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 4954 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
4955 EXPECT_EQ(result.width(), 512); | 4955 EXPECT_EQ(result.width(), 512); |
4956 EXPECT_EQ(result.height(), 500 + 2); | 4956 EXPECT_EQ(result.height(), 500 + 2); |
4957 } | 4957 } |
4958 | 4958 |
4959 } // namespace | 4959 } // namespace |
4960 } // namespace cc | 4960 } // namespace cc |
OLD | NEW |