aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkTArray.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkTArray.h')
-rw-r--r--include/core/SkTArray.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/core/SkTArray.h b/include/core/SkTArray.h
index 45808d4b60..bb5e57eada 100644
--- a/include/core/SkTArray.h
+++ b/include/core/SkTArray.h
@@ -112,6 +112,21 @@ public:
void reset() { this->pop_back_n(fCount); }
/**
+ * Resets to a copy of a C array.
+ */
+ void reset(const T* array, int count) {
+ for (int i = 0; i < fCount; ++i) {
+ fItemArray[i].~T();
+ }
+ int delta = count - fCount;
+ this->checkRealloc(delta);
+ fCount = count;
+ for (int i = 0; i < count; ++i) {
+ SkTArrayExt::copy(this, array);
+ }
+ }
+
+ /**
* Number of elements in the array.
*/
int count() const { return fCount; }