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/tile_priority.h" | 5 #include "cc/resources/tile_priority.h" |
6 | 6 |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "cc/base/math_util.h" | 8 #include "cc/base/math_util.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 12 matching lines...) Expand all Loading... |
23 } | 23 } |
24 | 24 |
25 inline Range Intersect(const Range& a, const Range& b) { | 25 inline Range Intersect(const Range& a, const Range& b) { |
26 return Range(std::max(a.start_, b.start_), std::min(a.end_, b.end_)); | 26 return Range(std::max(a.start_, b.start_), std::min(a.end_, b.end_)); |
27 } | 27 } |
28 | 28 |
29 bool Range::IsEmpty() { | 29 bool Range::IsEmpty() { |
30 return start_ >= end_; | 30 return start_ >= end_; |
31 } | 31 } |
32 | 32 |
33 inline void IntersectNegativeHalfplane(Range* out, float previous, | 33 inline void IntersectNegativeHalfplane(Range* out, |
34 float current, float target, float time_delta) { | 34 float previous, |
| 35 float current, |
| 36 float target, |
| 37 float time_delta) { |
35 float time_per_dist = time_delta / (current - previous); | 38 float time_per_dist = time_delta / (current - previous); |
36 float t = (target - current) * time_per_dist; | 39 float t = (target - current) * time_per_dist; |
37 if (time_per_dist > 0.0f) | 40 if (time_per_dist > 0.0f) |
38 out->start_ = std::max(out->start_, t); | 41 out->start_ = std::max(out->start_, t); |
39 else | 42 else |
40 out->end_ = std::min(out->end_, t); | 43 out->end_ = std::min(out->end_, t); |
41 } | 44 } |
42 | 45 |
43 inline void IntersectPositiveHalfplane(Range* out, float previous, | 46 inline void IntersectPositiveHalfplane(Range* out, |
44 float current, float target, float time_delta) { | 47 float previous, |
| 48 float current, |
| 49 float target, |
| 50 float time_delta) { |
45 float time_per_dist = time_delta / (current - previous); | 51 float time_per_dist = time_delta / (current - previous); |
46 float t = (target - current) * time_per_dist; | 52 float t = (target - current) * time_per_dist; |
47 if (time_per_dist < 0.0f) | 53 if (time_per_dist < 0.0f) |
48 out->start_ = std::max(out->start_, t); | 54 out->start_ = std::max(out->start_, t); |
49 else | 55 else |
50 out->end_ = std::min(out->end_, t); | 56 out->end_ = std::min(out->end_, t); |
51 } | 57 } |
52 | 58 |
53 } // namespace | 59 } // namespace |
54 | 60 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 scoped_ptr<base::Value> GlobalStateThatImpactsTilePriority::AsValue() const { | 195 scoped_ptr<base::Value> GlobalStateThatImpactsTilePriority::AsValue() const { |
190 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 196 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
191 state->Set("memory_limit_policy", | 197 state->Set("memory_limit_policy", |
192 TileMemoryLimitPolicyAsValue(memory_limit_policy).release()); | 198 TileMemoryLimitPolicyAsValue(memory_limit_policy).release()); |
193 state->SetInteger("memory_limit_in_bytes", memory_limit_in_bytes); | 199 state->SetInteger("memory_limit_in_bytes", memory_limit_in_bytes); |
194 state->Set("tree_priority", TreePriorityAsValue(tree_priority).release()); | 200 state->Set("tree_priority", TreePriorityAsValue(tree_priority).release()); |
195 return state.PassAs<base::Value>(); | 201 return state.PassAs<base::Value>(); |
196 } | 202 } |
197 | 203 |
198 } // namespace cc | 204 } // namespace cc |
OLD | NEW |