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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 current_frame_time_in_seconds, | 46 current_frame_time_in_seconds, |
47 NULL, | 47 NULL, |
48 NULL, | 48 NULL, |
49 gfx::Transform()); | 49 gfx::Transform()); |
50 } | 50 } |
51 } | 51 } |
52 | 52 |
53 class TestablePictureLayerTiling : public PictureLayerTiling { | 53 class TestablePictureLayerTiling : public PictureLayerTiling { |
54 public: | 54 public: |
55 using PictureLayerTiling::SetLiveTilesRect; | 55 using PictureLayerTiling::SetLiveTilesRect; |
| 56 using PictureLayerTiling::UpdateTilesToCurrentPile; |
56 using PictureLayerTiling::TileAt; | 57 using PictureLayerTiling::TileAt; |
57 | 58 |
58 static scoped_ptr<TestablePictureLayerTiling> Create( | 59 static scoped_ptr<TestablePictureLayerTiling> Create( |
59 float contents_scale, | 60 float contents_scale, |
60 const gfx::Size& layer_bounds, | 61 const gfx::Size& layer_bounds, |
61 PictureLayerTilingClient* client) { | 62 PictureLayerTilingClient* client) { |
62 return make_scoped_ptr(new TestablePictureLayerTiling( | 63 return make_scoped_ptr(new TestablePictureLayerTiling( |
63 contents_scale, | 64 contents_scale, |
64 layer_bounds, | 65 layer_bounds, |
65 client)); | 66 client)); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 204 |
204 // Stop creating tiles so that any invalidations are left as holes. | 205 // Stop creating tiles so that any invalidations are left as holes. |
205 client_.set_allow_create_tile(false); | 206 client_.set_allow_create_tile(false); |
206 | 207 |
207 Region invalidation = | 208 Region invalidation = |
208 SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size)); | 209 SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size)); |
209 tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200)); | 210 tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200)); |
210 EXPECT_FALSE(tiling_->TileAt(0, 0)); | 211 EXPECT_FALSE(tiling_->TileAt(0, 0)); |
211 } | 212 } |
212 | 213 |
| 214 TEST_F(PictureLayerTilingIteratorTest, TestNameTBD) { |
| 215 Initialize(gfx::Size(256, 256), 1, gfx::Size(6920, 972)); |
| 216 SetLiveRectAndVerifyTiles(gfx::Rect(6920, 972)); |
| 217 |
| 218 tiling_->UpdateTilesToCurrentPile(gfx::Rect(), gfx::Size(6859, 972)); |
| 219 tiling_->UpdateTilesToCurrentPile(gfx::Rect(), gfx::Size(6540, 900)); |
| 220 tiling_->UpdateTilesToCurrentPile(gfx::Rect(), gfx::Size(6920, 972)); |
| 221 |
| 222 SetLiveRectAndVerifyTiles(gfx::Rect(6920, 972)); |
| 223 } |
| 224 |
213 TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) { | 225 TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) { |
214 // Verifies that a resize with invalidation for newly exposed pixels will | 226 // Verifies that a resize with invalidation for newly exposed pixels will |
215 // deletes tiles that intersect that invalidation. | 227 // deletes tiles that intersect that invalidation. |
216 gfx::Size tile_size(100, 100); | 228 gfx::Size tile_size(100, 100); |
217 gfx::Size original_layer_size(99, 99); | 229 gfx::Size original_layer_size(99, 99); |
218 Initialize(tile_size, 1.f, original_layer_size); | 230 Initialize(tile_size, 1.f, original_layer_size); |
219 SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size)); | 231 SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size)); |
220 | 232 |
221 // Tiling only has one tile, since its total size is less than one. | 233 // Tiling only has one tile, since its total size is less than one. |
222 EXPECT_TRUE(tiling_->TileAt(0, 0)); | 234 EXPECT_TRUE(tiling_->TileAt(0, 0)); |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin(); | 1955 for (std::vector<scoped_refptr<Tile> >::const_iterator it = tiles.begin(); |
1944 it != tiles.end(); | 1956 it != tiles.end(); |
1945 ++it) { | 1957 ++it) { |
1946 EXPECT_EQ(TilePriority(), (*it)->priority(ACTIVE_TREE)); | 1958 EXPECT_EQ(TilePriority(), (*it)->priority(ACTIVE_TREE)); |
1947 } | 1959 } |
1948 tiles.clear(); | 1960 tiles.clear(); |
1949 } | 1961 } |
1950 | 1962 |
1951 } // namespace | 1963 } // namespace |
1952 } // namespace cc | 1964 } // namespace cc |
OLD | NEW |