kHasImage_Tag = 2, // Contains an SkImage or SkBitmap.
kHasText_Tag = 4, // Contains text.
kHasPaint_Tag = 8, // May have an SkPaint field, at least optionally.
+
+ kDrawWithPaint_Tag = kDraw_Tag | kHasPaint_Tag,
};
// A macro to make it a little easier to define a struct that can be stored in SkRecord.
void operator()(const SkRecords::DrawPicture& op) {
fNumSlowPathsAndDashEffects += op.picture->numSlowPaths();
}
- void operator()(const SkRecords::DrawDrawable&) { /* TODO */ }
void checkPaint(const SkPaint* paint) {
if (paint && paint->getPathEffect()) {
}
template <typename T>
- SK_WHEN(T::kTags & SkRecords::kDraw_Tag, void) operator()(const T& op) {
+ SK_WHEN(T::kTags & SkRecords::kHasPaint_Tag, void) operator()(const T& op) {
this->checkPaint(AsPtr(op.paint));
}
template <typename T>
- SK_WHEN(!(T::kTags & SkRecords::kDraw_Tag), void) operator()(const T& op) { /* do nothing */ }
+ SK_WHEN(!(T::kTags & SkRecords::kHasPaint_Tag), void)
+ operator()(const T& op) { /* do nothing */ }
int fNumSlowPathsAndDashEffects;
};
type* get() { return fPaint; }
template <typename T>
- SK_WHEN(T::kTags & kDraw_Tag, bool) operator()(T* draw) {
+ SK_WHEN((T::kTags & kDrawWithPaint_Tag) == kDrawWithPaint_Tag, bool) operator()(T* draw) {
fPaint = AsPtr(draw->paint);
return true;
}
- bool operator()(DrawDrawable*) {
- static_assert(DrawDrawable::kTags & kDraw_Tag, "");
+ template <typename T>
+ SK_WHEN((T::kTags & kDrawWithPaint_Tag) == kDraw_Tag, bool) operator()(T* draw) {
fPaint = nullptr;
return true;
}