OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkTDPQueue_DEFINED | 8 #ifndef SkTDPQueue_DEFINED |
9 #define SkTDPQueue_DEFINED | 9 #define SkTDPQueue_DEFINED |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 allowed if an INDEX function is provided. */ | 85 allowed if an INDEX function is provided. */ |
86 void priorityDidChange(T entry) { | 86 void priorityDidChange(T entry) { |
87 SkASSERT(NULL != INDEX); | 87 SkASSERT(NULL != INDEX); |
88 int index = *INDEX(entry); | 88 int index = *INDEX(entry); |
89 SkASSERT(index >= 0 && index < fArray.count()); | 89 SkASSERT(index >= 0 && index < fArray.count()); |
90 this->validate(index); | 90 this->validate(index); |
91 this->percolateUpOrDown(index); | 91 this->percolateUpOrDown(index); |
92 this->validate(); | 92 this->validate(); |
93 } | 93 } |
94 | 94 |
| 95 #ifdef SK_DEBUG |
| 96 T at(int i) const { return fArray[i]; } |
| 97 #endif |
| 98 |
95 private: | 99 private: |
96 static int LeftOf(int x) { SkASSERT(x >= 0); return 2 * x + 1; } | 100 static int LeftOf(int x) { SkASSERT(x >= 0); return 2 * x + 1; } |
97 static int ParentOf(int x) { SkASSERT(x > 0); return (x - 1) >> 1; } | 101 static int ParentOf(int x) { SkASSERT(x > 0); return (x - 1) >> 1; } |
98 | 102 |
99 void percolateUpOrDown(int index) { | 103 void percolateUpOrDown(int index) { |
100 SkASSERT(index >= 0); | 104 SkASSERT(index >= 0); |
101 if (!percolateUpIfNecessary(index)) { | 105 if (!percolateUpIfNecessary(index)) { |
102 this->validate(index); | 106 this->validate(index); |
103 this->percolateDownIfNecessary(index); | 107 this->percolateDownIfNecessary(index); |
104 } | 108 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 186 } |
183 #endif | 187 #endif |
184 } | 188 } |
185 | 189 |
186 SkTDArray<T> fArray; | 190 SkTDArray<T> fArray; |
187 | 191 |
188 typedef SkNoncopyable INHERITED; | 192 typedef SkNoncopyable INHERITED; |
189 }; | 193 }; |
190 | 194 |
191 #endif | 195 #endif |
OLD | NEW |