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

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: guard bounds in SkRecordDraw too 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
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 #if 1 // TODO: Why is this the right way to make the query? I'd think it'd be the else branch.
reed1 2014/08/18 19:42:39 Not sure I follow the comment. Do we want to keep
mtklein 2014/08/18 19:45:24 Yeah, I'd say so, at least until I understand why
reed1 2014/08/18 19:48:54 Ah. Does the comment mean : "why isn't getClipDevi
21 SkRect clipBounds; 21 SkRect clipBounds = { 0, 0, 0, 0 };
22 canvas->getClipBounds(&clipBounds); 22 (void)canvas->getClipBounds(&clipBounds);
23 clipBounds.roundOut(&query); 23 clipBounds.roundOut(&query);
24 #else 24 #else
25 canvas->getClipDeviceBounds(&query); 25 canvas->getClipDeviceBounds(&query);
26 #endif 26 #endif
27 SkTDArray<void*> ops; 27 SkTDArray<void*> ops;
28 bbh->search(query, &ops); 28 bbh->search(query, &ops);
29 29
30 SkRecords::Draw draw(canvas); 30 SkRecords::Draw draw(canvas);
31 for (int i = 0; i < ops.count(); i++) { 31 for (int i = 0; i < ops.count(); i++) {
32 if (NULL != callback && callback->abortDrawing()) { 32 if (NULL != callback && callback->abortDrawing()) {
(...skipping 347 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. 380 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
381 SkTDArray<SaveBounds> fSaveStack; 381 SkTDArray<SaveBounds> fSaveStack;
382 SkTDArray<unsigned> fControlIndices; 382 SkTDArray<unsigned> fControlIndices;
383 }; 383 };
384 384
385 } // namespace SkRecords 385 } // namespace SkRecords
386 386
387 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 387 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
388 SkRecords::FillBounds(record, bbh); 388 SkRecords::FillBounds(record, bbh);
389 } 389 }
OLDNEW
« src/core/SkPicture.cpp ('K') | « src/core/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698