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

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

Issue 18363003: fix copy in SkTDArray (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 SkASSERT(!max || dst); 261 SkASSERT(!max || dst);
262 if (index >= fCount) { 262 if (index >= fCount) {
263 return 0; 263 return 0;
264 } 264 }
265 int count = SkMin32(max, fCount - index); 265 int count = SkMin32(max, fCount - index);
266 memcpy(dst, fArray + index, sizeof(T) * count); 266 memcpy(dst, fArray + index, sizeof(T) * count);
267 return count; 267 return count;
268 } 268 }
269 269
270 void copy(T* dst) const { 270 void copy(T* dst) const {
271 this->copyRange(0, fCount, dst); 271 this->copyRange(dst, 0, fCount);
272 } 272 }
273 273
274 // routines to treat the array like a stack 274 // routines to treat the array like a stack
275 T* push() { return this->append(); } 275 T* push() { return this->append(); }
276 void push(const T& elem) { *this->append() = elem; } 276 void push(const T& elem) { *this->append() = elem; }
277 const T& top() const { return (*this)[fCount - 1]; } 277 const T& top() const { return (*this)[fCount - 1]; }
278 T& top() { return (*this)[fCount - 1]; } 278 T& top() { return (*this)[fCount - 1]; }
279 void pop(T* elem) { if (elem) *elem = (*this)[fCount - 1]; --fCount; } 279 void pop(T* elem) { if (elem) *elem = (*this)[fCount - 1]; --fCount; }
280 void pop() { --fCount; } 280 void pop() { --fCount; }
281 281
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 #ifdef SK_DEBUG 359 #ifdef SK_DEBUG
360 fData = (ArrayT*)fArray; 360 fData = (ArrayT*)fArray;
361 #endif 361 #endif
362 fReserve = size; 362 fReserve = size;
363 } 363 }
364 fCount += extra; 364 fCount += extra;
365 } 365 }
366 }; 366 };
367 367
368 #endif 368 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698