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 | 14 |
14 SkBigPicture::SkBigPicture(const SkRect& cull, | 15 SkBigPicture::SkBigPicture(const SkRect& cull, |
15 SkRecord* record, | 16 SkRecord* record, |
16 SnapshotArray* drawablePicts, | 17 SnapshotArray* drawablePicts, |
17 SkBBoxHierarchy* bbh, | 18 SkBBoxHierarchy* bbh, |
18 AccelData* accelData, | 19 AccelData* accelData, |
19 size_t approxBytesUsedBySubPictures) | 20 size_t approxBytesUsedBySubPictures) |
20 : fCullRect(cull) | 21 : fCullRect(cull) |
21 , fApproxBytesUsedBySubPictures(approxBytesUsedBySubPictures) | 22 , fApproxBytesUsedBySubPictures(approxBytesUsedBySubPictures) |
22 , fRecord(record) // Take ownership of caller's ref. | 23 , fRecord(record) // Take ownership of caller's ref. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 75 |
75 int SkBigPicture::drawableCount() const { | 76 int SkBigPicture::drawableCount() const { |
76 return fDrawablePicts ? fDrawablePicts->count() : 0; | 77 return fDrawablePicts ? fDrawablePicts->count() : 0; |
77 } | 78 } |
78 | 79 |
79 SkPicture const* const* SkBigPicture::drawablePicts() const { | 80 SkPicture const* const* SkBigPicture::drawablePicts() const { |
80 return fDrawablePicts ? fDrawablePicts->begin() : nullptr; | 81 return fDrawablePicts ? fDrawablePicts->begin() : nullptr; |
81 } | 82 } |
82 | 83 |
83 SkBigPicture::Analysis::Analysis(const SkRecord& record) { | 84 SkBigPicture::Analysis::Analysis(const SkRecord& record) { |
| 85 TRACE_EVENT0("disabled-by-default-skia", "SkBigPicture::Analysis::Analysis()
"); |
84 SkTextHunter text; | 86 SkTextHunter text; |
85 SkBitmapHunter bitmap; | 87 SkBitmapHunter bitmap; |
86 SkPathCounter path; | 88 SkPathCounter path; |
87 | 89 |
88 bool hasText = false, hasBitmap = false; | 90 bool hasText = false, hasBitmap = false; |
89 for (int i = 0; i < record.count(); i++) { | 91 for (int i = 0; i < record.count(); i++) { |
90 hasText = hasText || record.visit<bool>(i, text); | 92 hasText = hasText || record.visit<bool>(i, text); |
91 hasBitmap = hasBitmap || record.visit<bool>(i, bitmap); | 93 hasBitmap = hasBitmap || record.visit<bool>(i, bitmap); |
92 record.visit<void>(i, path); | 94 record.visit<void>(i, path); |
93 } | 95 } |
94 | 96 |
95 fHasText = hasText; | 97 fHasText = hasText; |
96 fWillPlaybackBitmaps = hasBitmap; | 98 fWillPlaybackBitmaps = hasBitmap; |
97 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects,
255); | 99 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects,
255); |
98 } | 100 } |
OLD | NEW |