| 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 // Some shared code used by both SkBigPicture and SkMiniPicture. | 8 // Some shared code used by both SkBigPicture and SkMiniPicture. |
| 9 // SkTextHunter -- SkRecord visitor that returns true when the op draws text
. | 9 // SkTextHunter -- SkRecord visitor that returns true when the op draws text
. |
| 10 // SkBitmapHunter -- SkRecord visitor that returns true when the op draws a bi
tmap or image. | 10 // SkBitmapHunter -- SkRecord visitor that returns true when the op draws a bi
tmap or image. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void operator()(const SkRecords::DrawPicture& op) { | 84 void operator()(const SkRecords::DrawPicture& op) { |
| 85 fNumSlowPathsAndDashEffects += op.picture->numSlowPaths(); | 85 fNumSlowPathsAndDashEffects += op.picture->numSlowPaths(); |
| 86 } | 86 } |
| 87 void operator()(const SkRecords::DrawDrawable&) { /* TODO */ } | 87 void operator()(const SkRecords::DrawDrawable&) { /* TODO */ } |
| 88 | 88 |
| 89 void checkPaint(const SkPaint* paint) { | 89 void checkPaint(const SkPaint* paint) { |
| 90 if (paint && paint->getPathEffect()) { | 90 if (paint && paint->getPathEffect()) { |
| 91 // Initially assume it's slow. | 91 // Initially assume it's slow. |
| 92 fNumSlowPathsAndDashEffects++; | 92 fNumSlowPathsAndDashEffects++; |
| 93 } | 93 } |
| 94 if (paint && paint->getImageFilter()) { |
| 95 fNumSlowPathsAndDashEffects += paint->getImageFilter()->numSlowPaths
(); |
| 96 } |
| 94 } | 97 } |
| 95 | 98 |
| 96 void operator()(const SkRecords::DrawPoints& op) { | 99 void operator()(const SkRecords::DrawPoints& op) { |
| 97 this->checkPaint(&op.paint); | 100 this->checkPaint(&op.paint); |
| 98 const SkPathEffect* effect = op.paint.getPathEffect(); | 101 const SkPathEffect* effect = op.paint.getPathEffect(); |
| 99 if (effect) { | 102 if (effect) { |
| 100 SkPathEffect::DashInfo info; | 103 SkPathEffect::DashInfo info; |
| 101 SkPathEffect::DashType dashType = effect->asADash(&info); | 104 SkPathEffect::DashType dashType = effect->asADash(&info); |
| 102 if (2 == op.count && SkPaint::kRound_Cap != op.paint.getStrokeCap()
&& | 105 if (2 == op.count && SkPaint::kRound_Cap != op.paint.getStrokeCap()
&& |
| 103 SkPathEffect::kDash_DashType == dashType && 2 == info.fCount) { | 106 SkPathEffect::kDash_DashType == dashType && 2 == info.fCount) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 template <typename T> | 140 template <typename T> |
| 138 SK_WHEN(T::kTags & SkRecords::kDraw_Tag, void) operator()(const T& op) { | 141 SK_WHEN(T::kTags & SkRecords::kDraw_Tag, void) operator()(const T& op) { |
| 139 this->checkPaint(AsPtr(op.paint)); | 142 this->checkPaint(AsPtr(op.paint)); |
| 140 } | 143 } |
| 141 | 144 |
| 142 template <typename T> | 145 template <typename T> |
| 143 SK_WHEN(!(T::kTags & SkRecords::kDraw_Tag), void) operator()(const T& op) {
/* do nothing */ } | 146 SK_WHEN(!(T::kTags & SkRecords::kDraw_Tag), void) operator()(const T& op) {
/* do nothing */ } |
| 144 | 147 |
| 145 int fNumSlowPathsAndDashEffects; | 148 int fNumSlowPathsAndDashEffects; |
| 146 }; | 149 }; |
| OLD | NEW |