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

Side by Side Diff: src/core/SkRecordDraw.cpp

Issue 617393004: BBHs: void* data -> unsigned data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: The rest Created 6 years, 2 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/core/SkRTree.cpp ('k') | src/core/SkTileGrid.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 2014 Google Inc. 2 * Copyright 2014 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 "SkRecordDraw.h" 8 #include "SkRecordDraw.h"
9 #include "SkPatchUtils.h" 9 #include "SkPatchUtils.h"
10 10
11 void SkRecordDraw(const SkRecord& record, 11 void SkRecordDraw(const SkRecord& record,
12 SkCanvas* canvas, 12 SkCanvas* canvas,
13 const SkBBoxHierarchy* bbh, 13 const SkBBoxHierarchy* bbh,
14 SkDrawPictureCallback* callback) { 14 SkDrawPictureCallback* callback) {
15 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); 15 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
16 16
17 if (bbh) { 17 if (bbh) {
18 // Draw only ops that affect pixels in the canvas's current clip. 18 // Draw only ops that affect pixels in the canvas's current clip.
19 // The SkRecord and BBH were recorded in identity space. This canvas 19 // The SkRecord and BBH were recorded in identity space. This canvas
20 // is not necessarily in that same space. getClipBounds() returns us 20 // is not necessarily in that same space. getClipBounds() returns us
21 // this canvas' clip bounds transformed back into identity space, which 21 // this canvas' clip bounds transformed back into identity space, which
22 // lets us query the BBH. 22 // lets us query the BBH.
23 SkRect query = { 0, 0, 0, 0 }; 23 SkRect query = { 0, 0, 0, 0 };
24 (void)canvas->getClipBounds(&query); 24 (void)canvas->getClipBounds(&query);
25 25
26 SkTDArray<void*> ops; 26 SkTDArray<unsigned> ops;
27 bbh->search(query, &ops); 27 bbh->search(query, &ops);
28 28
29 SkRecords::Draw draw(canvas); 29 SkRecords::Draw draw(canvas);
30 for (int i = 0; i < ops.count(); i++) { 30 for (int i = 0; i < ops.count(); i++) {
31 if (callback && callback->abortDrawing()) { 31 if (callback && callback->abortDrawing()) {
32 return; 32 return;
33 } 33 }
34 record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds belo w. 34 record.visit<void>(ops[i], draw);
35 } 35 }
36 } else { 36 } else {
37 // Draw all ops. 37 // Draw all ops.
38 SkRecords::Draw draw(canvas); 38 SkRecords::Draw draw(canvas);
39 for (unsigned i = 0; i < record.count(); i++) { 39 for (unsigned i = 0; i < record.count(); i++) {
40 if (callback && callback->abortDrawing()) { 40 if (callback && callback->abortDrawing()) {
41 return; 41 return;
42 } 42 }
43 record.visit<void>(i, draw); 43 record.visit<void>(i, draw);
44 } 44 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 this->popSaveBlock(); 149 this->popSaveBlock();
150 } 150 }
151 151
152 // Any control ops not part of any Save/Restore block draw everywhere. 152 // Any control ops not part of any Save/Restore block draw everywhere.
153 while (!fControlIndices.isEmpty()) { 153 while (!fControlIndices.isEmpty()) {
154 this->popControl(largest); 154 this->popControl(largest);
155 } 155 }
156 156
157 // Finally feed all stored bounds into the BBH. They'll be returned in this order. 157 // Finally feed all stored bounds into the BBH. They'll be returned in this order.
158 SkASSERT(bbh); 158 SkASSERT(bbh);
159 for (uintptr_t i = 0; i < record.count(); i++) { 159 for (unsigned i = 0; i < record.count(); i++) {
160 if (!fBounds[i].isEmpty()) { 160 if (!fBounds[i].isEmpty()) {
161 bbh->insert((void*)i, fBounds[i], true/*ok to defer*/); 161 bbh->insert(i, fBounds[i], true/*ok to defer*/);
162 } 162 }
163 } 163 }
164 bbh->flushDeferredInserts(); 164 bbh->flushDeferredInserts();
165 } 165 }
166 166
167 template <typename T> void operator()(const T& op) { 167 template <typename T> void operator()(const T& op) {
168 this->updateCTM(op); 168 this->updateCTM(op);
169 this->updateClipBounds(op); 169 this->updateClipBounds(op);
170 this->trackBounds(op); 170 this->trackBounds(op);
171 } 171 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // Used to track the bounds of Save/Restore blocks and the control ops insid e them. 539 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
540 SkTDArray<SaveBounds> fSaveStack; 540 SkTDArray<SaveBounds> fSaveStack;
541 SkTDArray<unsigned> fControlIndices; 541 SkTDArray<unsigned> fControlIndices;
542 }; 542 };
543 543
544 } // namespace SkRecords 544 } // namespace SkRecords
545 545
546 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 546 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
547 SkRecords::FillBounds(record, bbh); 547 SkRecords::FillBounds(record, bbh);
548 } 548 }
OLDNEW
« no previous file with comments | « src/core/SkRTree.cpp ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698