| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/picture_layer_tiling.h" | 5 #include "cc/resources/picture_layer_tiling.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 1998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 active_tiling->ComputeTilePriorityRects(gfx::Rect(9000, 9000, 100, 100), 1.0f, | 2009 active_tiling->ComputeTilePriorityRects(gfx::Rect(9000, 9000, 100, 100), 1.0f, |
| 2010 2.0, Occlusion()); | 2010 2.0, Occlusion()); |
| 2011 // Ensure the tile was deleted on both tilings. | 2011 // Ensure the tile was deleted on both tilings. |
| 2012 EXPECT_FALSE(active_tiling->TileAt(0, 0)); | 2012 EXPECT_FALSE(active_tiling->TileAt(0, 0)); |
| 2013 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 2013 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
| 2014 | 2014 |
| 2015 // Move the viewport back to (0, 0) tile. | 2015 // Move the viewport back to (0, 0) tile. |
| 2016 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 3.0, | 2016 active_tiling->ComputeTilePriorityRects(gfx::Rect(0, 0, 100, 100), 1.0f, 3.0, |
| 2017 Occlusion()); | 2017 Occlusion()); |
| 2018 | 2018 |
| 2019 // Ensure that we now have a tile here, but the recycle tiling does not. | 2019 // Ensure that we now have a tile here on both tilings again. |
| 2020 EXPECT_TRUE(active_tiling->TileAt(0, 0)); | 2020 EXPECT_TRUE(active_tiling->TileAt(0, 0)); |
| 2021 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 2021 EXPECT_TRUE(recycle_tiling->TileAt(0, 0)); |
| 2022 } | 2022 } |
| 2023 | 2023 |
| 2024 TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { | 2024 TEST(PictureLayerTilingTest, RecycledTilesClearedOnReset) { |
| 2025 FakePictureLayerTilingClient active_client; | 2025 FakePictureLayerTilingClient active_client; |
| 2026 scoped_ptr<TestablePictureLayerTiling> active_tiling; | 2026 scoped_ptr<TestablePictureLayerTiling> active_tiling; |
| 2027 | 2027 |
| 2028 active_client.SetTileSize(gfx::Size(100, 100)); | 2028 active_client.SetTileSize(gfx::Size(100, 100)); |
| 2029 active_client.set_tree(ACTIVE_TREE); | 2029 active_client.set_tree(ACTIVE_TREE); |
| 2030 active_tiling = TestablePictureLayerTiling::Create( | 2030 active_tiling = TestablePictureLayerTiling::Create( |
| 2031 1.0f, // contents_scale | 2031 1.0f, // contents_scale |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 tiling_->Resize(gfx::Size(250, 150)); | 2084 tiling_->Resize(gfx::Size(250, 150)); |
| 2085 | 2085 |
| 2086 // Tile size in the tiling should be resized to 250x200. | 2086 // Tile size in the tiling should be resized to 250x200. |
| 2087 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); | 2087 EXPECT_EQ(250, tiling_->TilingDataForTesting().max_texture_size().width()); |
| 2088 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); | 2088 EXPECT_EQ(200, tiling_->TilingDataForTesting().max_texture_size().height()); |
| 2089 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size()); | 2089 EXPECT_EQ(0u, tiling_->AllRefTilesForTesting().size()); |
| 2090 } | 2090 } |
| 2091 | 2091 |
| 2092 } // namespace | 2092 } // namespace |
| 2093 } // namespace cc | 2093 } // namespace cc |
| OLD | NEW |