| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkTArray_DEFINED | 8 #ifndef SkTArray_DEFINED |
| 9 #define SkTArray_DEFINED | 9 #define SkTArray_DEFINED |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 sk_free(fMemArray); | 105 sk_free(fMemArray); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * Resets to count() == 0 | 110 * Resets to count() == 0 |
| 111 */ | 111 */ |
| 112 void reset() { this->pop_back_n(fCount); } | 112 void reset() { this->pop_back_n(fCount); } |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * Resets to a copy of a C array. |
| 116 */ |
| 117 void reset(const T* array, int count) { |
| 118 for (int i = 0; i < fCount; ++i) { |
| 119 fItemArray[i].~T(); |
| 120 } |
| 121 int delta = count - fCount; |
| 122 this->checkRealloc(delta); |
| 123 fCount = count; |
| 124 for (int i = 0; i < count; ++i) { |
| 125 SkTArrayExt::copy(this, array); |
| 126 } |
| 127 } |
| 128 |
| 129 /** |
| 115 * Number of elements in the array. | 130 * Number of elements in the array. |
| 116 */ | 131 */ |
| 117 int count() const { return fCount; } | 132 int count() const { return fCount; } |
| 118 | 133 |
| 119 /** | 134 /** |
| 120 * Is the array empty. | 135 * Is the array empty. |
| 121 */ | 136 */ |
| 122 bool empty() const { return !fCount; } | 137 bool empty() const { return !fCount; } |
| 123 | 138 |
| 124 /** | 139 /** |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 SkSTArray& operator= (const INHERITED& array) { | 448 SkSTArray& operator= (const INHERITED& array) { |
| 434 INHERITED::operator=(array); | 449 INHERITED::operator=(array); |
| 435 return *this; | 450 return *this; |
| 436 } | 451 } |
| 437 | 452 |
| 438 private: | 453 private: |
| 439 SkAlignedSTStorage<N,T> fStorage; | 454 SkAlignedSTStorage<N,T> fStorage; |
| 440 }; | 455 }; |
| 441 | 456 |
| 442 #endif | 457 #endif |
| OLD | NEW |