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

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

Issue 678303004: Make RTree handle the case where the playback canvas has empty clip bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: moar build fix Created 6 years, 1 month 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 | « gyp/tests.gypi ('k') | tests/PictureBBHTest.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 "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;
24 (void)canvas->getClipBounds(&query); 24 if (!canvas->getClipBounds(&query)) {
25 return;
26 }
25 27
26 SkTDArray<unsigned> ops; 28 SkTDArray<unsigned> ops;
27 bbh->search(query, &ops); 29 bbh->search(query, &ops);
28 30
29 SkRecords::Draw draw(canvas); 31 SkRecords::Draw draw(canvas);
30 for (int i = 0; i < ops.count(); i++) { 32 for (int i = 0; i < ops.count(); i++) {
31 if (callback && callback->abortDrawing()) { 33 if (callback && callback->abortDrawing()) {
32 return; 34 return;
33 } 35 }
34 record.visit<void>(ops[i], draw); 36 record.visit<void>(ops[i], draw);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // Used to track the bounds of Save/Restore blocks and the control ops insid e them. 550 // Used to track the bounds of Save/Restore blocks and the control ops insid e them.
549 SkTDArray<SaveBounds> fSaveStack; 551 SkTDArray<SaveBounds> fSaveStack;
550 SkTDArray<unsigned> fControlIndices; 552 SkTDArray<unsigned> fControlIndices;
551 }; 553 };
552 554
553 } // namespace SkRecords 555 } // namespace SkRecords
554 556
555 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 557 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
556 SkRecords::FillBounds(record, bbh); 558 SkRecords::FillBounds(record, bbh);
557 } 559 }
OLDNEW
« no previous file with comments | « gyp/tests.gypi ('k') | tests/PictureBBHTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698