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

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

Issue 732723004: Make sure pictures draw Clears even when the clip is empty. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Decouple 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 | « no previous file | 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 "SkLayerInfo.h" 8 #include "SkLayerInfo.h"
9 #include "SkRecordDraw.h" 9 #include "SkRecordDraw.h"
10 #include "SkPatchUtils.h" 10 #include "SkPatchUtils.h"
11 11
12 void SkRecordDraw(const SkRecord& record, 12 void SkRecordDraw(const SkRecord& record,
13 SkCanvas* canvas, 13 SkCanvas* canvas,
14 SkPicture const* const drawablePicts[], int drawableCount, 14 SkPicture const* const drawablePicts[], int drawableCount,
15 const SkBBoxHierarchy* bbh, 15 const SkBBoxHierarchy* bbh,
16 SkDrawPictureCallback* callback) { 16 SkDrawPictureCallback* callback) {
17 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/); 17 SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
18 18
19 if (bbh) { 19 if (bbh) {
20 // Draw only ops that affect pixels in the canvas's current clip. 20 // Draw only ops that affect pixels in the canvas's current clip.
21 // The SkRecord and BBH were recorded in identity space. This canvas 21 // The SkRecord and BBH were recorded in identity space. This canvas
22 // is not necessarily in that same space. getClipBounds() returns us 22 // is not necessarily in that same space. getClipBounds() returns us
23 // this canvas' clip bounds transformed back into identity space, which 23 // this canvas' clip bounds transformed back into identity space, which
24 // lets us query the BBH. 24 // lets us query the BBH.
25 SkRect query = { 0, 0, 0, 0 }; 25 SkRect query;
26 (void)canvas->getClipBounds(&query); 26 if (!canvas->getClipBounds(&query)) {
27 // We want to make sure our query rectangle is never totally empty.
28 // Clear ignores the clip, so it must draw even if the clip is logic ally empty.
29 query = SkRect::MakeWH(SK_ScalarNearlyZero, SK_ScalarNearlyZero);
30 }
27 31
28 SkTDArray<unsigned> ops; 32 SkTDArray<unsigned> ops;
29 bbh->search(query, &ops); 33 bbh->search(query, &ops);
30 34
31 SkRecords::Draw draw(canvas, drawablePicts, drawableCount); 35 SkRecords::Draw draw(canvas, drawablePicts, drawableCount);
32 for (int i = 0; i < ops.count(); i++) { 36 for (int i = 0; i < ops.count(); i++) {
33 if (callback && callback->abortDrawing()) { 37 if (callback && callback->abortDrawing()) {
34 return; 38 return;
35 } 39 }
36 // This visit call uses the SkRecords::Draw::operator() to call 40 // This visit call uses the SkRecords::Draw::operator() to call
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 SkRecords::CollectLayers visitor(cullRect, record, data); 758 SkRecords::CollectLayers visitor(cullRect, record, data);
755 759
756 for (unsigned curOp = 0; curOp < record.count(); curOp++) { 760 for (unsigned curOp = 0; curOp < record.count(); curOp++) {
757 visitor.setCurrentOp(curOp); 761 visitor.setCurrentOp(curOp);
758 record.visit<void>(curOp, visitor); 762 record.visit<void>(curOp, visitor);
759 } 763 }
760 764
761 visitor.cleanUp(bbh); 765 visitor.cleanUp(bbh);
762 } 766 }
763 767
OLDNEW
« no previous file with comments | « no previous file | tests/PictureBBHTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698