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 |
11 #include "GrSingleTextureEffect.h" | 11 #include "GrSingleTextureEffect.h" |
12 #include "GrInvariantOutput.h" | 12 #include "GrInvariantOutput.h" |
13 #include "GrTextureDomain.h" | 13 #include "GrTextureDomain.h" |
14 | 14 |
15 // A little bit less than the minimum # uniforms required by DX9SM2 (32). | 15 // A little bit less than the minimum # uniforms required by DX9SM2 (32). |
16 // Allows for a 5x5 kernel (or 25x1, for that matter). | 16 // Allows for a 5x5 kernel (or 25x1, for that matter). |
17 #define MAX_KERNEL_SIZE 25 | 17 #define MAX_KERNEL_SIZE 25 |
18 | 18 |
19 class GrGLMatrixConvolutionEffect; | |
20 | |
21 class GrMatrixConvolutionEffect : public GrSingleTextureEffect { | 19 class GrMatrixConvolutionEffect : public GrSingleTextureEffect { |
22 public: | 20 public: |
23 static GrFragmentProcessor* Create(GrTexture* texture, | 21 static GrFragmentProcessor* Create(GrTexture* texture, |
24 const SkIRect& bounds, | 22 const SkIRect& bounds, |
25 const SkISize& kernelSize, | 23 const SkISize& kernelSize, |
26 const SkScalar* kernel, | 24 const SkScalar* kernel, |
27 SkScalar gain, | 25 SkScalar gain, |
28 SkScalar bias, | 26 SkScalar bias, |
29 const SkIPoint& kernelOffset, | 27 const SkIPoint& kernelOffset, |
30 GrTextureDomain::Mode tileMode, | 28 GrTextureDomain::Mode tileMode, |
(...skipping 15 matching lines...) Expand all Loading... |
46 SkScalar gain, | 44 SkScalar gain, |
47 SkScalar bias, | 45 SkScalar bias, |
48 const SkIPoint& kernelOffset, | 46 const SkIPoint& kernelOffset, |
49 GrTextureDomain::Mode tileMode, | 47 GrTextureDomain::Mode tileMode, |
50 bool convolveAlpha, | 48 bool convolveAlpha, |
51 SkScalar sigmaX, | 49 SkScalar sigmaX, |
52 SkScalar sigmaY); | 50 SkScalar sigmaY); |
53 | 51 |
54 virtual ~GrMatrixConvolutionEffect(); | 52 virtual ~GrMatrixConvolutionEffect(); |
55 | 53 |
56 static const char* Name() { return "MatrixConvolution"; } | |
57 const SkIRect& bounds() const { return fBounds; } | 54 const SkIRect& bounds() const { return fBounds; } |
58 const SkISize& kernelSize() const { return fKernelSize; } | 55 const SkISize& kernelSize() const { return fKernelSize; } |
59 const float* kernelOffset() const { return fKernelOffset; } | 56 const float* kernelOffset() const { return fKernelOffset; } |
60 const float* kernel() const { return fKernel; } | 57 const float* kernel() const { return fKernel; } |
61 float gain() const { return fGain; } | 58 float gain() const { return fGain; } |
62 float bias() const { return fBias; } | 59 float bias() const { return fBias; } |
63 bool convolveAlpha() const { return fConvolveAlpha; } | 60 bool convolveAlpha() const { return fConvolveAlpha; } |
64 const GrTextureDomain& domain() const { return fDomain; } | 61 const GrTextureDomain& domain() const { return fDomain; } |
65 | 62 |
66 typedef GrGLMatrixConvolutionEffect GLProcessor; | 63 virtual const char* name() const SK_OVERRIDE { return "MatrixConvolution"; } |
67 | 64 |
68 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 65 virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) cons
t SK_OVERRIDE; |
| 66 |
| 67 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; |
69 | 68 |
70 private: | 69 private: |
71 GrMatrixConvolutionEffect(GrTexture*, | 70 GrMatrixConvolutionEffect(GrTexture*, |
72 const SkIRect& bounds, | 71 const SkIRect& bounds, |
73 const SkISize& kernelSize, | 72 const SkISize& kernelSize, |
74 const SkScalar* kernel, | 73 const SkScalar* kernel, |
75 SkScalar gain, | 74 SkScalar gain, |
76 SkScalar bias, | 75 SkScalar bias, |
77 const SkIPoint& kernelOffset, | 76 const SkIPoint& kernelOffset, |
78 GrTextureDomain::Mode tileMode, | 77 GrTextureDomain::Mode tileMode, |
(...skipping 14 matching lines...) Expand all Loading... |
93 float fKernelOffset[2]; | 92 float fKernelOffset[2]; |
94 bool fConvolveAlpha; | 93 bool fConvolveAlpha; |
95 GrTextureDomain fDomain; | 94 GrTextureDomain fDomain; |
96 | 95 |
97 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 96 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
98 | 97 |
99 typedef GrSingleTextureEffect INHERITED; | 98 typedef GrSingleTextureEffect INHERITED; |
100 }; | 99 }; |
101 | 100 |
102 #endif | 101 #endif |
OLD | NEW |