OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkBigPicture.h" | 9 #include "SkBigPicture.h" |
10 #include "SkPictureCommon.h" | 10 #include "SkPictureCommon.h" |
11 #include "SkRecord.h" | 11 #include "SkRecord.h" |
12 #include "SkRecordDraw.h" | 12 #include "SkRecordDraw.h" |
13 #include "SkTraceEvent.h" | 13 #include "SkTraceEvent.h" |
14 | 14 |
15 SkBigPicture::SkBigPicture(const SkRect& cull, | 15 SkBigPicture::SkBigPicture(const SkRect& cull, |
16 SkRecord* record, | 16 SkRecord* record, |
17 SnapshotArray* drawablePicts, | 17 SnapshotArray* drawablePicts, |
18 SkBBoxHierarchy* bbh, | 18 SkBBoxHierarchy* bbh, |
19 AccelData* accelData, | |
20 size_t approxBytesUsedBySubPictures) | 19 size_t approxBytesUsedBySubPictures) |
21 : fCullRect(cull) | 20 : fCullRect(cull) |
22 , fApproxBytesUsedBySubPictures(approxBytesUsedBySubPictures) | 21 , fApproxBytesUsedBySubPictures(approxBytesUsedBySubPictures) |
23 , fRecord(record) // Take ownership of caller's ref. | 22 , fRecord(record) // Take ownership of caller's ref. |
24 , fDrawablePicts(drawablePicts) // Take ownership. | 23 , fDrawablePicts(drawablePicts) // Take ownership. |
25 , fBBH(bbh) // Take ownership of caller's ref. | 24 , fBBH(bbh) // Take ownership of caller's ref. |
26 , fAccelData(accelData) // Take ownership of caller's ref. | |
27 {} | 25 {} |
28 | 26 |
29 void SkBigPicture::playback(SkCanvas* canvas, AbortCallback* callback) const { | 27 void SkBigPicture::playback(SkCanvas* canvas, AbortCallback* callback) const { |
30 SkASSERT(canvas); | 28 SkASSERT(canvas); |
31 | 29 |
32 // If the query contains the whole picture, don't bother with the BBH. | 30 // If the query contains the whole picture, don't bother with the BBH. |
33 SkRect clipBounds = { 0, 0, 0, 0 }; | 31 SkRect clipBounds = { 0, 0, 0, 0 }; |
34 (void)canvas->getClipBounds(&clipBounds); | 32 (void)canvas->getClipBounds(&clipBounds); |
35 const bool useBBH = !clipBounds.contains(this->cullRect()); | 33 const bool useBBH = !clipBounds.contains(this->cullRect()); |
36 | 34 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 85 |
88 bool hasBitmap = false; | 86 bool hasBitmap = false; |
89 for (int i = 0; i < record.count(); i++) { | 87 for (int i = 0; i < record.count(); i++) { |
90 hasBitmap = hasBitmap || record.visit(i, bitmap); | 88 hasBitmap = hasBitmap || record.visit(i, bitmap); |
91 record.visit(i, path); | 89 record.visit(i, path); |
92 } | 90 } |
93 | 91 |
94 fWillPlaybackBitmaps = hasBitmap; | 92 fWillPlaybackBitmaps = hasBitmap; |
95 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects,
255); | 93 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects,
255); |
96 } | 94 } |
OLD | NEW |