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

Side by Side Diff: src/gpu/GrAuditTrail.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrAutoLocaleSetter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "GrAuditTrail.h" 8 #include "GrAuditTrail.h"
9 #include "batches/GrBatch.h" 9 #include "batches/GrBatch.h"
10 10
11 const int GrAuditTrail::kGrAuditTrailInvalidID = -1; 11 const int GrAuditTrail::kGrAuditTrailInvalidID = -1;
12 12
13 void GrAuditTrail::addBatch(const GrBatch* batch) { 13 void GrAuditTrail::addBatch(const GrBatch* batch) {
14 SkASSERT(fEnabled); 14 SkASSERT(fEnabled);
15 Batch* auditBatch = new Batch; 15 Batch* auditBatch = new Batch;
16 fBatchPool.emplace_back(auditBatch); 16 fBatchPool.emplace_back(auditBatch);
17 auditBatch->fName = batch->name(); 17 auditBatch->fName = batch->name();
18 auditBatch->fBounds = batch->bounds(); 18 auditBatch->fBounds = batch->bounds();
19 auditBatch->fClientID = kGrAuditTrailInvalidID; 19 auditBatch->fClientID = kGrAuditTrailInvalidID;
20 auditBatch->fBatchListID = kGrAuditTrailInvalidID; 20 auditBatch->fBatchListID = kGrAuditTrailInvalidID;
21 auditBatch->fChildID = kGrAuditTrailInvalidID; 21 auditBatch->fChildID = kGrAuditTrailInvalidID;
22 22
23 // consume the current stack trace if any 23 // consume the current stack trace if any
24 auditBatch->fStackTrace = fCurrentStackTrace; 24 auditBatch->fStackTrace = fCurrentStackTrace;
25 fCurrentStackTrace.reset(); 25 fCurrentStackTrace.reset();
26 26
27 if (fClientID != kGrAuditTrailInvalidID) { 27 if (fClientID != kGrAuditTrailInvalidID) {
28 auditBatch->fClientID = fClientID; 28 auditBatch->fClientID = fClientID;
29 Batches** batchesLookup = fClientIDLookup.find(fClientID); 29 Batches** batchesLookup = fClientIDLookup.find(fClientID);
30 Batches* batches = nullptr; 30 Batches* batches = nullptr;
31 if (!batchesLookup) { 31 if (!batchesLookup) {
32 batches = new Batches; 32 batches = new Batches;
33 fClientIDLookup.set(fClientID, batches); 33 fClientIDLookup.set(fClientID, batches);
34 } else { 34 } else {
35 batches = *batchesLookup; 35 batches = *batchesLookup;
36 } 36 }
(...skipping 26 matching lines...) Expand all
63 // Look up the batch which will be glommed 63 // Look up the batch which will be glommed
64 int* consumedPtr = fIDLookup.find(consumed->uniqueID()); 64 int* consumedPtr = fIDLookup.find(consumed->uniqueID());
65 SkASSERT(consumedPtr); 65 SkASSERT(consumedPtr);
66 int consumedIndex = *consumedPtr; 66 int consumedIndex = *consumedPtr;
67 SkASSERT(consumedIndex < fBatchList.count() && fBatchList[consumedIndex]); 67 SkASSERT(consumedIndex < fBatchList.count() && fBatchList[consumedIndex]);
68 BatchNode& consumedBatch = *fBatchList[consumedIndex]; 68 BatchNode& consumedBatch = *fBatchList[consumedIndex];
69 69
70 // steal all of consumed's batches 70 // steal all of consumed's batches
71 for (int i = 0; i < consumedBatch.fChildren.count(); i++) { 71 for (int i = 0; i < consumedBatch.fChildren.count(); i++) {
72 Batch* childBatch = consumedBatch.fChildren[i]; 72 Batch* childBatch = consumedBatch.fChildren[i];
73 73
74 // set the ids for the child batch 74 // set the ids for the child batch
75 childBatch->fBatchListID = index; 75 childBatch->fBatchListID = index;
76 childBatch->fChildID = consumerBatch.fChildren.count(); 76 childBatch->fChildID = consumerBatch.fChildren.count();
77 consumerBatch.fChildren.push_back(childBatch); 77 consumerBatch.fChildren.push_back(childBatch);
78 } 78 }
79 79
80 // Update the bounds for the combineWith node 80 // Update the bounds for the combineWith node
81 consumerBatch.fBounds = consumer->bounds(); 81 consumerBatch.fBounds = consumer->bounds();
82 82
83 // remove the old node from our batchlist and clear the combinee's lookup 83 // remove the old node from our batchlist and clear the combinee's lookup
84 // NOTE: because we can't change the shape of the batchlist, we use a sentin el 84 // NOTE: because we can't change the shape of the batchlist, we use a sentin el
85 fBatchList[consumedIndex].reset(nullptr); 85 fBatchList[consumedIndex].reset(nullptr);
86 fIDLookup.remove(consumed->uniqueID()); 86 fIDLookup.remove(consumed->uniqueID());
87 } 87 }
88 88
89 void GrAuditTrail::copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID ) { 89 void GrAuditTrail::copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID ) {
(...skipping 19 matching lines...) Expand all
109 int currentBatchListID = kGrAuditTrailInvalidID; 109 int currentBatchListID = kGrAuditTrailInvalidID;
110 for (int i = 0; i < (*batchesLookup)->count(); i++) { 110 for (int i = 0; i < (*batchesLookup)->count(); i++) {
111 const Batch* batch = (**batchesLookup)[i]; 111 const Batch* batch = (**batchesLookup)[i];
112 112
113 // Because we will copy out all of the batches associated with a giv en 113 // Because we will copy out all of the batches associated with a giv en
114 // batch list id everytime the id changes, we only have to update ou r struct 114 // batch list id everytime the id changes, we only have to update ou r struct
115 // when the id changes. 115 // when the id changes.
116 if (kGrAuditTrailInvalidID == currentBatchListID || 116 if (kGrAuditTrailInvalidID == currentBatchListID ||
117 batch->fBatchListID != currentBatchListID) { 117 batch->fBatchListID != currentBatchListID) {
118 BatchInfo& outBatchInfo = outInfo->push_back(); 118 BatchInfo& outBatchInfo = outInfo->push_back();
119 119
120 // copy out all of the batches so the client can display them ev en if 120 // copy out all of the batches so the client can display them ev en if
121 // they have a different clientID 121 // they have a different clientID
122 this->copyOutFromBatchList(&outBatchInfo, batch->fBatchListID); 122 this->copyOutFromBatchList(&outBatchInfo, batch->fBatchListID);
123 } 123 }
124 } 124 }
125 } 125 }
126 } 126 }
127 127
128 void GrAuditTrail::getBoundsByBatchListID(BatchInfo* outInfo, int batchListID) { 128 void GrAuditTrail::getBoundsByBatchListID(BatchInfo* outInfo, int batchListID) {
129 this->copyOutFromBatchList(outInfo, batchListID); 129 this->copyOutFromBatchList(outInfo, batchListID);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 289
290 SkString GrAuditTrail::BatchNode::toJson() const { 290 SkString GrAuditTrail::BatchNode::toJson() const {
291 SkString json; 291 SkString json;
292 json.append("{"); 292 json.append("{");
293 json.appendf("\"RenderTarget\": \"%u\",", fRenderTargetUniqueID); 293 json.appendf("\"RenderTarget\": \"%u\",", fRenderTargetUniqueID);
294 skrect_to_json(&json, "Bounds", fBounds); 294 skrect_to_json(&json, "Bounds", fBounds);
295 JsonifyTArray(&json, "Batches", fChildren, true); 295 JsonifyTArray(&json, "Batches", fChildren, true);
296 json.append("}"); 296 json.append("}");
297 return json; 297 return json;
298 } 298 }
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp ('k') | src/gpu/GrAutoLocaleSetter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698