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