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" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 stop, | 56 stop, |
57 initialCTM); | 57 initialCTM); |
58 } | 58 } |
59 | 59 |
60 const SkBigPicture::Analysis& SkBigPicture::analysis() const { | 60 const SkBigPicture::Analysis& SkBigPicture::analysis() const { |
61 fAnalysisOnce([this] { fAnalysis.init(*fRecord); }); | 61 fAnalysisOnce([this] { fAnalysis.init(*fRecord); }); |
62 return fAnalysis; | 62 return fAnalysis; |
63 } | 63 } |
64 | 64 |
65 SkRect SkBigPicture::cullRect() const { return fCullRect; } | 65 SkRect SkBigPicture::cullRect() const { return fCullRect; } |
66 bool SkBigPicture::hasText() const { return this->analysis().fHasT
ext; } | |
67 bool SkBigPicture::willPlayBackBitmaps() const { return this->analysis().fWill
PlaybackBitmaps; } | 66 bool SkBigPicture::willPlayBackBitmaps() const { return this->analysis().fWill
PlaybackBitmaps; } |
68 int SkBigPicture::numSlowPaths() const { return this->analysis().fNumSlowPath
sAndDashEffects; } | 67 int SkBigPicture::numSlowPaths() const { return this->analysis().fNumSlowPath
sAndDashEffects; } |
69 int SkBigPicture::approximateOpCount() const { return fRecord->count(); } | 68 int SkBigPicture::approximateOpCount() const { return fRecord->count(); } |
70 size_t SkBigPicture::approximateBytesUsed() const { | 69 size_t SkBigPicture::approximateBytesUsed() const { |
71 size_t bytes = sizeof(*this) + fRecord->bytesUsed() + fApproxBytesUsedBySubP
ictures; | 70 size_t bytes = sizeof(*this) + fRecord->bytesUsed() + fApproxBytesUsedBySubP
ictures; |
72 if (fBBH) { bytes += fBBH->bytesUsed(); } | 71 if (fBBH) { bytes += fBBH->bytesUsed(); } |
73 return bytes; | 72 return bytes; |
74 } | 73 } |
75 | 74 |
76 int SkBigPicture::drawableCount() const { | 75 int SkBigPicture::drawableCount() const { |
77 return fDrawablePicts ? fDrawablePicts->count() : 0; | 76 return fDrawablePicts ? fDrawablePicts->count() : 0; |
78 } | 77 } |
79 | 78 |
80 SkPicture const* const* SkBigPicture::drawablePicts() const { | 79 SkPicture const* const* SkBigPicture::drawablePicts() const { |
81 return fDrawablePicts ? fDrawablePicts->begin() : nullptr; | 80 return fDrawablePicts ? fDrawablePicts->begin() : nullptr; |
82 } | 81 } |
83 | 82 |
84 void SkBigPicture::Analysis::init(const SkRecord& record) { | 83 void SkBigPicture::Analysis::init(const SkRecord& record) { |
85 TRACE_EVENT0("disabled-by-default-skia", "SkBigPicture::Analysis::init()"); | 84 TRACE_EVENT0("disabled-by-default-skia", "SkBigPicture::Analysis::init()"); |
86 SkTextHunter text; | |
87 SkBitmapHunter bitmap; | 85 SkBitmapHunter bitmap; |
88 SkPathCounter path; | 86 SkPathCounter path; |
89 | 87 |
90 bool hasText = false, hasBitmap = false; | 88 bool hasBitmap = false; |
91 for (int i = 0; i < record.count(); i++) { | 89 for (int i = 0; i < record.count(); i++) { |
92 hasText = hasText || record.visit(i, text); | |
93 hasBitmap = hasBitmap || record.visit(i, bitmap); | 90 hasBitmap = hasBitmap || record.visit(i, bitmap); |
94 record.visit(i, path); | 91 record.visit(i, path); |
95 } | 92 } |
96 | 93 |
97 fHasText = hasText; | |
98 fWillPlaybackBitmaps = hasBitmap; | 94 fWillPlaybackBitmaps = hasBitmap; |
99 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects,
255); | 95 fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects,
255); |
100 } | 96 } |
OLD | NEW |