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

Unified Diff: src/gpu/GrAuditTrail.cpp

Issue 1745063002: Render batch bounds as stroke rects (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: tweaks Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/private/GrAuditTrail.h ('k') | tools/debugger/SkDebugCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAuditTrail.cpp
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index 4b90ea524f89456f7e13d83746c28315d903701b..f17ada48819453c7d7173cb2358ac11f0424c657 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -40,6 +40,40 @@ void GrAuditTrail::batchingResultNew(GrBatch* batch) {
fBatchList.emplace_back(batchNode);
}
+void GrAuditTrail::getBoundsByClientID(SkTArray<BatchInfo>* outInfo, int clientID) {
+ Batches** batchesLookup = fClientIDLookup.find(clientID);
+ if (batchesLookup) {
+ // We track which batchlistID we're currently looking at. If it changes, then we
+ // need to push back a new batch info struct. We happen to know that batches are
+ // in sequential order in the batchlist, otherwise we'd have to do more bookkeeping
+ int currentBatchListID = kGrAuditTrailInvalidID;
+ for (int i = 0; i < (*batchesLookup)->count(); i++) {
+ const Batch* batch = (**batchesLookup)[i];
+
+ // Because we will copy out all of the batches associated with a given
+ // batch list id everytime the id changes, we only have to update our struct
+ // when the id changes.
+ if (kGrAuditTrailInvalidID == currentBatchListID ||
+ batch->fBatchListID != currentBatchListID) {
+ BatchInfo& outBatchInfo = outInfo->push_back();
+ currentBatchListID = batch->fBatchListID;
+
+ // copy out all of the batches so the client can display them even if
+ // they have a different clientID
+ const BatchNode* bn = fBatchList[currentBatchListID];
+ outBatchInfo.fBounds = bn->fBounds;
+ for (int j = 0; j < bn->fChildren.count(); j++) {
+ BatchInfo::Batch& outBatch = outBatchInfo.fBatches.push_back();
+ const Batch* currentBatch = bn->fChildren[j];
+ outBatch.fBounds = currentBatch->fBounds;
+ outBatch.fClientID = currentBatch->fClientID;
+ }
+ }
+ }
+ }
+}
+
+
template <typename T>
void GrAuditTrail::JsonifyTArray(SkString* json, const char* name, const T& array,
bool addComma) {
« no previous file with comments | « include/private/GrAuditTrail.h ('k') | tools/debugger/SkDebugCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698