| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 | 183 |
| 184 protected: | 184 protected: |
| 185 FakePictureLayerTilingClient client_; | 185 FakePictureLayerTilingClient client_; |
| 186 scoped_ptr<TestablePictureLayerTiling> tiling_; | 186 scoped_ptr<TestablePictureLayerTiling> tiling_; |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest); | 189 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingIteratorTest); |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 TEST_F(PictureLayerTilingIteratorTest, ResizeDeletesTiles) { | |
| 193 // Verifies that a resize deletes tiles that used to be on the edge. | |
| 194 gfx::Size tile_size(100, 100); | |
| 195 gfx::Size original_layer_size(10, 10); | |
| 196 Initialize(tile_size, 1.f, original_layer_size); | |
| 197 SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size)); | |
| 198 | |
| 199 // Tiling only has one tile, since its total size is less than one. | |
| 200 EXPECT_TRUE(tiling_->TileAt(0, 0)); | |
| 201 | |
| 202 // Stop creating tiles so that any invalidations are left as holes. | |
| 203 client_.set_allow_create_tile(false); | |
| 204 | |
| 205 tiling_->SetLayerBounds(gfx::Size(200, 200)); | |
| 206 EXPECT_FALSE(tiling_->TileAt(0, 0)); | |
| 207 } | |
| 208 | |
| 209 TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) { | 192 TEST_F(PictureLayerTilingIteratorTest, LiveTilesExactlyCoverLiveTileRect) { |
| 210 Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801)); | 193 Initialize(gfx::Size(100, 100), 1, gfx::Size(1099, 801)); |
| 211 SetLiveRectAndVerifyTiles(gfx::Rect(100, 100)); | 194 SetLiveRectAndVerifyTiles(gfx::Rect(100, 100)); |
| 212 SetLiveRectAndVerifyTiles(gfx::Rect(101, 99)); | 195 SetLiveRectAndVerifyTiles(gfx::Rect(101, 99)); |
| 213 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1)); | 196 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1)); |
| 214 SetLiveRectAndVerifyTiles(gfx::Rect(1, 801)); | 197 SetLiveRectAndVerifyTiles(gfx::Rect(1, 801)); |
| 215 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1)); | 198 SetLiveRectAndVerifyTiles(gfx::Rect(1099, 1)); |
| 216 SetLiveRectAndVerifyTiles(gfx::Rect(201, 800)); | 199 SetLiveRectAndVerifyTiles(gfx::Rect(201, 800)); |
| 217 } | 200 } |
| 218 | 201 |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1812 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | 1795 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); |
| 1813 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | 1796 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); |
| 1814 | 1797 |
| 1815 priority = tiling->TileAt(1, 0)->priority(ACTIVE_TREE); | 1798 priority = tiling->TileAt(1, 0)->priority(ACTIVE_TREE); |
| 1816 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | 1799 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); |
| 1817 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | 1800 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); |
| 1818 } | 1801 } |
| 1819 | 1802 |
| 1820 } // namespace | 1803 } // namespace |
| 1821 } // namespace cc | 1804 } // namespace cc |
| OLD | NEW |