| OLD | NEW |
| 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 "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 scoped_refptr<FakePicturePileImpl> pending_pile = | 1418 scoped_refptr<FakePicturePileImpl> pending_pile = |
| 1419 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); | 1419 FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds); |
| 1420 SetupPendingTree(pending_pile); | 1420 SetupPendingTree(pending_pile); |
| 1421 | 1421 |
| 1422 pending_layer_->set_fixed_tile_size(tile_size); | 1422 pending_layer_->set_fixed_tile_size(tile_size); |
| 1423 ASSERT_TRUE(pending_layer_->CanHaveTilings()); | 1423 ASSERT_TRUE(pending_layer_->CanHaveTilings()); |
| 1424 PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f); | 1424 PictureLayerTiling* tiling = pending_layer_->AddTiling(1.f); |
| 1425 host_impl_.pending_tree()->UpdateDrawProperties(); | 1425 host_impl_.pending_tree()->UpdateDrawProperties(); |
| 1426 EXPECT_EQ(tiling->resolution(), HIGH_RESOLUTION); | 1426 EXPECT_EQ(tiling->resolution(), HIGH_RESOLUTION); |
| 1427 | 1427 |
| 1428 pending_layer_->draw_properties().visible_content_rect = | 1428 pending_layer_->set_visible_rect_for_tile_priority(gfx::Rect(0, 0, 100, 200)); |
| 1429 gfx::Rect(0, 0, 100, 200); | |
| 1430 | 1429 |
| 1431 // Fake set priorities. | 1430 // Fake set priorities. |
| 1432 for (PictureLayerTiling::CoverageIterator iter( | 1431 for (PictureLayerTiling::CoverageIterator iter( |
| 1433 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); | 1432 tiling, pending_layer_->contents_scale_x(), gfx::Rect(layer_bounds)); |
| 1434 iter; | 1433 iter; |
| 1435 ++iter) { | 1434 ++iter) { |
| 1436 if (!*iter) | 1435 if (!*iter) |
| 1437 continue; | 1436 continue; |
| 1438 Tile* tile = *iter; | 1437 Tile* tile = *iter; |
| 1439 TilePriority priority; | 1438 TilePriority priority; |
| 1440 priority.resolution = HIGH_RESOLUTION; | 1439 priority.resolution = HIGH_RESOLUTION; |
| 1441 gfx::Rect tile_bounds = iter.geometry_rect(); | 1440 gfx::Rect tile_bounds = iter.geometry_rect(); |
| 1442 if (pending_layer_->visible_content_rect().Intersects(tile_bounds)) { | 1441 if (pending_layer_->visible_rect_for_tile_priority().Intersects( |
| 1442 tile_bounds)) { |
| 1443 priority.priority_bin = TilePriority::NOW; | 1443 priority.priority_bin = TilePriority::NOW; |
| 1444 priority.distance_to_visible = 0.f; | 1444 priority.distance_to_visible = 0.f; |
| 1445 } else { | 1445 } else { |
| 1446 priority.priority_bin = TilePriority::SOON; | 1446 priority.priority_bin = TilePriority::SOON; |
| 1447 priority.distance_to_visible = 1.f; | 1447 priority.distance_to_visible = 1.f; |
| 1448 } | 1448 } |
| 1449 tile->SetPriority(PENDING_TREE, priority); | 1449 tile->SetPriority(PENDING_TREE, priority); |
| 1450 } | 1450 } |
| 1451 | 1451 |
| 1452 pending_layer_->MarkVisibleResourcesAsRequired(); | 1452 pending_layer_->MarkVisibleResourcesAsRequired(); |
| (...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4362 SetupPendingTree(pending_pile2); | 4362 SetupPendingTree(pending_pile2); |
| 4363 ActivateTree(); | 4363 ActivateTree(); |
| 4364 | 4364 |
| 4365 // We've switched to a solid color, so we should end up with no tilings. | 4365 // We've switched to a solid color, so we should end up with no tilings. |
| 4366 ASSERT_TRUE(active_layer_->tilings()); | 4366 ASSERT_TRUE(active_layer_->tilings()); |
| 4367 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); | 4367 EXPECT_EQ(0u, active_layer_->tilings()->num_tilings()); |
| 4368 } | 4368 } |
| 4369 | 4369 |
| 4370 } // namespace | 4370 } // namespace |
| 4371 } // namespace cc | 4371 } // namespace cc |
| OLD | NEW |