| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 UI_GFX_BREAK_LIST_H_ | 5 #ifndef UI_GFX_BREAK_LIST_H_ |
| 6 #define UI_GFX_BREAK_LIST_H_ | 6 #define UI_GFX_BREAK_LIST_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // The break type and const iterator, typedef'ed for convenience. | 29 // The break type and const iterator, typedef'ed for convenience. |
| 30 typedef std::pair<size_t, T> Break; | 30 typedef std::pair<size_t, T> Break; |
| 31 typedef typename std::vector<Break>::const_iterator const_iterator; | 31 typedef typename std::vector<Break>::const_iterator const_iterator; |
| 32 | 32 |
| 33 // Initialize a break at position 0 with the default or supplied |value|. | 33 // Initialize a break at position 0 with the default or supplied |value|. |
| 34 BreakList(); | 34 BreakList(); |
| 35 explicit BreakList(T value); | 35 explicit BreakList(T value); |
| 36 | 36 |
| 37 const std::vector<Break>& breaks() const { return breaks_; } | 37 const std::vector<Break>& breaks() const { return breaks_; } |
| 38 | 38 |
| 39 size_t max() const { return max_; } |
| 40 |
| 39 // Clear the breaks and set a break at position 0 with the supplied |value|. | 41 // Clear the breaks and set a break at position 0 with the supplied |value|. |
| 40 void SetValue(T value); | 42 void SetValue(T value); |
| 41 | 43 |
| 42 // Adjust the breaks to apply |value| over the supplied |range|. | 44 // Adjust the breaks to apply |value| over the supplied |range|. |
| 43 void ApplyValue(T value, const ui::Range& range); | 45 void ApplyValue(T value, const ui::Range& range); |
| 44 | 46 |
| 45 // Set the max position and trim any breaks at or beyond that position. | 47 // Set the max position and trim any breaks at or beyond that position. |
| 46 void SetMax(size_t max); | 48 void SetMax(size_t max); |
| 47 | 49 |
| 48 // Get the break applicable to |position| (at or preceeding |position|). | 50 // Get the break applicable to |position| (at or preceeding |position|). |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 DCHECK_NE(breaks_[i].second, breaks_[i + 1].second) << "Redundant break."; | 167 DCHECK_NE(breaks_[i].second, breaks_[i + 1].second) << "Redundant break."; |
| 166 } | 168 } |
| 167 if (max_ > 0) | 169 if (max_ > 0) |
| 168 DCHECK_LT(breaks_.back().first, max_) << "Break beyond max position."; | 170 DCHECK_LT(breaks_.back().first, max_) << "Break beyond max position."; |
| 169 } | 171 } |
| 170 #endif | 172 #endif |
| 171 | 173 |
| 172 } // namespace gfx | 174 } // namespace gfx |
| 173 | 175 |
| 174 #endif // UI_GFX_BREAK_LIST_H_ | 176 #endif // UI_GFX_BREAK_LIST_H_ |
| OLD | NEW |