Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 SkASSERT(i < fCount); | 273 SkASSERT(i < fCount); |
| 274 return fItemArray[fCount - i - 1]; | 274 return fItemArray[fCount - i - 1]; |
| 275 } | 275 } |
| 276 | 276 |
| 277 const T& fromBack(int i) const { | 277 const T& fromBack(int i) const { |
| 278 SkASSERT(i >= 0); | 278 SkASSERT(i >= 0); |
| 279 SkASSERT(i < fCount); | 279 SkASSERT(i < fCount); |
| 280 return fItemArray[fCount - i - 1]; | 280 return fItemArray[fCount - i - 1]; |
| 281 } | 281 } |
| 282 | 282 |
| 283 bool operator==(const SkTArray<T, MEM_COPY>& right) const { | |
| 284 int leftCount = count(); | |
|
bsalomon
2013/03/08 18:27:20
this->count();
| |
| 285 if (leftCount != right.count()) { | |
| 286 return false; | |
| 287 } | |
| 288 for (int index = 0; index < leftCount; ++index) { | |
| 289 if (fItemArray[index] != right.fItemArray[index]) { | |
| 290 return false; | |
| 291 } | |
| 292 } | |
| 293 return true; | |
| 294 } | |
| 295 | |
| 296 bool operator!=(const SkTArray<T, MEM_COPY>& right) const { | |
| 297 return !(*this == right); | |
| 298 } | |
| 299 | |
| 283 protected: | 300 protected: |
| 284 /** | 301 /** |
| 285 * Creates an empty array that will use the passed storage block until it | 302 * Creates an empty array that will use the passed storage block until it |
| 286 * is insufficiently large to hold the entire array. | 303 * is insufficiently large to hold the entire array. |
| 287 */ | 304 */ |
| 288 template <int N> | 305 template <int N> |
| 289 SkTArray(SkAlignedSTStorage<N,T>* storage) { | 306 SkTArray(SkAlignedSTStorage<N,T>* storage) { |
| 290 this->init(NULL, 0, storage->get(), N); | 307 this->init(NULL, 0, storage->get(), N); |
| 291 } | 308 } |
| 292 | 309 |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 SkSTArray& operator= (const INHERITED& array) { | 433 SkSTArray& operator= (const INHERITED& array) { |
| 417 INHERITED::operator=(array); | 434 INHERITED::operator=(array); |
| 418 return *this; | 435 return *this; |
| 419 } | 436 } |
| 420 | 437 |
| 421 private: | 438 private: |
| 422 SkAlignedSTStorage<N,T> fStorage; | 439 SkAlignedSTStorage<N,T> fStorage; |
| 423 }; | 440 }; |
| 424 | 441 |
| 425 #endif | 442 #endif |
| OLD | NEW |