| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 SkString toJson(bool prettyPrint = false) const; | 118 SkString toJson(bool prettyPrint = false) const; |
| 119 | 119 |
| 120 // returns a json string of all of the batches associated with a given clien
t id | 120 // returns a json string of all of the batches associated with a given clien
t id |
| 121 SkString toJson(int clientID, bool prettyPrint = false) const; | 121 SkString toJson(int clientID, bool prettyPrint = false) const; |
| 122 | 122 |
| 123 bool isEnabled() { return fEnabled; } | 123 bool isEnabled() { return fEnabled; } |
| 124 void setEnabled(bool enabled) { fEnabled = enabled; } | 124 void setEnabled(bool enabled) { fEnabled = enabled; } |
| 125 | 125 |
| 126 void setClientID(int clientID) { fClientID = clientID; } | 126 void setClientID(int clientID) { fClientID = clientID; } |
| 127 | 127 |
| 128 // We could just return our internal bookkeeping struct if copying the data
out becomes |
| 129 // a performance issue, but until then its nice to decouple |
| 130 struct BatchInfo { |
| 131 SkRect fBounds; |
| 132 struct Batch { |
| 133 int fClientID; |
| 134 SkRect fBounds; |
| 135 }; |
| 136 SkTArray<Batch> fBatches; |
| 137 }; |
| 138 |
| 139 void getBoundsByClientID(SkTArray<BatchInfo>* outInfo, int clientID); |
| 140 |
| 128 void fullReset() { | 141 void fullReset() { |
| 129 SkASSERT(fEnabled); | 142 SkASSERT(fEnabled); |
| 130 fBatchList.reset(); | 143 fBatchList.reset(); |
| 131 fIDLookup.reset(); | 144 fIDLookup.reset(); |
| 132 // free all client batches | 145 // free all client batches |
| 133 fClientIDLookup.foreach([](const int&, Batches** batches) { delete *batc
hes; }); | 146 fClientIDLookup.foreach([](const int&, Batches** batches) { delete *batc
hes; }); |
| 134 fClientIDLookup.reset(); | 147 fClientIDLookup.reset(); |
| 135 fBatchPool.reset(); // must be last, frees all of the memory | 148 fBatchPool.reset(); // must be last, frees all of the memory |
| 136 } | 149 } |
| 137 | 150 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \ | 201 #define GR_AUDIT_TRAIL_ADDBATCH(audit_trail, batchname, bounds) \ |
| 189 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds); | 202 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, addBatch, batchname, bounds); |
| 190 | 203 |
| 191 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combiner) \ | 204 #define GR_AUDIT_TRAIL_BATCHING_RESULT_COMBINED(audit_trail, combiner) \ |
| 192 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combiner); | 205 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultCombined, combiner); |
| 193 | 206 |
| 194 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \ | 207 #define GR_AUDIT_TRAIL_BATCHING_RESULT_NEW(audit_trail, batch) \ |
| 195 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultNew, batch); | 208 GR_AUDIT_TRAIL_INVOKE_GUARD(audit_trail, batchingResultNew, batch); |
| 196 | 209 |
| 197 #endif | 210 #endif |
| OLD | NEW |