| 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 2537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2548 | 2548 |
| 2549 gfx::Size layer_bounds(4000, 4000); | 2549 gfx::Size layer_bounds(4000, 4000); |
| 2550 SetupDefaultTrees(layer_bounds); | 2550 SetupDefaultTrees(layer_bounds); |
| 2551 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); | 2551 EXPECT_TRUE(host_impl_.use_gpu_rasterization()); |
| 2552 | 2552 |
| 2553 // Should only have the high-res tiling. | 2553 // Should only have the high-res tiling. |
| 2554 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings()); | 2554 EXPECT_EQ(1u, active_layer_->tilings()->num_tilings()); |
| 2555 | 2555 |
| 2556 active_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); | 2556 active_layer_->HighResTiling()->UpdateAllTilePrioritiesForTesting(); |
| 2557 | 2557 |
| 2558 // High res tiling should have 64 tiles (4x16 tile grid). | 2558 // High res tiling should have 36 tiles (3X12 tile grid). |
| 2559 EXPECT_EQ(64u, active_layer_->HighResTiling()->AllTilesForTesting().size()); | 2559 EXPECT_EQ(36u, active_layer_->HighResTiling()->AllTilesForTesting().size()); |
| 2560 | 2560 |
| 2561 // Visible viewport should be covered by 4 tiles. No other | 2561 // Visible viewport should be covered by 4 tiles. No other |
| 2562 // tiles should be required for activation. | 2562 // tiles should be required for activation. |
| 2563 EXPECT_EQ(4u, NumberOfTilesRequired(active_layer_->HighResTiling())); | 2563 EXPECT_EQ(4u, NumberOfTilesRequired(active_layer_->HighResTiling())); |
| 2564 } | 2564 } |
| 2565 | 2565 |
| 2566 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) { | 2566 TEST_F(PictureLayerImplTest, NoTilingIfDoesNotDrawContent) { |
| 2567 // Set up layers with tilings. | 2567 // Set up layers with tilings. |
| 2568 SetupDefaultTrees(gfx::Size(10, 10)); | 2568 SetupDefaultTrees(gfx::Size(10, 10)); |
| 2569 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, 1.f, 0.f, false); | 2569 SetContentsScaleOnBothLayers(1.f, 1.f, 1.f, 1.f, 0.f, false); |
| (...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5025 result = layer->CalculateTileSize(gfx::Size(447, 400)); | 5025 result = layer->CalculateTileSize(gfx::Size(447, 400)); |
| 5026 EXPECT_EQ(result.width(), 448); | 5026 EXPECT_EQ(result.width(), 448); |
| 5027 EXPECT_EQ(result.height(), 448); | 5027 EXPECT_EQ(result.height(), 448); |
| 5028 result = layer->CalculateTileSize(gfx::Size(500, 499)); | 5028 result = layer->CalculateTileSize(gfx::Size(500, 499)); |
| 5029 EXPECT_EQ(result.width(), 512); | 5029 EXPECT_EQ(result.width(), 512); |
| 5030 EXPECT_EQ(result.height(), 500 + 2); | 5030 EXPECT_EQ(result.height(), 500 + 2); |
| 5031 } | 5031 } |
| 5032 | 5032 |
| 5033 } // namespace | 5033 } // namespace |
| 5034 } // namespace cc | 5034 } // namespace cc |
| OLD | NEW |