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

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

Issue 485703002: Counterproposal for skirting the BBH when the query fully contains the picture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: explain Created 6 years, 4 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/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('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 "SkTSort.h" 9 #include "SkTSort.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 (NULL != bbh) { 17 if (NULL != 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 SkIRect query; 19 SkIRect query;
20 #if 1 // TODO: Why is this the right way to make the query? I'd think it'd be the else branch. 20
21 SkRect clipBounds; 21 // The SkRecord and BBH were recorded in identity space. This canvas
22 canvas->getClipBounds(&clipBounds); 22 // is not necessarily in that same space. getClipBounds() returns us
23 // this canvas' clip bounds transformed back into identity space, which
24 // lets us query the BBH.
25 SkRect clipBounds = { 0, 0, 0, 0 };
26 (void)canvas->getClipBounds(&clipBounds);
23 clipBounds.roundOut(&query); 27 clipBounds.roundOut(&query);
24 #else 28
25 canvas->getClipDeviceBounds(&query);
26 #endif
27 SkTDArray<void*> ops; 29 SkTDArray<void*> ops;
28 bbh->search(query, &ops); 30 bbh->search(query, &ops);
29 31
30 SkRecords::Draw draw(canvas); 32 SkRecords::Draw draw(canvas);
31 for (int i = 0; i < ops.count(); i++) { 33 for (int i = 0; i < ops.count(); i++) {
32 if (NULL != callback && callback->abortDrawing()) { 34 if (NULL != callback && callback->abortDrawing()) {
33 return; 35 return;
34 } 36 }
35 record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds belo w. 37 record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds belo w.
36 } 38 }
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 // Used to track the bounds of Save/Restore blocks and the control ops insid e them. 382 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
381 SkTDArray<SaveBounds> fSaveStack; 383 SkTDArray<SaveBounds> fSaveStack;
382 SkTDArray<unsigned> fControlIndices; 384 SkTDArray<unsigned> fControlIndices;
383 }; 385 };
384 386
385 } // namespace SkRecords 387 } // namespace SkRecords
386 388
387 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 389 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
388 SkRecords::FillBounds(record, bbh); 390 SkRecords::FillBounds(record, bbh);
389 } 391 }
OLDNEW
« no previous file with comments | « src/core/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698