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 |
11 #define SkTDArray_DEFINED | 11 #define SkTDArray_DEFINED |
12 | 12 |
13 #include "SkTypes.h" | 13 #include "SkTypes.h" |
14 | 14 |
15 template <typename T> class SK_API SkTDArray { | 15 template <typename T> class SkTDArray { |
16 public: | 16 public: |
17 SkTDArray() { | 17 SkTDArray() { |
18 fReserve = fCount = 0; | 18 fReserve = fCount = 0; |
19 fArray = NULL; | 19 fArray = NULL; |
20 #ifdef SK_DEBUG | 20 #ifdef SK_DEBUG |
21 fData = NULL; | 21 fData = NULL; |
22 #endif | 22 #endif |
23 } | 23 } |
24 SkTDArray(const T src[], int count) { | 24 SkTDArray(const T src[], int count) { |
25 SkASSERT(src || count == 0); | 25 SkASSERT(src || count == 0); |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 fReserve = count + 4; | 380 fReserve = count + 4; |
381 fReserve += fReserve / 4; | 381 fReserve += fReserve / 4; |
382 fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T)); | 382 fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T)); |
383 #ifdef SK_DEBUG | 383 #ifdef SK_DEBUG |
384 fData = (ArrayT*)fArray; | 384 fData = (ArrayT*)fArray; |
385 #endif | 385 #endif |
386 } | 386 } |
387 }; | 387 }; |
388 | 388 |
389 #endif | 389 #endif |
OLD | NEW |