OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkPictureFlat.h" | 10 #include "SkPictureFlat.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 PathCounter() | 136 PathCounter() |
137 : numPaintWithPathEffectUses (0) | 137 : numPaintWithPathEffectUses (0) |
138 , numFastPathDashEffects (0) | 138 , numFastPathDashEffects (0) |
139 , numAAConcavePaths (0) | 139 , numAAConcavePaths (0) |
140 , numAAHairlineConcavePaths (0) { | 140 , numAAHairlineConcavePaths (0) { |
141 } | 141 } |
142 | 142 |
143 // Recurse into nested pictures. | 143 // Recurse into nested pictures. |
144 void operator()(const SkRecords::DrawPicture& op) { | 144 void operator()(const SkRecords::DrawPicture& op) { |
145 // If you're not also SkRecord-backed, tough luck. Get on the bandwagon
. | 145 const SkPicture::Analysis& analysis = op.picture->fAnalysis; |
146 if (op.picture->fRecord.get() == NULL) { | 146 numPaintWithPathEffectUses += analysis.fNumPaintWithPathEffectUses; |
147 return; | 147 numFastPathDashEffects += analysis.fNumFastPathDashEffects; |
148 } | 148 numAAConcavePaths += analysis.fNumAAConcavePaths; |
149 const SkRecord& nested = *op.picture->fRecord; | 149 numAAHairlineConcavePaths += analysis.fNumAAHairlineConcavePaths; |
150 for (unsigned i = 0; i < nested.count(); i++) { | |
151 nested.visit<void>(i, *this); | |
152 } | |
153 } | 150 } |
154 | 151 |
155 void checkPaint(const SkPaint* paint) { | 152 void checkPaint(const SkPaint* paint) { |
156 if (paint && paint->getPathEffect()) { | 153 if (paint && paint->getPathEffect()) { |
157 numPaintWithPathEffectUses++; | 154 numPaintWithPathEffectUses++; |
158 } | 155 } |
159 } | 156 } |
160 | 157 |
161 void operator()(const SkRecords::DrawPoints& op) { | 158 void operator()(const SkRecords::DrawPoints& op) { |
162 this->checkPaint(&op.paint); | 159 this->checkPaint(&op.paint); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 int SkPicture::approximateOpCount() const { | 680 int SkPicture::approximateOpCount() const { |
684 SkASSERT(fRecord.get() || fData.get()); | 681 SkASSERT(fRecord.get() || fData.get()); |
685 if (fRecord.get()) { | 682 if (fRecord.get()) { |
686 return fRecord->count(); | 683 return fRecord->count(); |
687 } | 684 } |
688 if (fData.get()) { | 685 if (fData.get()) { |
689 return fData->opCount(); | 686 return fData->opCount(); |
690 } | 687 } |
691 return 0; | 688 return 0; |
692 } | 689 } |
OLD | NEW |