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 #include "cc/resources/priority_calculator.h" | 5 #include "cc/resources/priority_calculator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // static | 63 // static |
64 int PriorityCalculator::LingeringPriority(int previous_priority) { | 64 int PriorityCalculator::LingeringPriority(int previous_priority) { |
65 // TODO(reveman): We should remove this once we have priorities for all | 65 // TODO(reveman): We should remove this once we have priorities for all |
66 // textures (we can't currently calculate distances for off-screen textures). | 66 // textures (we can't currently calculate distances for off-screen textures). |
67 return std::min(kLingeringLimitPriority, | 67 return std::min(kLingeringLimitPriority, |
68 std::max(kLingeringBasePriority, previous_priority + 1)); | 68 std::max(kLingeringBasePriority, previous_priority + 1)); |
69 } | 69 } |
70 | 70 |
71 // static | 71 // static |
72 int PriorityCalculator::PriorityFromDistance(gfx::Rect visible_rect, | 72 int PriorityCalculator::PriorityFromDistance(const gfx::Rect& visible_rect, |
73 gfx::Rect texture_rect, | 73 const gfx::Rect& texture_rect, |
74 bool draws_to_root_surface) { | 74 bool draws_to_root_surface) { |
75 int distance = visible_rect.ManhattanInternalDistance(texture_rect); | 75 int distance = visible_rect.ManhattanInternalDistance(texture_rect); |
76 if (!distance) | 76 if (!distance) |
77 return VisiblePriority(draws_to_root_surface); | 77 return VisiblePriority(draws_to_root_surface); |
78 return std::min(kNotVisibleLimitPriority, kNotVisibleBasePriority + distance); | 78 return std::min(kNotVisibleLimitPriority, kNotVisibleBasePriority + distance); |
79 } | 79 } |
80 | 80 |
81 // static | 81 // static |
82 int PriorityCalculator::SmallAnimatedLayerMinPriority() { | 82 int PriorityCalculator::SmallAnimatedLayerMinPriority() { |
83 return kSmallAnimatedLayerPriority; | 83 return kSmallAnimatedLayerPriority; |
(...skipping 23 matching lines...) Expand all Loading... |
107 int PriorityCalculator::AllowVisibleAndNearbyCutoff() { | 107 int PriorityCalculator::AllowVisibleAndNearbyCutoff() { |
108 return kVisibleAndNearbyPriorityCutoff; | 108 return kVisibleAndNearbyPriorityCutoff; |
109 } | 109 } |
110 | 110 |
111 // static | 111 // static |
112 int PriorityCalculator::AllowEverythingCutoff() { | 112 int PriorityCalculator::AllowEverythingCutoff() { |
113 return kEverythingPriorityCutoff; | 113 return kEverythingPriorityCutoff; |
114 } | 114 } |
115 | 115 |
116 } // namespace cc | 116 } // namespace cc |
OLD | NEW |