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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 static scoped_ptr<TestablePictureLayerTiling> Create( | 58 static scoped_ptr<TestablePictureLayerTiling> Create( |
59 float contents_scale, | 59 float contents_scale, |
60 const gfx::Size& layer_bounds, | 60 const gfx::Size& layer_bounds, |
61 PictureLayerTilingClient* client) { | 61 PictureLayerTilingClient* client) { |
62 return make_scoped_ptr(new TestablePictureLayerTiling( | 62 return make_scoped_ptr(new TestablePictureLayerTiling( |
63 contents_scale, | 63 contents_scale, |
64 layer_bounds, | 64 layer_bounds, |
65 client)); | 65 client)); |
66 } | 66 } |
67 | 67 |
| 68 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } |
| 69 |
68 using PictureLayerTiling::ComputeSkewport; | 70 using PictureLayerTiling::ComputeSkewport; |
69 | 71 |
70 protected: | 72 protected: |
71 TestablePictureLayerTiling(float contents_scale, | 73 TestablePictureLayerTiling(float contents_scale, |
72 const gfx::Size& layer_bounds, | 74 const gfx::Size& layer_bounds, |
73 PictureLayerTilingClient* client) | 75 PictureLayerTilingClient* client) |
74 : PictureLayerTiling(contents_scale, layer_bounds, client) { } | 76 : PictureLayerTiling(contents_scale, layer_bounds, client) { } |
75 }; | 77 }; |
76 | 78 |
77 class PictureLayerTilingIteratorTest : public testing::Test { | 79 class PictureLayerTilingIteratorTest : public testing::Test { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 205 |
204 // Stop creating tiles so that any invalidations are left as holes. | 206 // Stop creating tiles so that any invalidations are left as holes. |
205 client_.set_allow_create_tile(false); | 207 client_.set_allow_create_tile(false); |
206 | 208 |
207 Region invalidation = | 209 Region invalidation = |
208 SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size)); | 210 SubtractRegions(gfx::Rect(tile_size), gfx::Rect(original_layer_size)); |
209 tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200)); | 211 tiling_->UpdateTilesToCurrentPile(invalidation, gfx::Size(200, 200)); |
210 EXPECT_FALSE(tiling_->TileAt(0, 0)); | 212 EXPECT_FALSE(tiling_->TileAt(0, 0)); |
211 } | 213 } |
212 | 214 |
| 215 TEST_F(PictureLayerTilingIteratorTest, CreateMissingTilesStaysInsideLiveRect) { |
| 216 // The tiling has three rows and columns. |
| 217 Initialize(gfx::Size(100, 100), 1, gfx::Size(250, 250)); |
| 218 EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x()); |
| 219 EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_y()); |
| 220 |
| 221 // The live tiles rect is at the very edge of the right-most and |
| 222 // bottom-most tiles. Their border pixels would still be inside the live |
| 223 // tiles rect, but the tiles should not exist just for that. |
| 224 int right = tiling_->TilingDataForTesting().TileBounds(2, 2).x(); |
| 225 int bottom = tiling_->TilingDataForTesting().TileBounds(2, 2).y(); |
| 226 |
| 227 SetLiveRectAndVerifyTiles(gfx::Rect(right, bottom)); |
| 228 EXPECT_FALSE(tiling_->TileAt(2, 0)); |
| 229 EXPECT_FALSE(tiling_->TileAt(2, 1)); |
| 230 EXPECT_FALSE(tiling_->TileAt(2, 2)); |
| 231 EXPECT_FALSE(tiling_->TileAt(1, 2)); |
| 232 EXPECT_FALSE(tiling_->TileAt(0, 2)); |
| 233 |
| 234 // Verify CreateMissingTilesInLiveTilesRect respects this. |
| 235 tiling_->CreateMissingTilesInLiveTilesRect(); |
| 236 EXPECT_FALSE(tiling_->TileAt(2, 0)); |
| 237 EXPECT_FALSE(tiling_->TileAt(2, 1)); |
| 238 EXPECT_FALSE(tiling_->TileAt(2, 2)); |
| 239 EXPECT_FALSE(tiling_->TileAt(1, 2)); |
| 240 EXPECT_FALSE(tiling_->TileAt(0, 2)); |
| 241 } |
| 242 |
| 243 TEST_F(PictureLayerTilingIteratorTest, ResizeTilingOverTileBorders) { |
| 244 // The tiling has four rows and three columns. |
| 245 Initialize(gfx::Size(100, 100), 1, gfx::Size(250, 350)); |
| 246 EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x()); |
| 247 EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y()); |
| 248 |
| 249 // The live tiles rect covers the whole tiling. |
| 250 SetLiveRectAndVerifyTiles(gfx::Rect(250, 350)); |
| 251 |
| 252 // Tiles in the bottom row and right column exist. |
| 253 EXPECT_TRUE(tiling_->TileAt(2, 0)); |
| 254 EXPECT_TRUE(tiling_->TileAt(2, 1)); |
| 255 EXPECT_TRUE(tiling_->TileAt(2, 2)); |
| 256 EXPECT_TRUE(tiling_->TileAt(2, 3)); |
| 257 EXPECT_TRUE(tiling_->TileAt(1, 3)); |
| 258 EXPECT_TRUE(tiling_->TileAt(0, 3)); |
| 259 |
| 260 int right = tiling_->TilingDataForTesting().TileBounds(2, 2).x(); |
| 261 int bottom = tiling_->TilingDataForTesting().TileBounds(2, 3).y(); |
| 262 |
| 263 // Shrink the tiling so that the last tile row/column is entirely in the |
| 264 // border pixels of the interior tiles. That row/column is removed. |
| 265 Region invalidation; |
| 266 tiling_->UpdateTilesToCurrentPile(invalidation, |
| 267 gfx::Size(right + 1, bottom + 1)); |
| 268 EXPECT_EQ(2, tiling_->TilingDataForTesting().num_tiles_x()); |
| 269 EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_y()); |
| 270 |
| 271 // The live tiles rect was clamped to the pile size. |
| 272 EXPECT_EQ(gfx::Rect(right + 1, bottom + 1), tiling_->live_tiles_rect()); |
| 273 |
| 274 // Since the row/column is gone, the tiles should be gone too. |
| 275 EXPECT_FALSE(tiling_->TileAt(2, 0)); |
| 276 EXPECT_FALSE(tiling_->TileAt(2, 1)); |
| 277 EXPECT_FALSE(tiling_->TileAt(2, 2)); |
| 278 EXPECT_FALSE(tiling_->TileAt(2, 3)); |
| 279 EXPECT_FALSE(tiling_->TileAt(1, 3)); |
| 280 EXPECT_FALSE(tiling_->TileAt(0, 3)); |
| 281 |
| 282 // Growing outside the current right/bottom tiles border pixels should create |
| 283 // the tiles again, even though the live rect has not changed size. |
| 284 tiling_->UpdateTilesToCurrentPile(invalidation, |
| 285 gfx::Size(right + 2, bottom + 2)); |
| 286 EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x()); |
| 287 EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y()); |
| 288 |
| 289 // Not changed. |
| 290 EXPECT_EQ(gfx::Rect(right + 1, bottom + 1), tiling_->live_tiles_rect()); |
| 291 |
| 292 // The last row/column tiles are inside the live tiles rect. |
| 293 EXPECT_TRUE(gfx::Rect(right + 1, bottom + 1).Intersects( |
| 294 tiling_->TilingDataForTesting().TileBounds(2, 0))); |
| 295 EXPECT_TRUE(gfx::Rect(right + 1, bottom + 1).Intersects( |
| 296 tiling_->TilingDataForTesting().TileBounds(0, 3))); |
| 297 |
| 298 EXPECT_TRUE(tiling_->TileAt(2, 0)); |
| 299 EXPECT_TRUE(tiling_->TileAt(2, 1)); |
| 300 EXPECT_TRUE(tiling_->TileAt(2, 2)); |
| 301 EXPECT_TRUE(tiling_->TileAt(2, 3)); |
| 302 EXPECT_TRUE(tiling_->TileAt(1, 3)); |
| 303 EXPECT_TRUE(tiling_->TileAt(0, 3)); |
| 304 } |
| 305 |
| 306 TEST_F(PictureLayerTilingIteratorTest, ResizeLiveTileRectOverTileBorders) { |
| 307 // The tiling has three rows and columns. |
| 308 Initialize(gfx::Size(100, 100), 1, gfx::Size(250, 350)); |
| 309 EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x()); |
| 310 EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y()); |
| 311 |
| 312 // The live tiles rect covers the whole tiling. |
| 313 SetLiveRectAndVerifyTiles(gfx::Rect(250, 350)); |
| 314 |
| 315 // Tiles in the bottom row and right column exist. |
| 316 EXPECT_TRUE(tiling_->TileAt(2, 0)); |
| 317 EXPECT_TRUE(tiling_->TileAt(2, 1)); |
| 318 EXPECT_TRUE(tiling_->TileAt(2, 2)); |
| 319 EXPECT_TRUE(tiling_->TileAt(2, 3)); |
| 320 EXPECT_TRUE(tiling_->TileAt(1, 3)); |
| 321 EXPECT_TRUE(tiling_->TileAt(0, 3)); |
| 322 |
| 323 // Shrink the live tiles rect to the very edge of the right-most and |
| 324 // bottom-most tiles. Their border pixels would still be inside the live |
| 325 // tiles rect, but the tiles should not exist just for that. |
| 326 int right = tiling_->TilingDataForTesting().TileBounds(2, 3).x(); |
| 327 int bottom = tiling_->TilingDataForTesting().TileBounds(2, 3).y(); |
| 328 |
| 329 SetLiveRectAndVerifyTiles(gfx::Rect(right, bottom)); |
| 330 EXPECT_FALSE(tiling_->TileAt(2, 0)); |
| 331 EXPECT_FALSE(tiling_->TileAt(2, 1)); |
| 332 EXPECT_FALSE(tiling_->TileAt(2, 2)); |
| 333 EXPECT_FALSE(tiling_->TileAt(2, 3)); |
| 334 EXPECT_FALSE(tiling_->TileAt(1, 3)); |
| 335 EXPECT_FALSE(tiling_->TileAt(0, 3)); |
| 336 |
| 337 // Including the bottom row and right column again, should create the tiles. |
| 338 SetLiveRectAndVerifyTiles(gfx::Rect(right + 1, bottom + 1)); |
| 339 EXPECT_TRUE(tiling_->TileAt(2, 0)); |
| 340 EXPECT_TRUE(tiling_->TileAt(2, 1)); |
| 341 EXPECT_TRUE(tiling_->TileAt(2, 2)); |
| 342 EXPECT_TRUE(tiling_->TileAt(2, 3)); |
| 343 EXPECT_TRUE(tiling_->TileAt(1, 2)); |
| 344 EXPECT_TRUE(tiling_->TileAt(0, 2)); |
| 345 |
| 346 // Shrink the live tiles rect to the very edge of the left-most and |
| 347 // top-most tiles. Their border pixels would still be inside the live |
| 348 // tiles rect, but the tiles should not exist just for that. |
| 349 int left = tiling_->TilingDataForTesting().TileBounds(0, 0).right(); |
| 350 int top = tiling_->TilingDataForTesting().TileBounds(0, 0).bottom(); |
| 351 |
| 352 SetLiveRectAndVerifyTiles(gfx::Rect(left, top, 250 - left, 350 - top)); |
| 353 EXPECT_FALSE(tiling_->TileAt(0, 3)); |
| 354 EXPECT_FALSE(tiling_->TileAt(0, 2)); |
| 355 EXPECT_FALSE(tiling_->TileAt(0, 1)); |
| 356 EXPECT_FALSE(tiling_->TileAt(0, 0)); |
| 357 EXPECT_FALSE(tiling_->TileAt(1, 0)); |
| 358 EXPECT_FALSE(tiling_->TileAt(2, 0)); |
| 359 |
| 360 // Including the top row and left column again, should create the tiles. |
| 361 SetLiveRectAndVerifyTiles( |
| 362 gfx::Rect(left - 1, top - 1, 250 - left, 350 - top)); |
| 363 EXPECT_TRUE(tiling_->TileAt(0, 3)); |
| 364 EXPECT_TRUE(tiling_->TileAt(0, 2)); |
| 365 EXPECT_TRUE(tiling_->TileAt(0, 1)); |
| 366 EXPECT_TRUE(tiling_->TileAt(0, 0)); |
| 367 EXPECT_TRUE(tiling_->TileAt(1, 0)); |
| 368 EXPECT_TRUE(tiling_->TileAt(2, 0)); |
| 369 } |
| 370 |
| 371 TEST_F(PictureLayerTilingIteratorTest, ResizeLiveTileRectOverSameTiles) { |
| 372 // The tiling has four rows and three columns. |
| 373 Initialize(gfx::Size(100, 100), 1, gfx::Size(250, 350)); |
| 374 EXPECT_EQ(3, tiling_->TilingDataForTesting().num_tiles_x()); |
| 375 EXPECT_EQ(4, tiling_->TilingDataForTesting().num_tiles_y()); |
| 376 |
| 377 // The live tiles rect covers the whole tiling. |
| 378 SetLiveRectAndVerifyTiles(gfx::Rect(250, 350)); |
| 379 |
| 380 // All tiles exist. |
| 381 for (int i = 0; i < 3; ++i) { |
| 382 for (int j = 0; j < 4; ++j) |
| 383 EXPECT_TRUE(tiling_->TileAt(i, j)) << i << "," << j; |
| 384 } |
| 385 |
| 386 // Shrink the live tiles rect, but still cover all the tiles. |
| 387 SetLiveRectAndVerifyTiles(gfx::Rect(1, 1, 249, 349)); |
| 388 |
| 389 // All tiles still exist. |
| 390 for (int i = 0; i < 3; ++i) { |
| 391 for (int j = 0; j < 4; ++j) |
| 392 EXPECT_TRUE(tiling_->TileAt(i, j)) << i << "," << j; |
| 393 } |
| 394 |
| 395 // Grow the live tiles rect, but still cover all the same tiles. |
| 396 SetLiveRectAndVerifyTiles(gfx::Rect(0, 0, 250, 350)); |
| 397 |
| 398 // All tiles still exist. |
| 399 for (int i = 0; i < 3; ++i) { |
| 400 for (int j = 0; j < 4; ++j) |
| 401 EXPECT_TRUE(tiling_->TileAt(i, j)) << i << "," << j; |
| 402 } |
| 403 } |
| 404 |
213 TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) { | 405 TEST_F(PictureLayerTilingIteratorTest, ResizeOverBorderPixelsDeletesTiles) { |
214 // Verifies that a resize with invalidation for newly exposed pixels will | 406 // Verifies that a resize with invalidation for newly exposed pixels will |
215 // deletes tiles that intersect that invalidation. | 407 // deletes tiles that intersect that invalidation. |
216 gfx::Size tile_size(100, 100); | 408 gfx::Size tile_size(100, 100); |
217 gfx::Size original_layer_size(99, 99); | 409 gfx::Size original_layer_size(99, 99); |
218 Initialize(tile_size, 1.f, original_layer_size); | 410 Initialize(tile_size, 1.f, original_layer_size); |
219 SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size)); | 411 SetLiveRectAndVerifyTiles(gfx::Rect(original_layer_size)); |
220 | 412 |
221 // Tiling only has one tile, since its total size is less than one. | 413 // Tiling only has one tile, since its total size is less than one. |
222 EXPECT_TRUE(tiling_->TileAt(0, 0)); | 414 EXPECT_TRUE(tiling_->TileAt(0, 0)); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 // or EVENTUALLY, with the exception of tiles that are between 0 and 312 | 698 // or EVENTUALLY, with the exception of tiles that are between 0 and 312 |
507 // pixels away from the viewport, which will be in the SOON bin. | 699 // pixels away from the viewport, which will be in the SOON bin. |
508 bool have_now = false; | 700 bool have_now = false; |
509 bool have_eventually = false; | 701 bool have_eventually = false; |
510 bool have_soon = false; | 702 bool have_soon = false; |
511 for (int i = 0; i < 47; ++i) { | 703 for (int i = 0; i < 47; ++i) { |
512 for (int j = 0; j < 47; ++j) { | 704 for (int j = 0; j < 47; ++j) { |
513 Tile* tile = tiling->TileAt(i, j); | 705 Tile* tile = tiling->TileAt(i, j); |
514 TilePriority priority = tile->priority(ACTIVE_TREE); | 706 TilePriority priority = tile->priority(ACTIVE_TREE); |
515 | 707 |
516 if (viewport_in_content_space.Intersects(tile->content_rect())) { | 708 gfx::Rect tile_rect = tiling->TilingDataForTesting().TileBounds(i, j); |
| 709 if (viewport_in_content_space.Intersects(tile_rect)) { |
517 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); | 710 EXPECT_EQ(TilePriority::NOW, priority.priority_bin); |
518 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | 711 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); |
519 have_now = true; | 712 have_now = true; |
520 } else if (soon_rect_in_content_space.Intersects(tile->content_rect())) { | 713 } else if (soon_rect_in_content_space.Intersects(tile_rect)) { |
521 EXPECT_EQ(TilePriority::SOON, priority.priority_bin); | 714 EXPECT_EQ(TilePriority::SOON, priority.priority_bin); |
522 have_soon = true; | 715 have_soon = true; |
523 } else { | 716 } else { |
524 EXPECT_EQ(TilePriority::EVENTUALLY, priority.priority_bin); | 717 EXPECT_EQ(TilePriority::EVENTUALLY, priority.priority_bin); |
525 EXPECT_GT(priority.distance_to_visible, 0.f); | 718 EXPECT_GT(priority.distance_to_visible, 0.f); |
526 have_eventually = true; | 719 have_eventually = true; |
527 } | 720 } |
528 } | 721 } |
529 } | 722 } |
530 | 723 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 have_eventually = false; | 767 have_eventually = false; |
575 have_soon = false; | 768 have_soon = false; |
576 | 769 |
577 // Viewport moved, so we expect to find some NOW tiles, some SOON tiles and | 770 // Viewport moved, so we expect to find some NOW tiles, some SOON tiles and |
578 // some EVENTUALLY tiles. | 771 // some EVENTUALLY tiles. |
579 for (int i = 0; i < 47; ++i) { | 772 for (int i = 0; i < 47; ++i) { |
580 for (int j = 0; j < 47; ++j) { | 773 for (int j = 0; j < 47; ++j) { |
581 Tile* tile = tiling->TileAt(i, j); | 774 Tile* tile = tiling->TileAt(i, j); |
582 TilePriority priority = tile->priority(ACTIVE_TREE); | 775 TilePriority priority = tile->priority(ACTIVE_TREE); |
583 | 776 |
584 if (viewport_in_content_space.Intersects(tile->content_rect())) { | 777 gfx::Rect tile_rect = tiling->TilingDataForTesting().TileBounds(i, j); |
| 778 if (viewport_in_content_space.Intersects(tile_rect)) { |
585 EXPECT_EQ(TilePriority::NOW, priority.priority_bin) << "i: " << i | 779 EXPECT_EQ(TilePriority::NOW, priority.priority_bin) << "i: " << i |
586 << " j: " << j; | 780 << " j: " << j; |
587 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible) << "i: " << i | 781 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible) << "i: " << i |
588 << " j: " << j; | 782 << " j: " << j; |
589 have_now = true; | 783 have_now = true; |
590 } else if (skewport.Intersects(tile->content_rect()) || | 784 } else if (skewport.Intersects(tile_rect) || |
591 soon_rect_in_content_space.Intersects(tile->content_rect())) { | 785 soon_rect_in_content_space.Intersects(tile_rect)) { |
592 EXPECT_EQ(TilePriority::SOON, priority.priority_bin) << "i: " << i | 786 EXPECT_EQ(TilePriority::SOON, priority.priority_bin) << "i: " << i |
593 << " j: " << j; | 787 << " j: " << j; |
594 EXPECT_GT(priority.distance_to_visible, 0.f) << "i: " << i | 788 EXPECT_GT(priority.distance_to_visible, 0.f) << "i: " << i |
595 << " j: " << j; | 789 << " j: " << j; |
596 have_soon = true; | 790 have_soon = true; |
597 } else { | 791 } else { |
598 EXPECT_EQ(TilePriority::EVENTUALLY, priority.priority_bin) | 792 EXPECT_EQ(TilePriority::EVENTUALLY, priority.priority_bin) |
599 << "i: " << i << " j: " << j; | 793 << "i: " << i << " j: " << j; |
600 EXPECT_GT(priority.distance_to_visible, 0.f) << "i: " << i | 794 EXPECT_GT(priority.distance_to_visible, 0.f) << "i: " << i |
601 << " j: " << j; | 795 << " j: " << j; |
602 have_eventually = true; | 796 have_eventually = true; |
603 } | 797 } |
604 } | 798 } |
605 } | 799 } |
606 | 800 |
607 EXPECT_TRUE(have_now); | 801 EXPECT_TRUE(have_now); |
608 EXPECT_TRUE(have_soon); | 802 EXPECT_TRUE(have_soon); |
609 EXPECT_TRUE(have_eventually); | 803 EXPECT_TRUE(have_eventually); |
610 | 804 |
611 priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); | 805 priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); |
612 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible); | 806 EXPECT_FLOAT_EQ(68.f, priority.distance_to_visible); |
613 | 807 |
614 priority = tiling->TileAt(2, 5)->priority(ACTIVE_TREE); | 808 priority = tiling->TileAt(2, 5)->priority(ACTIVE_TREE); |
615 EXPECT_FLOAT_EQ(28.f, priority.distance_to_visible); | 809 EXPECT_FLOAT_EQ(28.f, priority.distance_to_visible); |
616 | 810 |
617 priority = tiling->TileAt(3, 4)->priority(ACTIVE_TREE); | 811 priority = tiling->TileAt(3, 4)->priority(ACTIVE_TREE); |
618 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | 812 EXPECT_FLOAT_EQ(4.f, priority.distance_to_visible); |
619 | 813 |
620 // Change the underlying layer scale. | 814 // Change the underlying layer scale. |
621 tiling->UpdateTilePriorities( | 815 tiling->UpdateTilePriorities( |
622 ACTIVE_TREE, viewport, 2.0f, 3.0, NULL, NULL, gfx::Transform()); | 816 ACTIVE_TREE, viewport, 2.0f, 3.0, NULL, NULL, gfx::Transform()); |
623 | 817 |
624 priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); | 818 priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); |
625 EXPECT_FLOAT_EQ(136.f, priority.distance_to_visible); | 819 EXPECT_FLOAT_EQ(136.f, priority.distance_to_visible); |
626 | 820 |
627 priority = tiling->TileAt(2, 5)->priority(ACTIVE_TREE); | 821 priority = tiling->TileAt(2, 5)->priority(ACTIVE_TREE); |
628 EXPECT_FLOAT_EQ(56.f, priority.distance_to_visible); | 822 EXPECT_FLOAT_EQ(56.f, priority.distance_to_visible); |
629 | 823 |
630 priority = tiling->TileAt(3, 4)->priority(ACTIVE_TREE); | 824 priority = tiling->TileAt(3, 4)->priority(ACTIVE_TREE); |
631 EXPECT_FLOAT_EQ(0.f, priority.distance_to_visible); | 825 EXPECT_FLOAT_EQ(8.f, priority.distance_to_visible); |
632 | 826 |
633 // Test additional scales. | 827 // Test additional scales. |
634 tiling = TestablePictureLayerTiling::Create(0.2f, layer_bounds, &client); | 828 tiling = TestablePictureLayerTiling::Create(0.2f, layer_bounds, &client); |
635 tiling->UpdateTilePriorities( | 829 tiling->UpdateTilePriorities( |
636 ACTIVE_TREE, viewport, 1.0f, 4.0, NULL, NULL, gfx::Transform()); | 830 ACTIVE_TREE, viewport, 1.0f, 4.0, NULL, NULL, gfx::Transform()); |
637 | 831 |
638 priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); | 832 priority = tiling->TileAt(5, 1)->priority(ACTIVE_TREE); |
639 EXPECT_FLOAT_EQ(110.f, priority.distance_to_visible); | 833 EXPECT_FLOAT_EQ(110.f, priority.distance_to_visible); |
640 | 834 |
641 priority = tiling->TileAt(2, 5)->priority(ACTIVE_TREE); | 835 priority = tiling->TileAt(2, 5)->priority(ACTIVE_TREE); |
(...skipping 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2082 EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0)); | 2276 EXPECT_EQ(active_tiling->TileAt(0, 0), recycle_tiling->TileAt(0, 0)); |
2083 | 2277 |
2084 // Reset the active tiling. The recycle tiles should be released too. | 2278 // Reset the active tiling. The recycle tiles should be released too. |
2085 active_tiling->Reset(); | 2279 active_tiling->Reset(); |
2086 EXPECT_FALSE(active_tiling->TileAt(0, 0)); | 2280 EXPECT_FALSE(active_tiling->TileAt(0, 0)); |
2087 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); | 2281 EXPECT_FALSE(recycle_tiling->TileAt(0, 0)); |
2088 } | 2282 } |
2089 | 2283 |
2090 } // namespace | 2284 } // namespace |
2091 } // namespace cc | 2285 } // namespace cc |
OLD | NEW |