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 17 matching lines...) Expand all Loading... |
28 The blur layer's dx/dy/radius aren't affected by the canvas | 28 The blur layer's dx/dy/radius aren't affected by the canvas |
29 transform. | 29 transform. |
30 */ | 30 */ |
31 kIgnoreTransform_BlurFlag = 0x01, | 31 kIgnoreTransform_BlurFlag = 0x01, |
32 kOverrideColor_BlurFlag = 0x02, | 32 kOverrideColor_BlurFlag = 0x02, |
33 kHighQuality_BlurFlag = 0x04, | 33 kHighQuality_BlurFlag = 0x04, |
34 /** mask for all blur flags */ | 34 /** mask for all blur flags */ |
35 kAll_BlurFlag = 0x07 | 35 kAll_BlurFlag = 0x07 |
36 }; | 36 }; |
37 | 37 |
38 SkBlurDrawLooper(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)); |
| 41 } |
40 | 42 |
41 // SK_ATTR_DEPRECATED("use sigma version") | 43 #ifdef SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS |
42 SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color, | 44 SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color, |
43 uint32_t flags = kNone_BlurFlag); | 45 uint32_t flags = kNone_BlurFlag); |
| 46 #endif |
| 47 |
44 virtual ~SkBlurDrawLooper(); | 48 virtual ~SkBlurDrawLooper(); |
45 | 49 |
46 virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const
SK_OVERRIDE; | 50 virtual SkDrawLooper::Context* createContext(SkCanvas*, void* storage) const
SK_OVERRIDE; |
47 | 51 |
48 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLoope
rContext); } | 52 virtual size_t contextSize() const SK_OVERRIDE { return sizeof(BlurDrawLoope
rContext); } |
49 | 53 |
50 SK_TO_STRING_OVERRIDE() | 54 SK_TO_STRING_OVERRIDE() |
51 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) | 55 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBlurDrawLooper) |
52 | 56 |
53 protected: | 57 protected: |
| 58 SkBlurDrawLooper(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy, |
| 59 uint32_t flags); |
| 60 |
54 SkBlurDrawLooper(SkReadBuffer&); | 61 SkBlurDrawLooper(SkReadBuffer&); |
55 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 62 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
56 | 63 |
57 private: | 64 private: |
58 SkMaskFilter* fBlur; | 65 SkMaskFilter* fBlur; |
59 SkColorFilter* fColorFilter; | 66 SkColorFilter* fColorFilter; |
60 SkScalar fDx, fDy; | 67 SkScalar fDx, fDy; |
61 SkColor fBlurColor; | 68 SkColor fBlurColor; |
62 uint32_t fBlurFlags; | 69 uint32_t fBlurFlags; |
63 | 70 |
(...skipping 13 matching lines...) Expand all Loading... |
77 const SkBlurDrawLooper* fLooper; | 84 const SkBlurDrawLooper* fLooper; |
78 State fState; | 85 State fState; |
79 }; | 86 }; |
80 | 87 |
81 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t
flags); | 88 void init(SkScalar sigma, SkScalar dx, SkScalar dy, SkColor color, uint32_t
flags); |
82 | 89 |
83 typedef SkDrawLooper INHERITED; | 90 typedef SkDrawLooper INHERITED; |
84 }; | 91 }; |
85 | 92 |
86 #endif | 93 #endif |
OLD | NEW |