From 971aca75572ed6e0c5e1cc959173dc58ca7b6b8d Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 26 Nov 2012 20:26:54 +0000 Subject: change SkDrawFilter::filter to return a bool, where false means don't-draw Review URL: https://codereview.appspot.com/6851111 git-svn-id: http://skia.googlecode.com/svn/trunk@6551 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkDrawFilter.h | 9 ++++++--- include/effects/SkPaintFlagsDrawFilter.h | 3 +-- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/core/SkDrawFilter.h b/include/core/SkDrawFilter.h index 79decefb16..3944257851 100644 --- a/include/core/SkDrawFilter.h +++ b/include/core/SkDrawFilter.h @@ -33,15 +33,18 @@ public: kRect_Type, kPath_Type, kText_Type, + }; - kTypeCount + enum { + kTypeCount = kText_Type + 1 }; /** * Called with the paint that will be used to draw the specified type. - * The implementation may modify the paint as they wish. + * The implementation may modify the paint as they wish. If filter() + * returns false, the draw will be skipped. */ - virtual void filter(SkPaint*, Type) = 0; + virtual bool filter(SkPaint*, Type) = 0; private: typedef SkRefCnt INHERITED; diff --git a/include/effects/SkPaintFlagsDrawFilter.h b/include/effects/SkPaintFlagsDrawFilter.h index fbf1807708..cb2a8b7e95 100644 --- a/include/effects/SkPaintFlagsDrawFilter.h +++ b/include/effects/SkPaintFlagsDrawFilter.h @@ -14,8 +14,7 @@ class SK_API SkPaintFlagsDrawFilter : public SkDrawFilter { public: SkPaintFlagsDrawFilter(uint32_t clearFlags, uint32_t setFlags); - // overrides - virtual void filter(SkPaint*, Type); + virtual bool filter(SkPaint*, Type) SK_OVERRIDE; private: uint16_t fClearFlags; // user specified -- cgit v1.2.3