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 |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius, | 28 typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius, |
29 int width, int height, int srcStride, int dstStride); | 29 int width, int height, int srcStride, int dstStride); |
30 | 30 |
31 protected: | 31 protected: |
32 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, | 32 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, |
33 const CropRect* cropRect, uint32_t uniqueID); | 33 const CropRect* cropRect, uint32_t uniqueID); |
34 bool filterImageGeneric(Proc procX, Proc procY, | 34 bool filterImageGeneric(Proc procX, Proc procY, |
35 Proxy*, const SkBitmap& src, const Context&, | 35 Proxy*, const SkBitmap& src, const Context&, |
36 SkBitmap* result, SkIPoint* offset) const; | 36 SkBitmap* result, SkIPoint* offset) const; |
37 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
38 SkMorphologyImageFilter(SkReadBuffer& buffer); | |
39 #endif | |
40 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 37 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
41 #if SK_SUPPORT_GPU | 38 #if SK_SUPPORT_GPU |
42 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } | 39 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } |
43 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, | 40 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, |
44 const Context& ctm, SkBitmap* result, | 41 const Context& ctm, SkBitmap* result, |
45 SkIPoint* offset) const; | 42 SkIPoint* offset) const; |
46 #endif | 43 #endif |
47 | 44 |
48 SkISize radius() const { return fRadius; } | 45 SkISize radius() const { return fRadius; } |
49 | 46 |
(...skipping 19 matching lines...) Expand all Loading... |
69 #if SK_SUPPORT_GPU | 66 #if SK_SUPPORT_GPU |
70 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
&, | 67 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
&, |
71 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; | 68 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; |
72 #endif | 69 #endif |
73 | 70 |
74 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) | 71 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) |
75 | 72 |
76 protected: | 73 protected: |
77 SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cr
opRect* cropRect, uint32_t uniqueID) | 74 SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cr
opRect* cropRect, uint32_t uniqueID) |
78 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {} | 75 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {} |
79 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
80 explicit SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} | |
81 #endif | |
82 | |
83 private: | 76 private: |
84 typedef SkMorphologyImageFilter INHERITED; | 77 typedef SkMorphologyImageFilter INHERITED; |
85 }; | 78 }; |
86 | 79 |
87 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { | 80 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { |
88 public: | 81 public: |
89 static SkErodeImageFilter* Create(int radiusX, int radiusY, | 82 static SkErodeImageFilter* Create(int radiusX, int radiusY, |
90 SkImageFilter* input = NULL, | 83 SkImageFilter* input = NULL, |
91 const CropRect* cropRect = NULL, | 84 const CropRect* cropRect = NULL, |
92 uint32_t uniqueID = 0) { | 85 uint32_t uniqueID = 0) { |
93 if (radiusX < 0 || radiusY < 0) { | 86 if (radiusX < 0 || radiusY < 0) { |
94 return NULL; | 87 return NULL; |
95 } | 88 } |
96 return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect
, uniqueID)); | 89 return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect
, uniqueID)); |
97 } | 90 } |
98 | 91 |
99 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 92 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
100 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; | 93 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; |
101 #if SK_SUPPORT_GPU | 94 #if SK_SUPPORT_GPU |
102 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
&, | 95 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
&, |
103 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; | 96 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; |
104 #endif | 97 #endif |
105 | 98 |
106 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) | 99 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) |
107 | 100 |
108 protected: | 101 protected: |
109 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro
pRect* cropRect, uint32_t uniqueID) | 102 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro
pRect* cropRect, uint32_t uniqueID) |
110 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {} | 103 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {} |
111 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
112 explicit SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} | |
113 #endif | |
114 | 104 |
115 private: | 105 private: |
116 typedef SkMorphologyImageFilter INHERITED; | 106 typedef SkMorphologyImageFilter INHERITED; |
117 }; | 107 }; |
118 | 108 |
119 #endif | 109 #endif |
OLD | NEW |