| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkTDArray_DEFINED | 10 #ifndef SkTDArray_DEFINED |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 SkASSERT(!max || dst); | 261 SkASSERT(!max || dst); |
| 262 if (index >= fCount) { | 262 if (index >= fCount) { |
| 263 return 0; | 263 return 0; |
| 264 } | 264 } |
| 265 int count = SkMin32(max, fCount - index); | 265 int count = SkMin32(max, fCount - index); |
| 266 memcpy(dst, fArray + index, sizeof(T) * count); | 266 memcpy(dst, fArray + index, sizeof(T) * count); |
| 267 return count; | 267 return count; |
| 268 } | 268 } |
| 269 | 269 |
| 270 void copy(T* dst) const { | 270 void copy(T* dst) const { |
| 271 this->copyRange(0, fCount, dst); | 271 this->copyRange(dst, 0, fCount); |
| 272 } | 272 } |
| 273 | 273 |
| 274 // routines to treat the array like a stack | 274 // routines to treat the array like a stack |
| 275 T* push() { return this->append(); } | 275 T* push() { return this->append(); } |
| 276 void push(const T& elem) { *this->append() = elem; } | 276 void push(const T& elem) { *this->append() = elem; } |
| 277 const T& top() const { return (*this)[fCount - 1]; } | 277 const T& top() const { return (*this)[fCount - 1]; } |
| 278 T& top() { return (*this)[fCount - 1]; } | 278 T& top() { return (*this)[fCount - 1]; } |
| 279 void pop(T* elem) { if (elem) *elem = (*this)[fCount - 1]; --fCount;
} | 279 void pop(T* elem) { if (elem) *elem = (*this)[fCount - 1]; --fCount;
} |
| 280 void pop() { --fCount; } | 280 void pop() { --fCount; } |
| 281 | 281 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 #ifdef SK_DEBUG | 359 #ifdef SK_DEBUG |
| 360 fData = (ArrayT*)fArray; | 360 fData = (ArrayT*)fArray; |
| 361 #endif | 361 #endif |
| 362 fReserve = size; | 362 fReserve = size; |
| 363 } | 363 } |
| 364 fCount += extra; | 364 fCount += extra; |
| 365 } | 365 } |
| 366 }; | 366 }; |
| 367 | 367 |
| 368 #endif | 368 #endif |
| OLD | NEW |