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