aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkBlurDrawLooper.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-12 09:42:01 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-12 09:42:01 +0000
commit79fbb40bca9d815ef79b896b31ba6ee736817e0f (patch)
treee68a9d73abf9bdbef00d5facf6ca406a395527f7 /include/effects/SkBlurDrawLooper.h
parentad07e69d4cbd4924678f923d744dc01517bd6a78 (diff)
[WIP] Add Context to SkDrawLooper.
SkDrawLooper carries some state during draws. This CL extracts this state into a separate class Context, which is then passed by the users of SkDrawLooper into the appropriate methods. This is a step towards making SkDrawLooper immutable. BUG=skia:2141 R=scroggo@google.com, reed@google.com, sugoi@google.com Author: dominikg@chromium.org Review URL: https://codereview.chromium.org/155513012 git-svn-id: http://skia.googlecode.com/svn/trunk@13760 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects/SkBlurDrawLooper.h')
-rw-r--r--include/effects/SkBlurDrawLooper.h18
1 files changed, 14 insertions, 4 deletions
diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h
index 46b154debc..9a230e59ff 100644
--- a/include/effects/SkBlurDrawLooper.h
+++ b/include/effects/SkBlurDrawLooper.h
@@ -43,9 +43,9 @@ public:
uint32_t flags = kNone_BlurFlag);
virtual ~SkBlurDrawLooper();
- // overrides from SkDrawLooper
- virtual void init(SkCanvas*);
- virtual bool next(SkCanvas*, SkPaint* paint);
+ virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE;
+
+ virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLooperContext); }
SK_DEVELOPER_TO_STRING()
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
@@ -66,7 +66,17 @@ private:
kAfterEdge,
kDone
};
- State fState;
+
+ class BlurDrawLooperContext : public SkDrawLooper::Context {
+ public:
+ explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper);
+
+ virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE;
+
+ private:
+ const SkBlurDrawLooper* fLooper;
+ State fState;
+ };
void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);