OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
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 #ifndef GrMatrixConvolutionEffect_DEFINED | 8 #ifndef GrMatrixConvolutionEffect_DEFINED |
9 #define GrMatrixConvolutionEffect_DEFINED | 9 #define GrMatrixConvolutionEffect_DEFINED |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture, | 31 return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture, |
32 bounds, | 32 bounds, |
33 kernelSize, | 33 kernelSize, |
34 kernel, | 34 kernel, |
35 gain, | 35 gain, |
36 bias, | 36 bias, |
37 kernelOffset, | 37 kernelOffset, |
38 tileMode, | 38 tileMode, |
39 convolveAlpha)); | 39 convolveAlpha)); |
40 } | 40 } |
| 41 |
| 42 static GrEffect* CreateGaussian(GrTexture* texture, |
| 43 const SkIRect& bounds, |
| 44 const SkISize& kernelSize, |
| 45 SkScalar gain, |
| 46 SkScalar bias, |
| 47 const SkIPoint& kernelOffset, |
| 48 GrTextureDomain::Mode tileMode, |
| 49 bool convolveAlpha, |
| 50 SkScalar sigmaX, |
| 51 SkScalar sigmaY); |
| 52 |
41 virtual ~GrMatrixConvolutionEffect(); | 53 virtual ~GrMatrixConvolutionEffect(); |
42 | 54 |
43 virtual void getConstantColorComponents(GrColor* color, | 55 virtual void getConstantColorComponents(GrColor* color, |
44 uint32_t* validFlags) const SK_OVERR
IDE { | 56 uint32_t* validFlags) const SK_OVERR
IDE { |
45 // TODO: Try to do better? | 57 // TODO: Try to do better? |
46 *validFlags = 0; | 58 *validFlags = 0; |
47 } | 59 } |
48 | 60 |
49 static const char* Name() { return "MatrixConvolution"; } | 61 static const char* Name() { return "MatrixConvolution"; } |
50 const SkIRect& bounds() const { return fBounds; } | 62 const SkIRect& bounds() const { return fBounds; } |
(...skipping 17 matching lines...) Expand all Loading... |
68 SkScalar gain, | 80 SkScalar gain, |
69 SkScalar bias, | 81 SkScalar bias, |
70 const SkIPoint& kernelOffset, | 82 const SkIPoint& kernelOffset, |
71 GrTextureDomain::Mode tileMode, | 83 GrTextureDomain::Mode tileMode, |
72 bool convolveAlpha); | 84 bool convolveAlpha); |
73 | 85 |
74 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; | 86 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; |
75 | 87 |
76 SkIRect fBounds; | 88 SkIRect fBounds; |
77 SkISize fKernelSize; | 89 SkISize fKernelSize; |
78 float* fKernel; | 90 float fKernel[MAX_KERNEL_SIZE]; |
79 float fGain; | 91 float fGain; |
80 float fBias; | 92 float fBias; |
81 float fKernelOffset[2]; | 93 float fKernelOffset[2]; |
82 bool fConvolveAlpha; | 94 bool fConvolveAlpha; |
83 GrTextureDomain fDomain; | 95 GrTextureDomain fDomain; |
84 | 96 |
85 GR_DECLARE_EFFECT_TEST; | 97 GR_DECLARE_EFFECT_TEST; |
86 | 98 |
87 typedef GrSingleTextureEffect INHERITED; | 99 typedef GrSingleTextureEffect INHERITED; |
88 }; | 100 }; |
89 | 101 |
90 #endif | 102 #endif |
OLD | NEW |