Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(864)

Side by Side Diff: src/core/SkTDPQueue.h

Issue 955433003: Make STDPQueue::at() available in all builds. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 95 /** Gets the item at index i in the priority queue (for i < this->count()). at(0) is equivalent
96 to peek(). Otherwise, there is no guarantee about ordering of elements i n the queue. */
96 T at(int i) const { return fArray[i]; } 97 T at(int i) const { return fArray[i]; }
97 #endif
98 98
99 private: 99 private:
100 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; }
101 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; }
102 102
103 void percolateUpOrDown(int index) { 103 void percolateUpOrDown(int index) {
104 SkASSERT(index >= 0); 104 SkASSERT(index >= 0);
105 if (!percolateUpIfNecessary(index)) { 105 if (!percolateUpIfNecessary(index)) {
106 this->validate(index); 106 this->validate(index);
107 this->percolateDownIfNecessary(index); 107 this->percolateDownIfNecessary(index);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 #endif 187 #endif
188 } 188 }
189 189
190 SkTDArray<T> fArray; 190 SkTDArray<T> fArray;
191 191
192 typedef SkNoncopyable INHERITED; 192 typedef SkNoncopyable INHERITED;
193 }; 193 };
194 194
195 #endif 195 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698