OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 #ifndef SkDropShadowImageFilter_DEFINED |
| 9 #define SkDropShadowImageFilter_DEFINED |
| 10 |
8 #include "SkColor.h" | 11 #include "SkColor.h" |
9 #include "SkImageFilter.h" | 12 #include "SkImageFilter.h" |
10 #include "SkScalar.h" | 13 #include "SkScalar.h" |
11 | 14 |
12 class SK_API SkDropShadowImageFilter : public SkImageFilter { | 15 class SK_API SkDropShadowImageFilter : public SkImageFilter { |
13 public: | 16 public: |
14 enum ShadowMode { | 17 enum ShadowMode { |
15 kDrawShadowAndForeground_ShadowMode, | 18 kDrawShadowAndForeground_ShadowMode, |
16 kDrawShadowOnly_ShadowMode, | 19 kDrawShadowOnly_ShadowMode, |
17 | 20 |
18 kLast_ShadowMode = kDrawShadowOnly_ShadowMode | 21 kLast_ShadowMode = kDrawShadowOnly_ShadowMode |
19 }; | 22 }; |
20 | 23 |
21 static const int kShadowModeCount = kLast_ShadowMode+1; | 24 static const int kShadowModeCount = kLast_ShadowMode+1; |
22 | 25 |
23 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkSc
alar sigmaY, | 26 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkSc
alar sigmaY, |
24 SkColor color, ShadowMode shadowMode, SkImageFi
lter* input = NULL, | 27 SkColor color, ShadowMode shadowMode, SkImageFi
lter* input = NULL, |
25 const CropRect* cropRect = NULL) { | 28 const CropRect* cropRect = NULL) { |
26 return new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, color, shadow
Mode, input, | 29 return new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, color, shadow
Mode, input, |
27 cropRect); | 30 cropRect); |
28 } | 31 } |
29 | 32 |
30 SkRect computeFastBounds(const SkRect&) const override; | 33 SkRect computeFastBounds(const SkRect&) const override; |
31 SK_TO_STRING_OVERRIDE() | 34 SK_TO_STRING_OVERRIDE() |
32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) | 35 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) |
33 | 36 |
34 protected: | 37 protected: |
35 void flatten(SkWriteBuffer&) const override; | 38 void flatten(SkWriteBuffer&) const override; |
36 bool onFilterImageDeprecated(Proxy*, const SkBitmap& source, const Context&,
SkBitmap* result, | 39 SkSpecialImage* onFilterImage(SkSpecialImage* source, const Context&, |
37 SkIPoint* loc) const override; | 40 SkIPoint* offset) const override; |
38 SkIRect onFilterNodeBounds(const SkIRect& src, const SkMatrix&, MapDirection
) const override; | 41 SkIRect onFilterNodeBounds(const SkIRect& src, const SkMatrix&, MapDirection
) const override; |
39 | 42 |
40 private: | 43 private: |
41 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar
sigmaY, SkColor, | 44 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar
sigmaY, SkColor, |
42 ShadowMode shadowMode, SkImageFilter* input, const C
ropRect* cropRect); | 45 ShadowMode shadowMode, SkImageFilter* input, const C
ropRect* cropRect); |
43 | 46 |
44 SkScalar fDx, fDy, fSigmaX, fSigmaY; | 47 SkScalar fDx, fDy, fSigmaX, fSigmaY; |
45 SkColor fColor; | 48 SkColor fColor; |
46 ShadowMode fShadowMode; | 49 ShadowMode fShadowMode; |
47 | 50 |
48 typedef SkImageFilter INHERITED; | 51 typedef SkImageFilter INHERITED; |
49 }; | 52 }; |
| 53 |
| 54 #endif |
OLD | NEW |