Index: cc/resources/tile_manager.cc |
diff --git a/cc/resources/tile_manager.cc b/cc/resources/tile_manager.cc |
index d508f6a0a17a5639290949fb9cf083eb4ffb6e10..3d03f5e927a158424b9a908845978ffcd7d27d5d 100644 |
--- a/cc/resources/tile_manager.cc |
+++ b/cc/resources/tile_manager.cc |
@@ -1533,12 +1533,16 @@ bool TileManager::EvictionTileIterator::EvictionOrderComparator::operator()( |
// Now we have to return true iff b is lower priority than a. |
- // If the bin is the same but the resolution is not, then the order will be |
- // determined by whether we prioritize low res or not. |
+ // If the priority bin differs, b is lower priority if it has the higher |
+ // priority bin. |
+ if (a_priority.priority_bin != b_priority.priority_bin) |
+ return b_priority.priority_bin > a_priority.priority_bin; |
+ |
+ // Otherwise if the resolution differs, then the order will be determined by |
+ // whether we prioritize low res or not. |
// TODO(vmpstr): Remove this when TilePriority is no longer a member of Tile |
// class but instead produced by the iterators. |
- if (b_priority.priority_bin == a_priority.priority_bin && |
- b_priority.resolution != a_priority.resolution) { |
+ if (b_priority.resolution != a_priority.resolution) { |
// Non ideal resolution should be sorted higher than other resolutions. |
if (a_priority.resolution == NON_IDEAL_RESOLUTION) |
return false; |
@@ -1551,7 +1555,17 @@ bool TileManager::EvictionTileIterator::EvictionOrderComparator::operator()( |
return a_priority.resolution == HIGH_RESOLUTION; |
} |
- return a_priority.IsHigherPriorityThan(b_priority); |
+ |
+ // Otherwise if the occlusion differs, b is lower priority if it is occluded. |
+ bool a_is_occluded = a_tile->is_occluded_for_tree_priority(tree_priority_); |
+ bool b_is_occluded = b_tile->is_occluded_for_tree_priority(tree_priority_); |
+ |
+ if (a_is_occluded != b_is_occluded) |
+ return b_is_occluded; |
+ |
+ // 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.
|
+ // farther from visible. |
+ return b_priority.distance_to_visible > a_priority.distance_to_visible; |
} |
void TileManager::SetRasterizerForTesting(Rasterizer* rasterizer) { |