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 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar si
gma, | |
15 SkColor color, SkImageFilter* input =
NULL) { | |
16 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigma, color, input)
); | |
17 } | |
18 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, | 14 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, |
19 SkScalar sigmaX, SkScalar sigmaY, SkC
olor color, | 15 SkScalar sigmaX, SkScalar sigmaY, SkC
olor color, |
20 SkImageFilter* input = NULL, | 16 SkImageFilter* input = NULL, |
21 const CropRect* cropRect = NULL) { | 17 const CropRect* cropRect = NULL) { |
22 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, | 18 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, |
23 color, input, cropRect)); | 19 color, input, cropRect)); |
24 } | 20 } |
25 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; | 21 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; |
26 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) | 22 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) |
27 | 23 |
28 protected: | 24 protected: |
29 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigma, SkColor, | |
30 SkImageFilter* input); | |
31 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar
sigmaY, SkColor, | 25 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar
sigmaY, SkColor, |
32 SkImageFilter* input, const CropRect* cropRect); | 26 SkImageFilter* input, const CropRect* cropRect); |
33 explicit SkDropShadowImageFilter(SkReadBuffer&); | 27 explicit SkDropShadowImageFilter(SkReadBuffer&); |
34 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 28 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
35 virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, S
kBitmap* result, SkIPoint* loc) const SK_OVERRIDE; | 29 virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, S
kBitmap* result, SkIPoint* loc) const SK_OVERRIDE; |
36 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, | 30 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, |
37 SkIRect* dst) const SK_OVERRIDE; | 31 SkIRect* dst) const SK_OVERRIDE; |
38 | 32 |
39 private: | 33 private: |
40 SkScalar fDx, fDy, fSigmaX, fSigmaY; | 34 SkScalar fDx, fDy, fSigmaX, fSigmaY; |
41 SkColor fColor; | 35 SkColor fColor; |
42 typedef SkImageFilter INHERITED; | 36 typedef SkImageFilter INHERITED; |
43 }; | 37 }; |
OLD | NEW |