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 current_screen_quad == other.current_screen_quad; | |
enne (OOO)
2013/03/20 17:05:57
The current screen quad is debug information. You
Xianzhu
2013/03/20 17:24:45
Done.
| |
132 } | |
133 | |
134 bool operator !=(const TilePriority& other) const { | |
135 return !(*this == other); | |
136 } | |
137 | |
125 // If a tile is not live, then all other fields are invalid. | 138 // If a tile is not live, then all other fields are invalid. |
126 bool is_live; | 139 bool is_live; |
127 TileResolution resolution; | 140 TileResolution resolution; |
128 float time_to_visible_in_seconds; | 141 float time_to_visible_in_seconds; |
129 float distance_to_visible_in_pixels; | 142 float distance_to_visible_in_pixels; |
130 | 143 |
131 private: | 144 private: |
132 gfx::QuadF current_screen_quad; | 145 gfx::QuadF current_screen_quad; |
133 }; | 146 }; |
134 | 147 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 size_t memory_limit_in_bytes; | 185 size_t memory_limit_in_bytes; |
173 | 186 |
174 TreePriority tree_priority; | 187 TreePriority tree_priority; |
175 | 188 |
176 scoped_ptr<base::Value> AsValue() const; | 189 scoped_ptr<base::Value> AsValue() const; |
177 }; | 190 }; |
178 | 191 |
179 } // namespace cc | 192 } // namespace cc |
180 | 193 |
181 #endif // CC_RESOURCES_TILE_PRIORITY_H_ | 194 #endif // CC_RESOURCES_TILE_PRIORITY_H_ |
OLD | NEW |