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 #ifndef CC_RESOURCES_TILE_PRIORITY_H_ | 5 #ifndef CC_RESOURCES_TILE_PRIORITY_H_ |
6 #define CC_RESOURCES_TILE_PRIORITY_H_ | 6 #define CC_RESOURCES_TILE_PRIORITY_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 // Calculate the time for the |current_bounds| to intersect with the | 117 // Calculate the time for the |current_bounds| to intersect with the |
118 // |target_bounds| given its previous location and time delta. | 118 // |target_bounds| given its previous location and time delta. |
119 // This function should work for both scaling and scrolling case. | 119 // This function should work for both scaling and scrolling case. |
120 static float TimeForBoundsToIntersect(const gfx::RectF& previous_bounds, | 120 static float TimeForBoundsToIntersect(const gfx::RectF& previous_bounds, |
121 const gfx::RectF& current_bounds, | 121 const gfx::RectF& current_bounds, |
122 float time_delta, | 122 float time_delta, |
123 const gfx::RectF& target_bounds); | 123 const gfx::RectF& target_bounds); |
124 | 124 |
| 125 bool operator ==(const TilePriority& other) const { |
| 126 if (is_live != other.is_live) return false; |
| 127 if (!is_live) return true; // All non-live priorities are the same. |
| 128 return resolution == other.resolution && |
| 129 time_to_visible_in_seconds == other.time_to_visible_in_seconds && |
| 130 distance_to_visible_in_pixels == other.distance_to_visible_in_pixels; |
| 131 // No need to compare current_screen_quad which is for debug only and |
| 132 // never changes by itself. |
| 133 } |
| 134 |
| 135 bool operator !=(const TilePriority& other) const { |
| 136 return !(*this == other); |
| 137 } |
| 138 |
125 // If a tile is not live, then all other fields are invalid. | 139 // If a tile is not live, then all other fields are invalid. |
126 bool is_live; | 140 bool is_live; |
127 TileResolution resolution; | 141 TileResolution resolution; |
128 float time_to_visible_in_seconds; | 142 float time_to_visible_in_seconds; |
129 float distance_to_visible_in_pixels; | 143 float distance_to_visible_in_pixels; |
130 | 144 |
131 private: | 145 private: |
132 gfx::QuadF current_screen_quad; | 146 gfx::QuadF current_screen_quad; |
133 }; | 147 }; |
134 | 148 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 size_t memory_limit_in_bytes; | 186 size_t memory_limit_in_bytes; |
173 | 187 |
174 TreePriority tree_priority; | 188 TreePriority tree_priority; |
175 | 189 |
176 scoped_ptr<base::Value> AsValue() const; | 190 scoped_ptr<base::Value> AsValue() const; |
177 }; | 191 }; |
178 | 192 |
179 } // namespace cc | 193 } // namespace cc |
180 | 194 |
181 #endif // CC_RESOURCES_TILE_PRIORITY_H_ | 195 #endif // CC_RESOURCES_TILE_PRIORITY_H_ |
OLD | NEW |