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

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

Issue 466503002: SkTileGrid: store insertion order, return results sorted by that. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comments 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 | « dm/DMCpuGMTask.cpp ('k') | src/core/SkTileGrid.h » ('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 SkASSERT(bbh->getCount() == SkToInt(record.count())); 18 SkASSERT(bbh->getCount() == SkToInt(record.count()));
19 19
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 SkIRect devBounds; 21 SkIRect devBounds;
22 canvas->getClipDeviceBounds(&devBounds); 22 canvas->getClipDeviceBounds(&devBounds);
23 SkTDArray<void*> ops; 23 SkTDArray<void*> ops;
24 bbh->search(devBounds, &ops); 24 bbh->search(devBounds, &ops);
25 25
26 // Until we start filling in real bounds, we should get every op back. 26 // Until we start filling in real bounds, we should get every op back.
27 SkASSERT(ops.count() == SkToInt(record.count())); 27 SkASSERT(ops.count() == SkToInt(record.count()));
28 28
29 // FIXME: QuadTree doesn't send these back in the order we inserted them . :( 29 // FIXME: QuadTree doesn't send these back in the order we inserted them . :(
30 // Also remove the sort in SkPictureData::getActiveOps()?
30 if (ops.count() > 0) { 31 if (ops.count() > 0) {
31 SkTQSort(ops.begin(), ops.end() - 1, SkTCompareLT<void*>()); 32 SkTQSort(ops.begin(), ops.end() - 1, SkTCompareLT<void*>());
32 } 33 }
33 34
34 SkRecords::Draw draw(canvas); 35 SkRecords::Draw draw(canvas);
35 for (int i = 0; i < ops.count(); i++) { 36 for (int i = 0; i < ops.count(); i++) {
36 if (NULL != callback && callback->abortDrawing()) { 37 if (NULL != callback && callback->abortDrawing()) {
37 return; 38 return;
38 } 39 }
39 record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds belo w. 40 record.visit<void>((uintptr_t)ops[i], draw); // See FillBounds belo w.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 }; 123 };
123 124
124 } // namespace SkRecords 125 } // namespace SkRecords
125 126
126 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) { 127 void SkRecordFillBounds(const SkRecord& record, SkBBoxHierarchy* bbh) {
127 SkASSERT(NULL != bbh); 128 SkASSERT(NULL != bbh);
128 for(SkRecords::FillBounds fb(bbh); fb.index() < record.count(); fb.next()) { 129 for(SkRecords::FillBounds fb(bbh); fb.index() < record.count(); fb.next()) {
129 record.visit<void>(fb.index(), fb); 130 record.visit<void>(fb.index(), fb);
130 } 131 }
131 } 132 }
OLDNEW
« no previous file with comments | « dm/DMCpuGMTask.cpp ('k') | src/core/SkTileGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698