OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 SkMorphologyImageFilter_DEFINED | 9 #ifndef SkMorphologyImageFilter_DEFINED |
10 #define SkMorphologyImageFilter_DEFINED | 10 #define SkMorphologyImageFilter_DEFINED |
11 | 11 |
12 #include "SkImageFilter.h" | 12 #include "SkImageFilter.h" |
13 #include "SkSize.h" | 13 #include "SkSize.h" |
14 | 14 |
15 class SK_API SkMorphologyImageFilter : public SkImageFilter { | 15 class SK_API SkMorphologyImageFilter : public SkImageFilter { |
16 public: | 16 public: |
17 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input); | 17 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, cons
t SkIRect* cropRect); |
18 | 18 |
19 protected: | 19 protected: |
20 SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer); | 20 SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer); |
21 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 21 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
22 #if SK_SUPPORT_GPU | 22 #if SK_SUPPORT_GPU |
23 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } | 23 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } |
24 #endif | 24 #endif |
25 | 25 |
26 SkISize radius() const { return fRadius; } | 26 SkISize radius() const { return fRadius; } |
27 | 27 |
28 private: | 28 private: |
29 SkISize fRadius; | 29 SkISize fRadius; |
30 typedef SkImageFilter INHERITED; | 30 typedef SkImageFilter INHERITED; |
31 }; | 31 }; |
32 | 32 |
33 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { | 33 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { |
34 public: | 34 public: |
35 SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input = NULL) | 35 SkDilateImageFilter(int radiusX, int radiusY, |
36 : INHERITED(radiusX, radiusY, input) {} | 36 SkImageFilter* input = NULL, |
| 37 const SkIRect* cropRect = NULL) |
| 38 : INHERITED(radiusX, radiusY, input, cropRect) {} |
37 | 39 |
38 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 40 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
39 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; | 41 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; |
40 #if SK_SUPPORT_GPU | 42 #if SK_SUPPORT_GPU |
41 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatri
x& ctm, | 43 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatri
x& ctm, |
42 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; | 44 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; |
43 #endif | 45 #endif |
44 | 46 |
45 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) | 47 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) |
46 | 48 |
47 protected: | 49 protected: |
48 SkDilateImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 50 SkDilateImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
49 | 51 |
50 private: | 52 private: |
51 typedef SkMorphologyImageFilter INHERITED; | 53 typedef SkMorphologyImageFilter INHERITED; |
52 }; | 54 }; |
53 | 55 |
54 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { | 56 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { |
55 public: | 57 public: |
56 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input = NULL) | 58 SkErodeImageFilter(int radiusX, int radiusY, |
57 : INHERITED(radiusX, radiusY, input) {} | 59 SkImageFilter* input = NULL, |
| 60 const SkIRect* cropRect = NULL) |
| 61 : INHERITED(radiusX, radiusY, input, cropRect) {} |
58 | 62 |
59 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 63 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
60 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; | 64 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; |
61 #if SK_SUPPORT_GPU | 65 #if SK_SUPPORT_GPU |
62 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatri
x& ctm, | 66 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatri
x& ctm, |
63 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; | 67 SkBitmap* result, SkIPoint* offset) SK_OVERRIDE; |
64 #endif | 68 #endif |
65 | 69 |
66 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) | 70 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) |
67 | 71 |
68 protected: | 72 protected: |
69 SkErodeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 73 SkErodeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
70 | 74 |
71 private: | 75 private: |
72 typedef SkMorphologyImageFilter INHERITED; | 76 typedef SkMorphologyImageFilter INHERITED; |
73 }; | 77 }; |
74 | 78 |
75 #endif | 79 #endif |
OLD | NEW |