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 SkTemplates_DEFINED | 10 #ifndef SkTemplates_DEFINED |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 /** Resize the memory area pointed to by the current ptr preserving contents
. */ | 318 /** Resize the memory area pointed to by the current ptr preserving contents
. */ |
319 void realloc(size_t count) { | 319 void realloc(size_t count) { |
320 fPtr = reinterpret_cast<T*>(sk_realloc_throw(fPtr, count * sizeof(T))); | 320 fPtr = reinterpret_cast<T*>(sk_realloc_throw(fPtr, count * sizeof(T))); |
321 } | 321 } |
322 | 322 |
323 /** Resize the memory area pointed to by the current ptr without preserving
contents. */ | 323 /** Resize the memory area pointed to by the current ptr without preserving
contents. */ |
324 void reset(size_t count) { | 324 void reset(size_t count) { |
325 sk_free(fPtr); | 325 sk_free(fPtr); |
326 fPtr = fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | S
K_MALLOC_TEMP); | 326 fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_MALLO
C_TEMP); |
327 } | 327 } |
328 | 328 |
329 T* get() const { return fPtr; } | 329 T* get() const { return fPtr; } |
330 | 330 |
331 operator T*() { | 331 operator T*() { |
332 return fPtr; | 332 return fPtr; |
333 } | 333 } |
334 | 334 |
335 operator const T*() const { | 335 operator const T*() const { |
336 return fPtr; | 336 return fPtr; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 /** | 448 /** |
449 * Returns void* because this object does not initialize the | 449 * Returns void* because this object does not initialize the |
450 * memory. Use placement new for types that require a cons. | 450 * memory. Use placement new for types that require a cons. |
451 */ | 451 */ |
452 void* get() { return fStorage.get(); } | 452 void* get() { return fStorage.get(); } |
453 private: | 453 private: |
454 SkAlignedSStorage<sizeof(T)*N> fStorage; | 454 SkAlignedSStorage<sizeof(T)*N> fStorage; |
455 }; | 455 }; |
456 | 456 |
457 #endif | 457 #endif |
OLD | NEW |