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 "SkColor.h" |
13 #include "SkImageFilter.h" | 13 #include "SkImageFilter.h" |
14 #include "SkSize.h" | 14 #include "SkSize.h" |
15 | 15 |
16 class SK_API SkMorphologyImageFilter : public SkImageFilter { | 16 class SK_API SkMorphologyImageFilter : public SkImageFilter { |
17 public: | 17 public: |
18 virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVER
RIDE; | 18 void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVERRIDE; |
19 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect
* dst) const SK_OVERRIDE; | 19 bool onFilterBounds(const SkIRect& src, const SkMatrix& ctm, SkIRect* dst) c
onst SK_OVERRIDE; |
20 | 20 |
21 /** | 21 /** |
22 * All morphology procs have the same signature: src is the source buffer, d
st the | 22 * All morphology procs have the same signature: src is the source buffer, d
st the |
23 * destination buffer, radius is the morphology radius, width and height are
the bounds | 23 * destination buffer, radius is the morphology radius, width and height are
the bounds |
24 * of the destination buffer (in pixels), and srcStride and dstStride are th
e | 24 * of the destination buffer (in pixels), and srcStride and dstStride are th
e |
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, 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 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 37 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
38 #if SK_SUPPORT_GPU | 38 #if SK_SUPPORT_GPU |
39 virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; } | 39 bool canFilterImageGPU() const SK_OVERRIDE { return true; } |
40 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, | 40 bool filterImageGPUGeneric(bool dilate, Proxy* proxy, const SkBitmap& src, |
41 const Context& ctm, SkBitmap* result, | 41 const Context& ctm, SkBitmap* result, |
42 SkIPoint* offset) const; | 42 SkIPoint* offset) const; |
43 #endif | 43 #endif |
44 | 44 |
45 SkISize radius() const { return fRadius; } | 45 SkISize radius() const { return fRadius; } |
46 | 46 |
47 private: | 47 private: |
48 SkISize fRadius; | 48 SkISize fRadius; |
49 typedef SkImageFilter INHERITED; | 49 typedef SkImageFilter INHERITED; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 protected: | 103 protected: |
104 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro
pRect* cropRect, uint32_t uniqueID) | 104 SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input, const Cro
pRect* cropRect, uint32_t uniqueID) |
105 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {} | 105 : INHERITED(radiusX, radiusY, input, cropRect, uniqueID) {} |
106 | 106 |
107 private: | 107 private: |
108 typedef SkMorphologyImageFilter INHERITED; | 108 typedef SkMorphologyImageFilter INHERITED; |
109 }; | 109 }; |
110 | 110 |
111 #endif | 111 #endif |
OLD | NEW |