OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 GrAuditTrail_DEFINED | 8 #ifndef GrAuditTrail_DEFINED |
9 #define GrAuditTrail_DEFINED | 9 #define GrAuditTrail_DEFINED |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 SkRect fBounds; | 107 SkRect fBounds; |
108 uint32_t fRenderTargetUniqueID; | 108 uint32_t fRenderTargetUniqueID; |
109 struct Batch { | 109 struct Batch { |
110 int fClientID; | 110 int fClientID; |
111 SkRect fBounds; | 111 SkRect fBounds; |
112 }; | 112 }; |
113 SkTArray<Batch> fBatches; | 113 SkTArray<Batch> fBatches; |
114 }; | 114 }; |
115 | 115 |
116 void getBoundsByClientID(SkTArray<BatchInfo>* outInfo, int clientID); | 116 void getBoundsByClientID(SkTArray<BatchInfo>* outInfo, int clientID); |
| 117 void getBoundsByBatchListID(BatchInfo* outInfo, int batchListID); |
117 | 118 |
118 void fullReset(); | 119 void fullReset(); |
119 | 120 |
120 static const int kGrAuditTrailInvalidID; | 121 static const int kGrAuditTrailInvalidID; |
121 | 122 |
122 private: | 123 private: |
123 // TODO if performance becomes an issue, we can move to using SkVarAlloc | 124 // TODO if performance becomes an issue, we can move to using SkVarAlloc |
124 struct Batch { | 125 struct Batch { |
125 SkString toJson() const; | 126 SkString toJson() const; |
126 SkString fName; | 127 SkString fName; |
127 SkRect fBounds; | 128 SkRect fBounds; |
128 int fClientID; | 129 int fClientID; |
129 int fBatchListID; | 130 int fBatchListID; |
130 int fChildID; | 131 int fChildID; |
131 }; | 132 }; |
132 typedef SkTArray<SkAutoTDelete<Batch>, true> BatchPool; | 133 typedef SkTArray<SkAutoTDelete<Batch>, true> BatchPool; |
133 | 134 |
134 typedef SkTArray<Batch*> Batches; | 135 typedef SkTArray<Batch*> Batches; |
135 | 136 |
136 struct BatchNode { | 137 struct BatchNode { |
137 SkString toJson() const; | 138 SkString toJson() const; |
138 SkRect fBounds; | 139 SkRect fBounds; |
139 Batches fChildren; | 140 Batches fChildren; |
140 uint32_t fRenderTargetUniqueID; | 141 uint32_t fRenderTargetUniqueID; |
141 }; | 142 }; |
142 typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList; | 143 typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList; |
143 | 144 |
| 145 void copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID); |
| 146 |
144 template <typename T> | 147 template <typename T> |
145 static void JsonifyTArray(SkString* json, const char* name, const T& array, | 148 static void JsonifyTArray(SkString* json, const char* name, const T& array, |
146 bool addComma); | 149 bool addComma); |
147 | 150 |
148 Batch* fCurrentBatch; | 151 Batch* fCurrentBatch; |
149 BatchPool fBatchPool; | 152 BatchPool fBatchPool; |
150 SkTHashMap<GrBatch*, int> fIDLookup; | 153 SkTHashMap<GrBatch*, int> fIDLookup; |
151 SkTHashMap<int, Batches*> fClientIDLookup; | 154 SkTHashMap<int, Batches*> fClientIDLookup; |
152 BatchList fBatchList; | 155 BatchList fBatchList; |
153 | 156 |
(...skipping 17 matching lines...) Expand all Loading... |
171 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \ | 174 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \ |
172 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds); | 175 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds); |
173 | 176 |
174 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combiner) \ | 177 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combiner) \ |
175 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combiner); | 178 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combiner); |
176 | 179 |
177 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \ | 180 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \ |
178 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultNew, batch); | 181 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultNew, batch); |
179 | 182 |
180 #endif | 183 #endif |
OLD | NEW |