| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_PRIORITY_CALCULATOR_H_ | 5 #ifndef CC_RESOURCES_PRIORITY_CALCULATOR_H_ |
| 6 #define CC_RESOURCES_PRIORITY_CALCULATOR_H_ | 6 #define CC_RESOURCES_PRIORITY_CALCULATOR_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" |
| 8 #include "cc/base/cc_export.h" | 9 #include "cc/base/cc_export.h" |
| 9 | 10 |
| 10 namespace gfx { class Rect; } | 11 namespace gfx { class Rect; } |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 | 14 |
| 14 class CC_EXPORT PriorityCalculator { | 15 class CC_EXPORT PriorityCalculator { |
| 15 public: | 16 public: |
| 17 PriorityCalculator() {} |
| 18 |
| 16 static int UIPriority(bool draws_to_root_surface); | 19 static int UIPriority(bool draws_to_root_surface); |
| 17 static int VisiblePriority(bool draws_to_root_surface); | 20 static int VisiblePriority(bool draws_to_root_surface); |
| 18 static int RenderSurfacePriority(); | 21 static int RenderSurfacePriority(); |
| 19 static int LingeringPriority(int previous_priority); | 22 static int LingeringPriority(int previous_priority); |
| 20 static int PriorityFromDistance(gfx::Rect visible_rect, | 23 static int PriorityFromDistance(gfx::Rect visible_rect, |
| 21 gfx::Rect texture_rect, | 24 gfx::Rect texture_rect, |
| 22 bool draws_to_root_surface); | 25 bool draws_to_root_surface); |
| 23 static int SmallAnimatedLayerMinPriority(); | 26 static int SmallAnimatedLayerMinPriority(); |
| 24 | 27 |
| 25 static int HighestPriority(); | 28 static int HighestPriority(); |
| 26 static int LowestPriority(); | 29 static int LowestPriority(); |
| 27 static inline bool priority_is_lower(int a, int b) { return a > b; } | 30 static inline bool priority_is_lower(int a, int b) { return a > b; } |
| 28 static inline bool priority_is_higher(int a, int b) { return a < b; } | 31 static inline bool priority_is_higher(int a, int b) { return a < b; } |
| 29 static inline int max_priority(int a, int b) { | 32 static inline int max_priority(int a, int b) { |
| 30 return priority_is_higher(a, b) ? a : b; | 33 return priority_is_higher(a, b) ? a : b; |
| 31 } | 34 } |
| 32 | 35 |
| 33 static int AllowNothingCutoff(); | 36 static int AllowNothingCutoff(); |
| 34 static int AllowVisibleOnlyCutoff(); | 37 static int AllowVisibleOnlyCutoff(); |
| 35 static int AllowVisibleAndNearbyCutoff(); | 38 static int AllowVisibleAndNearbyCutoff(); |
| 36 static int AllowEverythingCutoff(); | 39 static int AllowEverythingCutoff(); |
| 40 |
| 41 private: |
| 42 DISALLOW_COPY_AND_ASSIGN(PriorityCalculator); |
| 37 }; | 43 }; |
| 38 | 44 |
| 39 } // namespace cc | 45 } // namespace cc |
| 40 | 46 |
| 41 #endif // CC_RESOURCES_PRIORITY_CALCULATOR_H_ | 47 #endif // CC_RESOURCES_PRIORITY_CALCULATOR_H_ |
| OLD | NEW |