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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 for (int i = 0; i < fCount; ++i) { | 100 for (int i = 0; i < fCount; ++i) { |
101 fItemArray[i].~T(); | 101 fItemArray[i].~T(); |
102 } | 102 } |
103 fCount = 0; | 103 fCount = 0; |
104 this->checkRealloc((int)array.count()); | 104 this->checkRealloc((int)array.count()); |
105 fCount = array.count(); | 105 fCount = array.count(); |
106 SkTArrayExt::copy(this, static_cast<const T*>(array.fMemArray)); | 106 SkTArrayExt::copy(this, static_cast<const T*>(array.fMemArray)); |
107 return *this; | 107 return *this; |
108 } | 108 } |
109 | 109 |
110 virtual ~SkTArray() { | 110 ~SkTArray() { |
111 for (int i = 0; i < fCount; ++i) { | 111 for (int i = 0; i < fCount; ++i) { |
112 fItemArray[i].~T(); | 112 fItemArray[i].~T(); |
113 } | 113 } |
114 if (fMemArray != fPreAllocMemArray) { | 114 if (fMemArray != fPreAllocMemArray) { |
115 sk_free(fMemArray); | 115 sk_free(fMemArray); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 /** | 119 /** |
120 * Resets to count() == 0 | 120 * Resets to count() == 0 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 SkSTArray& operator= (const INHERITED& array) { | 540 SkSTArray& operator= (const INHERITED& array) { |
541 INHERITED::operator=(array); | 541 INHERITED::operator=(array); |
542 return *this; | 542 return *this; |
543 } | 543 } |
544 | 544 |
545 private: | 545 private: |
546 SkAlignedSTStorage<N,T> fStorage; | 546 SkAlignedSTStorage<N,T> fStorage; |
547 }; | 547 }; |
548 | 548 |
549 #endif | 549 #endif |
OLD | NEW |