| 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 14 matching lines...) Expand all Loading... |
| 25 * number of pixels per row in each buffer. All buffers are 8888. | 25 * number of pixels per row in each buffer. All buffers are 8888. |
| 26 */ | 26 */ |
| 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); | 33 const CropRect* cropRect); |
| 34 bool filterImageGeneric(Proc procX, Proc procY, | 34 bool filterImageGeneric(Proc procX, Proc procY, |
| 35 Proxy*, const SkBitmap& src, const SkMatrix&, | 35 Proxy*, const SkBitmap& src, const Context&, |
| 36 SkBitmap* result, SkIPoint* offset) const; | 36 SkBitmap* result, SkIPoint* offset) const; |
| 37 SkMorphologyImageFilter(SkReadBuffer& buffer); | 37 SkMorphologyImageFilter(SkReadBuffer& buffer); |
| 38 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 38 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
| 39 #if SK_SUPPORT_GPU | 39 #if SK_SUPPORT_GPU |
| 40 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } | 40 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } |
| 41 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, | 41 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, |
| 42 const SkMatrix& ctm, SkBitmap* result, | 42 const Context& ctm, SkBitmap* result, |
| 43 SkIPoint* offset) const; | 43 SkIPoint* offset) const; |
| 44 #endif | 44 #endif |
| 45 | 45 |
| 46 SkISize radius() const { return fRadius; } | 46 SkISize radius() const { return fRadius; } |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 SkISize fRadius; | 49 SkISize fRadius; |
| 50 typedef SkImageFilter INHERITED; | 50 typedef SkImageFilter INHERITED; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { | 53 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { |
| 54 public: | 54 public: |
| 55 static SkDilateImageFilter* Create(int radiusX, int radiusY, | 55 static SkDilateImageFilter* Create(int radiusX, int radiusY, |
| 56 SkImageFilter* input = NULL, | 56 SkImageFilter* input = NULL, |
| 57 const CropRect* cropRect = NULL) { | 57 const CropRect* cropRect = NULL) { |
| 58 return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRec
t)); | 58 return SkNEW_ARGS(SkDilateImageFilter, (radiusX, radiusY, input, cropRec
t)); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 61 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
| 62 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; | 62 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; |
| 63 #if SK_SUPPORT_GPU | 63 #if SK_SUPPORT_GPU |
| 64 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatri
x& ctm, | 64 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
&, |
| 65 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; | 65 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; |
| 66 #endif | 66 #endif |
| 67 | 67 |
| 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) | 68 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter) |
| 69 | 69 |
| 70 protected: | 70 protected: |
| 71 SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} | 71 SkDilateImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} |
| 72 | 72 |
| 73 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | 73 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS |
| 74 public: | 74 public: |
| 75 #endif | 75 #endif |
| 76 SkDilateImageFilter(int radiusX, int radiusY, | 76 SkDilateImageFilter(int radiusX, int radiusY, |
| 77 SkImageFilter* input = NULL, | 77 SkImageFilter* input = NULL, |
| 78 const CropRect* cropRect = NULL) | 78 const CropRect* cropRect = NULL) |
| 79 : INHERITED(radiusX, radiusY, input, cropRect) {} | 79 : INHERITED(radiusX, radiusY, input, cropRect) {} |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 typedef SkMorphologyImageFilter INHERITED; | 82 typedef SkMorphologyImageFilter INHERITED; |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { | 85 class SK_API SkErodeImageFilter : public SkMorphologyImageFilter { |
| 86 public: | 86 public: |
| 87 static SkErodeImageFilter* Create(int radiusX, int radiusY, | 87 static SkErodeImageFilter* Create(int radiusX, int radiusY, |
| 88 SkImageFilter* input = NULL, | 88 SkImageFilter* input = NULL, |
| 89 const CropRect* cropRect = NULL) { | 89 const CropRect* cropRect = NULL) { |
| 90 return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect
)); | 90 return SkNEW_ARGS(SkErodeImageFilter, (radiusX, radiusY, input, cropRect
)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 93 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
| 94 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; | 94 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; |
| 95 #if SK_SUPPORT_GPU | 95 #if SK_SUPPORT_GPU |
| 96 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const SkMatri
x& ctm, | 96 virtual bool filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context
&, |
| 97 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; | 97 SkBitmap* result, SkIPoint* offset) const SK_OVE
RRIDE; |
| 98 #endif | 98 #endif |
| 99 | 99 |
| 100 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) | 100 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) |
| 101 | 101 |
| 102 protected: | 102 protected: |
| 103 SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} | 103 SkErodeImageFilter(SkReadBuffer& buffer) : INHERITED(buffer) {} |
| 104 | 104 |
| 105 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS | 105 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS |
| 106 public: | 106 public: |
| 107 #endif | 107 #endif |
| 108 SkErodeImageFilter(int radiusX, int radiusY, | 108 SkErodeImageFilter(int radiusX, int radiusY, |
| 109 SkImageFilter* input = NULL, | 109 SkImageFilter* input = NULL, |
| 110 const CropRect* cropRect = NULL) | 110 const CropRect* cropRect = NULL) |
| 111 : INHERITED(radiusX, radiusY, input, cropRect) {} | 111 : INHERITED(radiusX, radiusY, input, cropRect) {} |
| 112 | 112 |
| 113 private: | 113 private: |
| 114 typedef SkMorphologyImageFilter INHERITED; | 114 typedef SkMorphologyImageFilter INHERITED; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 #endif | 117 #endif |
| OLD | NEW |