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 #include "SkColor.h" | 8 #include "SkColor.h" |
9 #include "SkImageFilter.h" | 9 #include "SkImageFilter.h" |
10 #include "SkScalar.h" | 10 #include "SkScalar.h" |
11 | 11 |
12 class SK_API SkDropShadowImageFilter : public SkImageFilter { | 12 class SK_API SkDropShadowImageFilter : public SkImageFilter { |
13 public: | 13 public: |
14 enum ShadowMode { | |
15 kDrawShadowAndForeground_ShadowMode, | |
16 kDrawShadowOnly_ShadowMode | |
17 }; | |
18 | |
19 /** @deprecated use other Create function below instead */ | |
14 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, | 20 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, |
15 SkScalar sigmaX, SkScalar sigmaY, SkC olor color, | 21 SkScalar sigmaX, SkScalar sigmaY, SkC olor color, |
16 SkImageFilter* input = NULL, | 22 SkImageFilter* input = NULL, |
17 const CropRect* cropRect = NULL, | 23 const CropRect* cropRect = NULL, |
18 uint32_t uniqueID = 0) { | 24 uint32_t uniqueID = 0) { |
19 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, | 25 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r, |
20 color, input, cropRect, uniq ueID)); | 26 kDrawShadowAndForeground_Sha dowMode, |
27 input, cropRect, uniqueID)); | |
28 } | |
29 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, | |
30 SkScalar sigmaX, SkScalar sigmaY, SkC olor color, | |
31 ShadowMode shadowMode, | |
32 SkImageFilter* input = NULL, | |
reed1
2014/10/23 19:01:53
nit: while we're adding a new entry-point, can we
Stephen White
2014/10/23 19:23:03
The uniqueID param can be removed once the non-SkR
| |
33 const CropRect* cropRect = NULL, | |
34 uint32_t uniqueID = 0) { | |
35 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r, | |
36 shadowMode, input, cropRect, uniqueID)); | |
21 } | 37 } |
22 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; | 38 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; |
23 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) | 39 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) |
24 | 40 |
25 protected: | 41 protected: |
26 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, | 42 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, |
27 SkImageFilter* input, const CropRect* cropRect, uint 32_t uniqueID); | 43 ShadowMode shadowMode, SkImageFilter* input, const C ropRect* cropRect, |
44 uint32_t uniqueID); | |
28 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 45 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
29 explicit SkDropShadowImageFilter(SkReadBuffer&); | 46 explicit SkDropShadowImageFilter(SkReadBuffer&); |
30 #endif | 47 #endif |
31 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 48 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
32 virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, S kBitmap* result, SkIPoint* loc) const SK_OVERRIDE; | 49 virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, S kBitmap* result, SkIPoint* loc) const SK_OVERRIDE; |
33 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, | 50 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, |
34 SkIRect* dst) const SK_OVERRIDE; | 51 SkIRect* dst) const SK_OVERRIDE; |
35 | 52 |
36 private: | 53 private: |
37 SkScalar fDx, fDy, fSigmaX, fSigmaY; | 54 SkScalar fDx, fDy, fSigmaX, fSigmaY; |
38 SkColor fColor; | 55 SkColor fColor; |
56 ShadowMode fShadowMode; | |
39 typedef SkImageFilter INHERITED; | 57 typedef SkImageFilter INHERITED; |
40 }; | 58 }; |
OLD | NEW |