Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: cc/tiles/tile_manager_unittest.cc

Issue 2566613002: [4/5] Add translated rasterization support for PictureLayerTilingSet & below (Closed)
Patch Set: still need that rebaseline Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 EXPECT_NE(new_content_tiles, required_for_draw_tiles); 349 EXPECT_NE(new_content_tiles, required_for_draw_tiles);
350 } 350 }
351 351
352 TEST_F(TileManagerTilePriorityQueueTest, 352 TEST_F(TileManagerTilePriorityQueueTest,
353 RasterTilePriorityQueueHighNonIdealTilings) { 353 RasterTilePriorityQueueHighNonIdealTilings) {
354 const gfx::Size layer_bounds(1000, 1000); 354 const gfx::Size layer_bounds(1000, 1000);
355 const gfx::Size viewport(800, 800); 355 const gfx::Size viewport(800, 800);
356 host_impl()->SetViewportSize(viewport); 356 host_impl()->SetViewportSize(viewport);
357 SetupDefaultTrees(layer_bounds); 357 SetupDefaultTrees(layer_bounds);
358 358
359 pending_layer()->tilings()->AddTiling(1.5f, pending_layer()->raster_source()); 359 pending_layer()->tilings()->AddTiling(
360 active_layer()->tilings()->AddTiling(1.5f, active_layer()->raster_source()); 360 gfx::AxisTransform2d(1.5f, gfx::Vector2dF()),
361 pending_layer()->tilings()->AddTiling(1.7f, pending_layer()->raster_source()); 361 pending_layer()->raster_source());
362 active_layer()->tilings()->AddTiling(1.7f, active_layer()->raster_source()); 362 active_layer()->tilings()->AddTiling(
363 gfx::AxisTransform2d(1.5f, gfx::Vector2dF()),
364 active_layer()->raster_source());
365 pending_layer()->tilings()->AddTiling(
366 gfx::AxisTransform2d(1.7f, gfx::Vector2dF()),
367 pending_layer()->raster_source());
368 active_layer()->tilings()->AddTiling(
369 gfx::AxisTransform2d(1.7f, gfx::Vector2dF()),
370 active_layer()->raster_source());
363 371
364 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 372 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f,
365 5.0, Occlusion(), true); 373 5.0, Occlusion(), true);
366 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, 374 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0,
367 Occlusion(), true); 375 Occlusion(), true);
368 376
369 std::set<Tile*> all_expected_tiles; 377 std::set<Tile*> all_expected_tiles;
370 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { 378 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) {
371 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); 379 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i);
372 if (tiling->contents_scale() == 1.f) { 380 if (tiling->contents_scale_key() == 1.f) {
373 tiling->set_resolution(HIGH_RESOLUTION); 381 tiling->set_resolution(HIGH_RESOLUTION);
374 const auto& all_tiles = tiling->AllTilesForTesting(); 382 const auto& all_tiles = tiling->AllTilesForTesting();
375 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); 383 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
376 } else { 384 } else {
377 tiling->set_resolution(NON_IDEAL_RESOLUTION); 385 tiling->set_resolution(NON_IDEAL_RESOLUTION);
378 } 386 }
379 } 387 }
380 388
381 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { 389 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) {
382 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); 390 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i);
383 if (tiling->contents_scale() == 1.5f) { 391 if (tiling->contents_scale_key() == 1.5f) {
384 tiling->set_resolution(HIGH_RESOLUTION); 392 tiling->set_resolution(HIGH_RESOLUTION);
385 const auto& all_tiles = tiling->AllTilesForTesting(); 393 const auto& all_tiles = tiling->AllTilesForTesting();
386 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); 394 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
387 } else { 395 } else {
388 tiling->set_resolution(NON_IDEAL_RESOLUTION); 396 tiling->set_resolution(NON_IDEAL_RESOLUTION);
389 // Non ideal tilings with a high res pending twin have to be processed 397 // Non ideal tilings with a high res pending twin have to be processed
390 // because of possible activation tiles. 398 // because of possible activation tiles.
391 if (tiling->contents_scale() == 1.f) { 399 if (tiling->contents_scale_key() == 1.f) {
392 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 400 tiling->UpdateAndGetAllPrioritizedTilesForTesting();
393 const auto& all_tiles = tiling->AllTilesForTesting(); 401 const auto& all_tiles = tiling->AllTilesForTesting();
394 for (auto* tile : all_tiles) 402 for (auto* tile : all_tiles)
395 EXPECT_TRUE(tile->required_for_activation()); 403 EXPECT_TRUE(tile->required_for_activation());
396 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); 404 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
397 } 405 }
398 } 406 }
399 } 407 }
400 408
401 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( 409 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue(
(...skipping 14 matching lines...) Expand all
416 EXPECT_EQ(all_expected_tiles, all_actual_tiles); 424 EXPECT_EQ(all_expected_tiles, all_actual_tiles);
417 } 425 }
418 426
419 TEST_F(TileManagerTilePriorityQueueTest, 427 TEST_F(TileManagerTilePriorityQueueTest,
420 RasterTilePriorityQueueHighLowTilings) { 428 RasterTilePriorityQueueHighLowTilings) {
421 const gfx::Size layer_bounds(1000, 1000); 429 const gfx::Size layer_bounds(1000, 1000);
422 const gfx::Size viewport(800, 800); 430 const gfx::Size viewport(800, 800);
423 host_impl()->SetViewportSize(viewport); 431 host_impl()->SetViewportSize(viewport);
424 SetupDefaultTrees(layer_bounds); 432 SetupDefaultTrees(layer_bounds);
425 433
426 pending_layer()->tilings()->AddTiling(1.5f, pending_layer()->raster_source()); 434 pending_layer()->tilings()->AddTiling(
427 active_layer()->tilings()->AddTiling(1.5f, active_layer()->raster_source()); 435 gfx::AxisTransform2d(1.5f, gfx::Vector2dF()),
428 pending_layer()->tilings()->AddTiling(1.7f, pending_layer()->raster_source()); 436 pending_layer()->raster_source());
429 active_layer()->tilings()->AddTiling(1.7f, active_layer()->raster_source()); 437 active_layer()->tilings()->AddTiling(
438 gfx::AxisTransform2d(1.5f, gfx::Vector2dF()),
439 active_layer()->raster_source());
440 pending_layer()->tilings()->AddTiling(
441 gfx::AxisTransform2d(1.7f, gfx::Vector2dF()),
442 pending_layer()->raster_source());
443 active_layer()->tilings()->AddTiling(
444 gfx::AxisTransform2d(1.7f, gfx::Vector2dF()),
445 active_layer()->raster_source());
430 446
431 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 447 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f,
432 5.0, Occlusion(), true); 448 5.0, Occlusion(), true);
433 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, 449 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0,
434 Occlusion(), true); 450 Occlusion(), true);
435 451
436 std::set<Tile*> all_expected_tiles; 452 std::set<Tile*> all_expected_tiles;
437 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { 453 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) {
438 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); 454 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i);
439 if (tiling->contents_scale() == 1.f) { 455 if (tiling->contents_scale_key() == 1.f) {
440 tiling->set_resolution(HIGH_RESOLUTION); 456 tiling->set_resolution(HIGH_RESOLUTION);
441 const auto& all_tiles = tiling->AllTilesForTesting(); 457 const auto& all_tiles = tiling->AllTilesForTesting();
442 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); 458 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
443 } else { 459 } else {
444 tiling->set_resolution(NON_IDEAL_RESOLUTION); 460 tiling->set_resolution(NON_IDEAL_RESOLUTION);
445 } 461 }
446 } 462 }
447 463
448 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { 464 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) {
449 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); 465 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i);
450 if (tiling->contents_scale() == 1.5f) { 466 if (tiling->contents_scale_key() == 1.5f) {
451 tiling->set_resolution(HIGH_RESOLUTION); 467 tiling->set_resolution(HIGH_RESOLUTION);
452 const auto& all_tiles = tiling->AllTilesForTesting(); 468 const auto& all_tiles = tiling->AllTilesForTesting();
453 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); 469 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
454 } else { 470 } else {
455 tiling->set_resolution(LOW_RESOLUTION); 471 tiling->set_resolution(LOW_RESOLUTION);
456 // Low res tilings with a high res pending twin have to be processed 472 // Low res tilings with a high res pending twin have to be processed
457 // because of possible activation tiles. 473 // because of possible activation tiles.
458 if (tiling->contents_scale() == 1.f) { 474 if (tiling->contents_scale_key() == 1.f) {
459 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); 475 tiling->UpdateAndGetAllPrioritizedTilesForTesting();
460 const auto& all_tiles = tiling->AllTilesForTesting(); 476 const auto& all_tiles = tiling->AllTilesForTesting();
461 for (auto* tile : all_tiles) 477 for (auto* tile : all_tiles)
462 EXPECT_TRUE(tile->required_for_activation()); 478 EXPECT_TRUE(tile->required_for_activation());
463 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); 479 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end());
464 } 480 }
465 } 481 }
466 } 482 }
467 483
468 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( 484 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue(
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 922
907 bool last_tile_is_occluded = last_tile.is_occluded(); 923 bool last_tile_is_occluded = last_tile.is_occluded();
908 if (!last_tile_is_occluded) { 924 if (!last_tile_is_occluded) {
909 TilePriority::PriorityBin tile_priority_bin = 925 TilePriority::PriorityBin tile_priority_bin =
910 prioritized_tile.priority().priority_bin; 926 prioritized_tile.priority().priority_bin;
911 TilePriority::PriorityBin last_tile_priority_bin = 927 TilePriority::PriorityBin last_tile_priority_bin =
912 last_tile.priority().priority_bin; 928 last_tile.priority().priority_bin;
913 929
914 EXPECT_TRUE((tile_priority_bin < last_tile_priority_bin) || 930 EXPECT_TRUE((tile_priority_bin < last_tile_priority_bin) ||
915 prioritized_tile.tile()->required_for_activation() || 931 prioritized_tile.tile()->required_for_activation() ||
916 (prioritized_tile.tile()->contents_scale() != 932 (prioritized_tile.tile()->raster_transform() !=
917 last_tile.tile()->contents_scale())); 933 last_tile.tile()->raster_transform()));
918 } 934 }
919 } 935 }
920 last_tile = prioritized_tile; 936 last_tile = prioritized_tile;
921 queue->Pop(); 937 queue->Pop();
922 } 938 }
923 size_t expected_occluded_count = pending_child_high_res_tiles.size(); 939 size_t expected_occluded_count = pending_child_high_res_tiles.size();
924 EXPECT_EQ(expected_occluded_count, occluded_count); 940 EXPECT_EQ(expected_occluded_count, occluded_count);
925 } 941 }
926 942
927 TEST_F(TileManagerTilePriorityQueueTest, 943 TEST_F(TileManagerTilePriorityQueueTest,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 1144
1129 std::unique_ptr<PictureLayerTilingSet> tiling_set = 1145 std::unique_ptr<PictureLayerTilingSet> tiling_set =
1130 PictureLayerTilingSet::Create( 1146 PictureLayerTilingSet::Create(
1131 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, 1147 ACTIVE_TREE, &client, settings.tiling_interest_area_padding,
1132 settings.skewport_target_time_in_seconds, 1148 settings.skewport_target_time_in_seconds,
1133 settings.skewport_extrapolation_limit_in_screen_pixels, 1149 settings.skewport_extrapolation_limit_in_screen_pixels,
1134 settings.max_preraster_distance_in_screen_pixels); 1150 settings.max_preraster_distance_in_screen_pixels);
1135 1151
1136 scoped_refptr<FakeRasterSource> raster_source = 1152 scoped_refptr<FakeRasterSource> raster_source =
1137 FakeRasterSource::CreateFilled(layer_bounds); 1153 FakeRasterSource::CreateFilled(layer_bounds);
1138 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); 1154 PictureLayerTiling* tiling =
1155 tiling_set->AddTiling(gfx::AxisTransform2d(), raster_source);
1139 tiling->set_resolution(HIGH_RESOLUTION); 1156 tiling->set_resolution(HIGH_RESOLUTION);
1140 1157
1141 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); 1158 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true);
1142 std::vector<Tile*> all_tiles = tiling->AllTilesForTesting(); 1159 std::vector<Tile*> all_tiles = tiling->AllTilesForTesting();
1143 // Sanity check. 1160 // Sanity check.
1144 EXPECT_EQ(3364u, all_tiles.size()); 1161 EXPECT_EQ(3364u, all_tiles.size());
1145 1162
1146 // The explanation of each iteration is as follows: 1163 // The explanation of each iteration is as follows:
1147 // 1. First iteration tests that we can get all of the tiles correctly. 1164 // 1. First iteration tests that we can get all of the tiles correctly.
1148 // 2. Second iteration ensures that we can get all of the tiles again (first 1165 // 2. Second iteration ensures that we can get all of the tiles again (first
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 1256
1240 std::unique_ptr<PictureLayerTilingSet> tiling_set = 1257 std::unique_ptr<PictureLayerTilingSet> tiling_set =
1241 PictureLayerTilingSet::Create( 1258 PictureLayerTilingSet::Create(
1242 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, 1259 ACTIVE_TREE, &client, settings.tiling_interest_area_padding,
1243 settings.skewport_target_time_in_seconds, 1260 settings.skewport_target_time_in_seconds,
1244 settings.skewport_extrapolation_limit_in_screen_pixels, 1261 settings.skewport_extrapolation_limit_in_screen_pixels,
1245 settings.max_preraster_distance_in_screen_pixels); 1262 settings.max_preraster_distance_in_screen_pixels);
1246 1263
1247 scoped_refptr<FakeRasterSource> raster_source = 1264 scoped_refptr<FakeRasterSource> raster_source =
1248 FakeRasterSource::CreateFilled(layer_bounds); 1265 FakeRasterSource::CreateFilled(layer_bounds);
1249 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); 1266 PictureLayerTiling* tiling =
1267 tiling_set->AddTiling(gfx::AxisTransform2d(), raster_source);
1250 tiling->set_resolution(HIGH_RESOLUTION); 1268 tiling->set_resolution(HIGH_RESOLUTION);
1251 1269
1252 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); 1270 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true);
1253 tiling_set->UpdateTilePriorities(moved_viewport, 1.0f, 2.0, Occlusion(), 1271 tiling_set->UpdateTilePriorities(moved_viewport, 1.0f, 2.0, Occlusion(),
1254 true); 1272 true);
1255 1273
1256 const int soon_border_outset = 312; 1274 const int soon_border_outset = 312;
1257 gfx::Rect soon_rect = moved_viewport; 1275 gfx::Rect soon_rect = moved_viewport;
1258 soon_rect.Inset(-soon_border_outset, -soon_border_outset); 1276 soon_rect.Inset(-soon_border_outset, -soon_border_outset);
1259 1277
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 FakeRasterSource::CreateFilled(layer_bounds); 1413 FakeRasterSource::CreateFilled(layer_bounds);
1396 1414
1397 FakePictureLayerTilingClient pending_client; 1415 FakePictureLayerTilingClient pending_client;
1398 pending_client.SetTileSize(gfx::Size(64, 64)); 1416 pending_client.SetTileSize(gfx::Size(64, 64));
1399 1417
1400 std::unique_ptr<PictureLayerTilingSet> tiling_set = 1418 std::unique_ptr<PictureLayerTilingSet> tiling_set =
1401 PictureLayerTilingSet::Create(WhichTree::ACTIVE_TREE, &pending_client, 1419 PictureLayerTilingSet::Create(WhichTree::ACTIVE_TREE, &pending_client,
1402 1.0f, 1.0f, 1000, 1000.f); 1420 1.0f, 1.0f, 1000, 1000.f);
1403 pending_client.set_twin_tiling_set(tiling_set.get()); 1421 pending_client.set_twin_tiling_set(tiling_set.get());
1404 1422
1405 auto* tiling = tiling_set->AddTiling(1.0f, raster_source); 1423 auto* tiling = tiling_set->AddTiling(gfx::AxisTransform2d(), raster_source);
1406 1424
1407 tiling->set_resolution(HIGH_RESOLUTION); 1425 tiling->set_resolution(HIGH_RESOLUTION);
1408 tiling->CreateAllTilesForTesting(); 1426 tiling->CreateAllTilesForTesting();
1409 1427
1410 // The tile is (0, 0, 1, 1), create an intersecting and non-intersecting 1428 // The tile is (0, 0, 1, 1), create an intersecting and non-intersecting
1411 // rectangle to test the advance phase with. The tile size is (64, 64), so 1429 // rectangle to test the advance phase with. The tile size is (64, 64), so
1412 // both rectangles intersect the tile content size, but only one should 1430 // both rectangles intersect the tile content size, but only one should
1413 // intersect the actual size. 1431 // intersect the actual size.
1414 gfx::Rect non_intersecting_rect(2, 2, 10, 10); 1432 gfx::Rect non_intersecting_rect(2, 2, 10, 10);
1415 gfx::Rect intersecting_rect(0, 0, 10, 10); 1433 gfx::Rect intersecting_rect(0, 0, 10, 10);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1471 RasterSource::CreateFromRecordingSource(recording_source.get(), false); 1489 RasterSource::CreateFromRecordingSource(recording_source.get(), false);
1472 1490
1473 FakePictureLayerTilingClient tiling_client; 1491 FakePictureLayerTilingClient tiling_client;
1474 tiling_client.SetTileSize(size); 1492 tiling_client.SetTileSize(size);
1475 1493
1476 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create( 1494 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create(
1477 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); 1495 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK);
1478 layer_impl->set_is_drawn_render_surface_layer_list_member(true); 1496 layer_impl->set_is_drawn_render_surface_layer_list_member(true);
1479 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); 1497 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set();
1480 1498
1481 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); 1499 PictureLayerTiling* tiling =
1500 tiling_set->AddTiling(gfx::AxisTransform2d(), raster_source);
1482 tiling->set_resolution(HIGH_RESOLUTION); 1501 tiling->set_resolution(HIGH_RESOLUTION);
1483 tiling->CreateAllTilesForTesting(); 1502 tiling->CreateAllTilesForTesting();
1484 tiling->SetTilePriorityRectsForTesting( 1503 tiling->SetTilePriorityRectsForTesting(
1485 gfx::Rect(layer_bounds), // Visible rect. 1504 gfx::Rect(layer_bounds), // Visible rect.
1486 gfx::Rect(layer_bounds), // Skewport rect. 1505 gfx::Rect(layer_bounds), // Skewport rect.
1487 gfx::Rect(layer_bounds), // Soon rect. 1506 gfx::Rect(layer_bounds), // Soon rect.
1488 gfx::Rect(layer_bounds)); // Eventually rect. 1507 gfx::Rect(layer_bounds)); // Eventually rect.
1489 1508
1490 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); 1509 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state());
1491 1510
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 RasterSource::CreateFromRecordingSource(recording_source.get(), false); 1693 RasterSource::CreateFromRecordingSource(recording_source.get(), false);
1675 1694
1676 FakePictureLayerTilingClient tiling_client; 1695 FakePictureLayerTilingClient tiling_client;
1677 tiling_client.SetTileSize(size); 1696 tiling_client.SetTileSize(size);
1678 1697
1679 std::unique_ptr<PictureLayerImpl> layer = PictureLayerImpl::Create( 1698 std::unique_ptr<PictureLayerImpl> layer = PictureLayerImpl::Create(
1680 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); 1699 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK);
1681 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); 1700 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set();
1682 layer->set_is_drawn_render_surface_layer_list_member(true); 1701 layer->set_is_drawn_render_surface_layer_list_member(true);
1683 1702
1684 auto* tiling = tiling_set->AddTiling(1.0f, raster); 1703 auto* tiling = tiling_set->AddTiling(gfx::AxisTransform2d(), raster);
1685 tiling->set_resolution(resolutions[i]); 1704 tiling->set_resolution(resolutions[i]);
1686 tiling->CreateAllTilesForTesting(); 1705 tiling->CreateAllTilesForTesting();
1687 tiling->SetTilePriorityRectsForTesting( 1706 tiling->SetTilePriorityRectsForTesting(
1688 gfx::Rect(size), // Visible rect. 1707 gfx::Rect(size), // Visible rect.
1689 gfx::Rect(size), // Skewport rect. 1708 gfx::Rect(size), // Skewport rect.
1690 gfx::Rect(size), // Soon rect. 1709 gfx::Rect(size), // Soon rect.
1691 gfx::Rect(size)); // Eventually rect. 1710 gfx::Rect(size)); // Eventually rect.
1692 1711
1693 // SMOOTHNESS_TAKES_PRIORITY ensures that we will actually raster 1712 // SMOOTHNESS_TAKES_PRIORITY ensures that we will actually raster
1694 // LOW_RESOLUTION tiles, otherwise they are skipped. 1713 // LOW_RESOLUTION tiles, otherwise they are skipped.
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
2356 2375
2357 recording_source->Rerecord(); 2376 recording_source->Rerecord();
2358 scoped_refptr<RasterSource> raster_source = 2377 scoped_refptr<RasterSource> raster_source =
2359 RasterSource::CreateFromRecordingSource(recording_source.get(), false); 2378 RasterSource::CreateFromRecordingSource(recording_source.get(), false);
2360 2379
2361 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create( 2380 std::unique_ptr<PictureLayerImpl> layer_impl = PictureLayerImpl::Create(
2362 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK); 2381 host_impl()->active_tree(), 1, Layer::LayerMaskType::NOT_MASK);
2363 layer_impl->set_is_drawn_render_surface_layer_list_member(true); 2382 layer_impl->set_is_drawn_render_surface_layer_list_member(true);
2364 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); 2383 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set();
2365 2384
2366 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); 2385 PictureLayerTiling* tiling =
2386 tiling_set->AddTiling(gfx::AxisTransform2d(), raster_source);
2367 tiling->set_resolution(HIGH_RESOLUTION); 2387 tiling->set_resolution(HIGH_RESOLUTION);
2368 tiling->CreateAllTilesForTesting(); 2388 tiling->CreateAllTilesForTesting();
2369 tiling->SetTilePriorityRectsForTesting( 2389 tiling->SetTilePriorityRectsForTesting(
2370 gfx::Rect(layer_bounds), // Visible rect. 2390 gfx::Rect(layer_bounds), // Visible rect.
2371 gfx::Rect(layer_bounds), // Skewport rect. 2391 gfx::Rect(layer_bounds), // Skewport rect.
2372 gfx::Rect(layer_bounds), // Soon rect. 2392 gfx::Rect(layer_bounds), // Soon rect.
2373 gfx::Rect(layer_bounds)); // Eventually rect. 2393 gfx::Rect(layer_bounds)); // Eventually rect.
2374 2394
2375 // PrepareTiles and synchronously run all tasks added to the TaskGraph. Since 2395 // PrepareTiles and synchronously run all tasks added to the TaskGraph. Since
2376 // we are using a strict mock for the SkImageGenerator, if the decode runs as 2396 // we are using a strict mock for the SkImageGenerator, if the decode runs as
2377 // a part of raster tasks, the test should fail. 2397 // a part of raster tasks, the test should fail.
2378 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); 2398 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state());
2379 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); 2399 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting());
2380 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle(); 2400 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner())->RunUntilIdle();
2381 base::RunLoop().RunUntilIdle(); 2401 base::RunLoop().RunUntilIdle();
2382 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); 2402 EXPECT_FALSE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting());
2383 } 2403 }
2384 2404
2385 } // namespace 2405 } // namespace
2386 } // namespace cc 2406 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698