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

Side by Side Diff: include/effects/SkBlurDrawLooper.h

Issue 155513012: [WIP] Add Context to SkDrawLooper. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comments Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « include/core/SkDrawLooper.h ('k') | include/effects/SkLayerDrawLooper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2008 The Android Open Source Project 2 * Copyright 2008 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef SkBlurDrawLooper_DEFINED 9 #ifndef SkBlurDrawLooper_DEFINED
10 #define SkBlurDrawLooper_DEFINED 10 #define SkBlurDrawLooper_DEFINED
(...skipping 25 matching lines...) Expand all
36 }; 36 };
37 37
38 SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, 38 SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy,
39 uint32_t flags = kNone_BlurFlag); 39 uint32_t flags = kNone_BlurFlag);
40 40
41 // SK_ATTR_DEPRECATED("use sigma version") 41 // SK_ATTR_DEPRECATED("use sigma version")
42 SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color, 42 SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color,
43 uint32_t flags = kNone_BlurFlag); 43 uint32_t flags = kNone_BlurFlag);
44 virtual ~SkBlurDrawLooper(); 44 virtual ~SkBlurDrawLooper();
45 45
46 // overrides from SkDrawLooper 46 virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVERRIDE;
47 virtual void init(SkCanvas*); 47
48 virtual bool next(SkCanvas*, SkPaint* paint); 48 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLoope rContext); }
49 49
50 SK_DEVELOPER_TO_STRING() 50 SK_DEVELOPER_TO_STRING()
51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) 51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
52 52
53 protected: 53 protected:
54 SkBlurDrawLooper(SkReadBuffer&); 54 SkBlurDrawLooper(SkReadBuffer&);
55 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 55 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
56 56
57 private: 57 private:
58 SkMaskFilter* fBlur; 58 SkMaskFilter* fBlur;
59 SkColorFilter* fColorFilter; 59 SkColorFilter* fColorFilter;
60 SkScalar fDx, fDy; 60 SkScalar fDx, fDy;
61 SkColor fBlurColor; 61 SkColor fBlurColor;
62 uint32_t fBlurFlags; 62 uint32_t fBlurFlags;
63 63
64 enum State { 64 enum State {
65 kBeforeEdge, 65 kBeforeEdge,
66 kAfterEdge, 66 kAfterEdge,
67 kDone 67 kDone
68 }; 68 };
69 State fState; 69
70 class BlurDrawLooperContext : public SkDrawLooper::Context {
71 public:
72 explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper);
73
74 virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE;
75
76 private:
77 const SkBlurDrawLooper* fLooper;
78 State fState;
79 };
70 80
71 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags); 81 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);
72 82
73 typedef SkDrawLooper INHERITED; 83 typedef SkDrawLooper INHERITED;
74 }; 84 };
75 85
76 #endif 86 #endif
OLDNEW
« no previous file with comments | « include/core/SkDrawLooper.h ('k') | include/effects/SkLayerDrawLooper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698