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

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: Add comments. Created 6 years, 10 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
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::DrawContext* init(
47 virtual void init(SkCanvas*); 47 SkCanvas*, void* storage, size_t storageSize) const SK_OVERRIDE;
48 virtual bool next(SkCanvas*, SkPaint* paint);
49 48
50 SK_DEVELOPER_TO_STRING() 49 SK_DEVELOPER_TO_STRING()
51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) 50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper)
52 51
53 protected: 52 protected:
54 SkBlurDrawLooper(SkReadBuffer&); 53 SkBlurDrawLooper(SkReadBuffer&);
55 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 54 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
56 55
57 private: 56 private:
58 SkMaskFilter* fBlur; 57 SkMaskFilter* fBlur;
59 SkColorFilter* fColorFilter; 58 SkColorFilter* fColorFilter;
60 SkScalar fDx, fDy; 59 SkScalar fDx, fDy;
61 SkColor fBlurColor; 60 SkColor fBlurColor;
62 uint32_t fBlurFlags; 61 uint32_t fBlurFlags;
63 62
64 enum State { 63 enum State {
65 kBeforeEdge, 64 kBeforeEdge,
66 kAfterEdge, 65 kAfterEdge,
67 kDone 66 kDone
68 }; 67 };
69 State fState; 68
69 class BlurDrawLooperContext : public SkDrawLooper::DrawContext {
70 public:
71 explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper);
72
73 virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE;
74
75 private:
76 const SkBlurDrawLooper* fLooper;
77 State fState;
78 };
70 79
71 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags); 80 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t flags);
72 81
73 typedef SkDrawLooper INHERITED; 82 typedef SkDrawLooper INHERITED;
74 }; 83 };
75 84
76 #endif 85 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698