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

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

Issue 923583002: [SkSVGDevice] Full font family support (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 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 | src/svg/SkSVGDevice.cpp » ('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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkTArray_DEFINED 8 #ifndef SkTArray_DEFINED
9 #define SkTArray_DEFINED 9 #define SkTArray_DEFINED
10 10
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 return false; 357 return false;
358 } 358 }
359 } 359 }
360 return true; 360 return true;
361 } 361 }
362 362
363 bool operator!=(const SkTArray<T, MEM_COPY>& right) const { 363 bool operator!=(const SkTArray<T, MEM_COPY>& right) const {
364 return !(*this == right); 364 return !(*this == right);
365 } 365 }
366 366
367 int find(const T& elem) const {
f(malita) 2015/02/12 17:37:47 Similar to SkTDArray's helpers.
368 const T* iter = fItemArray;
369 const T* stop = fItemArray + fCount;
370
371 for (; iter < stop; iter++) {
372 if (*iter == elem) {
373 return (int) (iter - fItemArray);
reed1 2015/02/12 17:55:13 SkToInt()
f(malita) 2015/02/12 18:10:19 Done.
374 }
375 }
376 return -1;
377 }
378
379 int rfind(const T& elem) const {
380 const T* iter = fItemArray + fCount;
381 const T* stop = fItemArray;
382
383 while (iter > stop) {
384 if (*--iter == elem) {
385 return SkToInt(iter - stop);
386 }
387 }
388 return -1;
389 }
390
367 protected: 391 protected:
368 /** 392 /**
369 * Creates an empty array that will use the passed storage block until it 393 * Creates an empty array that will use the passed storage block until it
370 * is insufficiently large to hold the entire array. 394 * is insufficiently large to hold the entire array.
371 */ 395 */
372 template <int N> 396 template <int N>
373 SkTArray(SkAlignedSTStorage<N,T>* storage) { 397 SkTArray(SkAlignedSTStorage<N,T>* storage) {
374 this->init(NULL, 0, storage->get(), N); 398 this->init(NULL, 0, storage->get(), N);
375 } 399 }
376 400
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 SkSTArray& operator= (const INHERITED& array) { 564 SkSTArray& operator= (const INHERITED& array) {
541 INHERITED::operator=(array); 565 INHERITED::operator=(array);
542 return *this; 566 return *this;
543 } 567 }
544 568
545 private: 569 private:
546 SkAlignedSTStorage<N,T> fStorage; 570 SkAlignedSTStorage<N,T> fStorage;
547 }; 571 };
548 572
549 #endif 573 #endif
OLDNEW
« no previous file with comments | « no previous file | src/svg/SkSVGDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698