Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Unified Diff: src/core/SkRecordPattern.h

Issue 1360943003: simplify code in SkRecords.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: another SaveLayer Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordPattern.h
diff --git a/src/core/SkRecordPattern.h b/src/core/SkRecordPattern.h
index ecc61b3aaa1cabeab38889fad5989635ce5de74b..d9568b360a97c8925f77802c6a0eef4ef66f9e84 100644
--- a/src/core/SkRecordPattern.h
+++ b/src/core/SkRecordPattern.h
@@ -41,7 +41,6 @@ private:
// Matches any command that draws, and stores its paint.
class IsDraw {
- SK_CREATE_MEMBER_DETECTOR(paint);
public:
IsDraw() : fPaint(nullptr) {}
@@ -49,19 +48,19 @@ public:
type* get() { return fPaint; }
template <typename T>
- SK_WHEN(HasMember_paint<T>, bool) operator()(T* draw) {
+ SK_WHEN(T::kTags & kDraw_Tag, bool) operator()(T* draw) {
fPaint = AsPtr(draw->paint);
return true;
}
- template <typename T>
- SK_WHEN(!HasMember_paint<T>, bool) operator()(T*) {
+ bool operator()(DrawDrawable*) {
+ static_assert(DrawDrawable::kTags & kDraw_Tag, "");
fPaint = nullptr;
- return false;
+ return true;
}
- // SaveLayer has an SkPaint named paint, but it's not a draw.
- bool operator()(SaveLayer*) {
+ template <typename T>
+ SK_WHEN(!(T::kTags & kDraw_Tag), bool) operator()(T* draw) {
fPaint = nullptr;
return false;
}
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698