1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*
* Copyright 2012 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkMorphologyImageFilter_DEFINED
#define SkMorphologyImageFilter_DEFINED
#include "SkSingleInputImageFilter.h"
#include "SkSize.h"
class SK_API SkMorphologyImageFilter : public SkSingleInputImageFilter {
public:
SkMorphologyImageFilter(int radiusX, int radiusY, SkImageFilter* input);
protected:
SkMorphologyImageFilter(SkFlattenableReadBuffer& buffer);
virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual bool canFilterImageGPU() const SK_OVERRIDE { return true; }
#endif
SkISize radius() const { return fRadius; }
private:
SkISize fRadius;
typedef SkSingleInputImageFilter INHERITED;
};
class SK_API SkDilateImageFilter : public SkMorphologyImageFilter {
public:
SkDilateImageFilter(int radiusX, int radiusY, SkImageFilter* input = NULL)
: INHERITED(radiusX, radiusY, input) {}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual GrTexture* onFilterImageGPU(Proxy* proxy, GrTexture* src,
const SkRect& rect) SK_OVERRIDE;
#endif
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDilateImageFilter)
protected:
SkDilateImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
private:
typedef SkMorphologyImageFilter INHERITED;
};
class SK_API SkErodeImageFilter : public SkMorphologyImageFilter {
public:
SkErodeImageFilter(int radiusX, int radiusY, SkImageFilter* input = NULL)
: INHERITED(radiusX, radiusY, input) {}
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
SkBitmap* result, SkIPoint* offset) SK_OVERRIDE;
#if SK_SUPPORT_GPU
virtual GrTexture* onFilterImageGPU(Proxy* proxy, GrTexture* src,
const SkRect& rect) SK_OVERRIDE;
#endif
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkErodeImageFilter)
protected:
SkErodeImageFilter(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
private:
typedef SkMorphologyImageFilter INHERITED;
};
#endif
|