OLD | NEW |
---|---|
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 Loading... | |
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 } |
OLD | NEW |