check for no_paint and remove some drawdrawable special-casing
Bug: skia: Change-Id: I824980a47ddd7c8c7627dabb5efd40f8f0889b67 Reviewed-on: https://skia-review.googlesource.com/16900 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
4c9b893953
commit
74564b40bc
@ -159,6 +159,8 @@ enum Tags {
|
|||||||
kHasImage_Tag = 2, // Contains an SkImage or SkBitmap.
|
kHasImage_Tag = 2, // Contains an SkImage or SkBitmap.
|
||||||
kHasText_Tag = 4, // Contains text.
|
kHasText_Tag = 4, // Contains text.
|
||||||
kHasPaint_Tag = 8, // May have an SkPaint field, at least optionally.
|
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.
|
// A macro to make it a little easier to define a struct that can be stored in SkRecord.
|
||||||
|
@ -81,7 +81,6 @@ struct SkPathCounter {
|
|||||||
void operator()(const SkRecords::DrawPicture& op) {
|
void operator()(const SkRecords::DrawPicture& op) {
|
||||||
fNumSlowPathsAndDashEffects += op.picture->numSlowPaths();
|
fNumSlowPathsAndDashEffects += op.picture->numSlowPaths();
|
||||||
}
|
}
|
||||||
void operator()(const SkRecords::DrawDrawable&) { /* TODO */ }
|
|
||||||
|
|
||||||
void checkPaint(const SkPaint* paint) {
|
void checkPaint(const SkPaint* paint) {
|
||||||
if (paint && paint->getPathEffect()) {
|
if (paint && paint->getPathEffect()) {
|
||||||
@ -132,12 +131,13 @@ struct SkPathCounter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
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));
|
this->checkPaint(AsPtr(op.paint));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
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;
|
int fNumSlowPathsAndDashEffects;
|
||||||
};
|
};
|
||||||
|
@ -49,13 +49,13 @@ public:
|
|||||||
type* get() { return fPaint; }
|
type* get() { return fPaint; }
|
||||||
|
|
||||||
template <typename T>
|
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);
|
fPaint = AsPtr(draw->paint);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator()(DrawDrawable*) {
|
template <typename T>
|
||||||
static_assert(DrawDrawable::kTags & kDraw_Tag, "");
|
SK_WHEN((T::kTags & kDrawWithPaint_Tag) == kDraw_Tag, bool) operator()(T* draw) {
|
||||||
fPaint = nullptr;
|
fPaint = nullptr;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user