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/tile_manager.h" | 5 #include "cc/resources/tile_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 1515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1526 Tile* b_tile = **b_iterator; | 1526 Tile* b_tile = **b_iterator; |
1527 | 1527 |
1528 const TilePriority& a_priority = | 1528 const TilePriority& a_priority = |
1529 a_tile->priority_for_tree_priority(tree_priority_); | 1529 a_tile->priority_for_tree_priority(tree_priority_); |
1530 const TilePriority& b_priority = | 1530 const TilePriority& b_priority = |
1531 b_tile->priority_for_tree_priority(tree_priority_); | 1531 b_tile->priority_for_tree_priority(tree_priority_); |
1532 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; | 1532 bool prioritize_low_res = tree_priority_ == SMOOTHNESS_TAKES_PRIORITY; |
1533 | 1533 |
1534 // Now we have to return true iff b is lower priority than a. | 1534 // Now we have to return true iff b is lower priority than a. |
1535 | 1535 |
1536 // If the bin is the same but the resolution is not, then the order will be | 1536 // If the priority bin differs, b is lower priority if it has the higher |
1537 // determined by whether we prioritize low res or not. | 1537 // priority bin. |
1538 if (a_priority.priority_bin != b_priority.priority_bin) | |
1539 return b_priority.priority_bin > a_priority.priority_bin; | |
1540 | |
1541 // Otherwise if the resolution differs, then the order will be determined by | |
1542 // whether we prioritize low res or not. | |
1538 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile | 1543 // TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile |
1539 // class but instead produced by the iterators. | 1544 // class but instead produced by the iterators. |
1540 if (b_priority.priority_bin == a_priority.priority_bin && | 1545 if (b_priority.resolution != a_priority.resolution) { |
1541 b_priority.resolution != a_priority.resolution) { | |
1542 // Non ideal resolution should be sorted higher than other resolutions. | 1546 // Non ideal resolution should be sorted higher than other resolutions. |
1543 if (a_priority.resolution == NON_IDEAL_RESOLUTION) | 1547 if (a_priority.resolution == NON_IDEAL_RESOLUTION) |
1544 return false; | 1548 return false; |
1545 | 1549 |
1546 if (b_priority.resolution == NON_IDEAL_RESOLUTION) | 1550 if (b_priority.resolution == NON_IDEAL_RESOLUTION) |
1547 return true; | 1551 return true; |
1548 | 1552 |
1549 if (prioritize_low_res) | 1553 if (prioritize_low_res) |
1550 return a_priority.resolution == LOW_RESOLUTION; | 1554 return a_priority.resolution == LOW_RESOLUTION; |
1551 | 1555 |
1552 return a_priority.resolution == HIGH_RESOLUTION; | 1556 return a_priority.resolution == HIGH_RESOLUTION; |
1553 } | 1557 } |
1554 return a_priority.IsHigherPriorityThan(b_priority); | 1558 |
1559 // Otherwise if the occlusion differs, b is lower priority if it is occluded. | |
1560 bool a_is_occluded = a_tile->is_occluded_for_tree_priority(tree_priority_); | |
1561 bool b_is_occluded = b_tile->is_occluded_for_tree_priority(tree_priority_); | |
1562 | |
1563 if (a_is_occluded != b_is_occluded) | |
1564 return b_is_occluded; | |
1565 | |
1566 // Otherwise if the distance to visible differs, b is lower priorty if it is | |
vmpstr
2014/07/11 00:44:32
nit: you don't need the "if the distance to visibl
jbedley
2014/07/11 18:00:30
Done.
| |
1567 // farther from visible. | |
1568 return b_priority.distance_to_visible > a_priority.distance_to_visible; | |
1555 } | 1569 } |
1556 | 1570 |
1557 void TileManager::SetRasterizerForTesting(Rasterizer* rasterizer) { | 1571 void TileManager::SetRasterizerForTesting(Rasterizer* rasterizer) { |
1558 rasterizer_ = rasterizer; | 1572 rasterizer_ = rasterizer; |
1559 rasterizer_->SetClient(this); | 1573 rasterizer_->SetClient(this); |
1560 } | 1574 } |
1561 | 1575 |
1562 bool TileManager::IsReadyToActivate() const { | 1576 bool TileManager::IsReadyToActivate() const { |
1563 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); | 1577 const std::vector<PictureLayerImpl*>& layers = client_->GetPictureLayers(); |
1564 | 1578 |
(...skipping 11 matching lines...) Expand all Loading... | |
1576 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate"); | 1590 TRACE_EVENT0("cc", "TileManager::CheckIfReadyToActivate"); |
1577 | 1591 |
1578 rasterizer_->CheckForCompletedTasks(); | 1592 rasterizer_->CheckForCompletedTasks(); |
1579 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; | 1593 did_check_for_completed_tasks_since_last_schedule_tasks_ = true; |
1580 | 1594 |
1581 if (IsReadyToActivate()) | 1595 if (IsReadyToActivate()) |
1582 client_->NotifyReadyToActivate(); | 1596 client_->NotifyReadyToActivate(); |
1583 } | 1597 } |
1584 | 1598 |
1585 } // namespace cc | 1599 } // namespace cc |
OLD | NEW |