OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
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 #include "SkTDArray.h" | 9 #include "SkTDArray.h" |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 class Iter; | 58 class Iter; |
59 | 59 |
60 Iter begin() const; | 60 Iter begin() const; |
61 | 61 |
62 Iter end() const; | 62 Iter end() const; |
63 | 63 |
64 private: | 64 private: |
65 mutable SkTDArray<GrGpuTraceMarker> fMarkerArray; | 65 mutable SkTDArray<GrGpuTraceMarker> fMarkerArray; |
66 }; | 66 }; |
67 | 67 |
| 68 class GrTraceMarkerSet::Iter { |
| 69 public: |
| 70 Iter() {}; |
| 71 Iter& operator=(const Iter& i) { |
| 72 fCurrentIndex = i.fCurrentIndex; |
| 73 fMarkers = i.fMarkers; |
| 74 return *this; |
| 75 } |
| 76 bool operator==(const Iter& i) const { |
| 77 return fCurrentIndex == i.fCurrentIndex && fMarkers == i.fMarkers; |
| 78 } |
| 79 bool operator!=(const Iter& i) const { return !(*this == i); } |
| 80 const GrGpuTraceMarker& operator*() const { return fMarkers->fMarkerArray[fC
urrentIndex]; } |
| 81 Iter& operator++() { |
| 82 SkASSERT(*this != fMarkers->end()); |
| 83 ++fCurrentIndex; |
| 84 return *this; |
| 85 } |
| 86 |
| 87 private: |
| 88 friend class GrTraceMarkerSet; |
| 89 Iter(const GrTraceMarkerSet* markers, int index) |
| 90 : fMarkers(markers), fCurrentIndex(index) { |
| 91 SkASSERT(markers); |
| 92 } |
| 93 |
| 94 const GrTraceMarkerSet* fMarkers; |
| 95 int fCurrentIndex; |
| 96 }; |
| 97 |
68 #endif | 98 #endif |
OLD | NEW |