Index: cc/tile_priority.h |
diff --git a/cc/tile_priority.h b/cc/tile_priority.h |
index 7672a38dcd64ad4d21e16a25271b189a771b505b..ae07d5a7b541708f502c286ffeaea7b60b493bed 100644 |
--- a/cc/tile_priority.h |
+++ b/cc/tile_priority.h |
@@ -89,18 +89,30 @@ struct CC_EXPORT TilePriority { |
pending.distance_to_visible_in_pixels); |
} |
- static const double kMaxTimeToVisibleInSeconds; |
- static const double kMaxDistanceInContentSpace; |
- |
- static int manhattanDistance(const gfx::RectF& a, const gfx::RectF& b); |
+ static const float kMaxDistanceInContentSpace; |
+ |
+ static inline float manhattanDistance(const gfx::RectF& a, const gfx::RectF& b) { |
+ // Compute the union explicitly. |
+ gfx::RectF c = gfx::RectF( |
+ std::min(a.x(), b.x()), |
+ std::min(a.y(), b.y()), |
+ std::max(a.right(), b.right()) - std::min(a.x(), b.x()), |
+ std::max(a.bottom(), b.bottom()) - std::min(a.y(), b.y())); |
+ |
+ // Rects touching the edge of the screen should not be considered visible. |
+ // So we add 1 pixel here to avoid that situation. |
+ float x = std::max(0.0f, c.width() - a.width() - b.width() + 1.0f); |
+ float y = std::max(0.0f, c.height() - a.height() - b.height() + 1.0f); |
+ return (x + y); |
+ } |
// Calculate the time for the |current_bounds| to intersect with the |
// |target_bounds| given its previous location and time delta. |
// This function should work for both scaling and scrolling case. |
- static double TimeForBoundsToIntersect(gfx::RectF previous_bounds, |
- gfx::RectF current_bounds, |
- double time_delta, |
- gfx::RectF target_bounds); |
+ static float TimeForBoundsToIntersect(const gfx::RectF& previous_bounds, |
+ const gfx::RectF& current_bounds, |
+ float time_delta, |
+ const gfx::RectF& target_bounds); |
// If a tile is not live, then all other fields are invalid. |
bool is_live; |