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 "SkColor.h" |
12 #include "SkImageFilter.h" | 13 #include "SkImageFilter.h" |
13 #include "SkSize.h" | 14 #include "SkSize.h" |
14 | 15 |
15 class SK_API SkMorphologyImageFilter : public SkImageFilter { | 16 class SK_API SkMorphologyImageFilter : public SkImageFilter { |
16 public: | 17 public: |
17 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, cons
t CropRect* cropRect); | 18 SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input, cons
t CropRect* cropRect); |
18 | 19 |
| 20 /** |
| 21 * All morphology procs have the same signature: src is the source buffer, d
st the |
| 22 * destination buffer, radius is the morphology radius, width and height are
the bounds |
| 23 * of the destination buffer (in pixels), and srcStride and dstStride are th
e |
| 24 * number of pixels per row in each buffer. All buffers are 8888. |
| 25 */ |
| 26 |
| 27 typedef void (*Proc)(const SkPMColor* src, SkPMColor* dst, int radius, |
| 28 int width, int height, int srcStride, int dstStride); |
| 29 |
19 protected: | 30 protected: |
| 31 bool filterImageGeneric(Proc procX, Proc procY, |
| 32 Proxy*, const SkBitmap& src, const SkMatrix&, |
| 33 SkBitmap* result, SkIPoint* offset); |
20 SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer); | 34 SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer); |
21 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 35 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
22 #if SK_SUPPORT_GPU | 36 #if SK_SUPPORT_GPU |
23 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } | 37 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } |
| 38 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, |
| 39 const SkMatrix& ctm, SkBitmap* result, |
| 40 SkIPoint* offset); |
24 #endif | 41 #endif |
25 | 42 |
26 SkISize radius() const { return fRadius; } | 43 SkISize radius() const { return fRadius; } |
27 | 44 |
28 private: | 45 private: |
29 SkISize fRadius; | 46 SkISize fRadius; |
30 typedef SkImageFilter INHERITED; | 47 typedef SkImageFilter INHERITED; |
31 }; | 48 }; |
32 | 49 |
33 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { | 50 class SK_API SkDilateImageFilter : public SkMorphologyImageFilter { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) | 87 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter) |
71 | 88 |
72 protected: | 89 protected: |
73 SkErodeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} | 90 SkErodeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {} |
74 | 91 |
75 private: | 92 private: |
76 typedef SkMorphologyImageFilter INHERITED; | 93 typedef SkMorphologyImageFilter INHERITED; |
77 }; | 94 }; |
78 | 95 |
79 #endif | 96 #endif |
OLD | NEW |