Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(847)

Side by Side Diff: include/core/SkTDArray.h

Issue 156683004: Cleaner external buffer handling in SkWriter32 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make the SkWriter32 constructor call reset Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | include/core/SkWriter32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 bool isEmpty() const { return fCount == 0; } 96 bool isEmpty() const { return fCount == 0; }
97 97
98 /** 98 /**
99 * Return the number of elements in the array 99 * Return the number of elements in the array
100 */ 100 */
101 int count() const { return fCount; } 101 int count() const { return fCount; }
102 102
103 /** 103 /**
104 * Return the total number of elements allocated.
105 * reserved() - count() gives you the number of elements you can add
106 * without causing an allocation.
107 */
108 int reserved() const { return fReserve; }
109
110 /**
104 * return the number of bytes in the array: count * sizeof(T) 111 * return the number of bytes in the array: count * sizeof(T)
105 */ 112 */
106 size_t bytes() const { return fCount * sizeof(T); } 113 size_t bytes() const { return fCount * sizeof(T); }
107 114
108 T* begin() { return fArray; } 115 T* begin() { return fArray; }
109 const T* begin() const { return fArray; } 116 const T* begin() const { return fArray; }
110 T* end() { return fArray ? fArray + fCount : NULL; } 117 T* end() { return fArray ? fArray + fCount : NULL; }
111 const T* end() const { return fArray ? fArray + fCount : NULL; } 118 const T* end() const { return fArray ? fArray + fCount : NULL; }
112 119
113 T& operator[](int index) { 120 T& operator[](int index) {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 #ifdef SK_DEBUG 367 #ifdef SK_DEBUG
361 fData = (ArrayT*)fArray; 368 fData = (ArrayT*)fArray;
362 #endif 369 #endif
363 fReserve = size; 370 fReserve = size;
364 } 371 }
365 fCount += extra; 372 fCount += extra;
366 } 373 }
367 }; 374 };
368 375
369 #endif 376 #endif
OLDNEW
« no previous file with comments | « no previous file | include/core/SkWriter32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698