OLD | NEW |
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 24 matching lines...) Expand all Loading... |
35 kAll_BlurFlag = 0x07 | 35 kAll_BlurFlag = 0x07 |
36 }; | 36 }; |
37 | 37 |
38 static SkBlurDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx,
SkScalar dy, | 38 static SkBlurDrawLooper* Create(SkColor color, SkScalar sigma, SkScalar dx,
SkScalar dy, |
39 uint32_t flags = kNone_BlurFlag) { | 39 uint32_t flags = kNone_BlurFlag) { |
40 return SkNEW_ARGS(SkBlurDrawLooper, (color, sigma, dx, dy, flags)); | 40 return SkNEW_ARGS(SkBlurDrawLooper, (color, sigma, dx, dy, flags)); |
41 } | 41 } |
42 | 42 |
43 virtual ~SkBlurDrawLooper(); | 43 virtual ~SkBlurDrawLooper(); |
44 | 44 |
45 virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const
SK_OVERRIDE; | 45 SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const SK_OVER
RIDE; |
46 | 46 |
47 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLoope
rContext); } | 47 size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLooperContext
); } |
48 | 48 |
49 SK_TO_STRING_OVERRIDE() | 49 SK_TO_STRING_OVERRIDE() |
50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) | 50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) |
51 | 51 |
52 protected: | 52 protected: |
53 SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, | 53 SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, |
54 uint32_t flags); | 54 uint32_t flags); |
55 | 55 |
56 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 56 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
57 | 57 |
58 virtual bool asABlurShadow(BlurShadowRec*) const SK_OVERRIDE; | 58 bool asABlurShadow(BlurShadowRec*) const SK_OVERRIDE; |
59 | 59 |
60 private: | 60 private: |
61 SkMaskFilter* fBlur; | 61 SkMaskFilter* fBlur; |
62 SkColorFilter* fColorFilter; | 62 SkColorFilter* fColorFilter; |
63 SkScalar fDx, fDy, fSigma; | 63 SkScalar fDx, fDy, fSigma; |
64 SkColor fBlurColor; | 64 SkColor fBlurColor; |
65 uint32_t fBlurFlags; | 65 uint32_t fBlurFlags; |
66 | 66 |
67 enum State { | 67 enum State { |
68 kBeforeEdge, | 68 kBeforeEdge, |
69 kAfterEdge, | 69 kAfterEdge, |
70 kDone | 70 kDone |
71 }; | 71 }; |
72 | 72 |
73 class BlurDrawLooperContext : public SkDrawLooper::Context { | 73 class BlurDrawLooperContext : public SkDrawLooper::Context { |
74 public: | 74 public: |
75 explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper); | 75 explicit BlurDrawLooperContext(const SkBlurDrawLooper* looper); |
76 | 76 |
77 virtual bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE; | 77 bool next(SkCanvas* canvas, SkPaint* paint) SK_OVERRIDE; |
78 | 78 |
79 private: | 79 private: |
80 const SkBlurDrawLooper* fLooper; | 80 const SkBlurDrawLooper* fLooper; |
81 State fState; | 81 State fState; |
82 }; | 82 }; |
83 | 83 |
84 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t
flags); | 84 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t
flags); |
85 void initEffects(); | 85 void initEffects(); |
86 | 86 |
87 typedef SkDrawLooper INHERITED; | 87 typedef SkDrawLooper INHERITED; |
88 }; | 88 }; |
89 | 89 |
90 #endif | 90 #endif |
OLD | NEW |