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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 SkScalar gain, | 45 SkScalar gain, |
46 SkScalar bias, | 46 SkScalar bias, |
47 const SkIPoint& kernelOffset, | 47 const SkIPoint& kernelOffset, |
48 GrTextureDomain::Mode tileMode, | 48 GrTextureDomain::Mode tileMode, |
49 bool convolveAlpha, | 49 bool convolveAlpha, |
50 SkScalar sigmaX, | 50 SkScalar sigmaX, |
51 SkScalar sigmaY); | 51 SkScalar sigmaY); |
52 | 52 |
53 virtual ~GrMatrixConvolutionEffect(); | 53 virtual ~GrMatrixConvolutionEffect(); |
54 | 54 |
55 virtual void getConstantColorComponents(GrColor* color, | |
56 uint32_t* validFlags) const SK_OVERR
IDE { | |
57 // TODO: Try to do better? | |
58 *validFlags = 0; | |
59 } | |
60 | |
61 static const char* Name() { return "MatrixConvolution"; } | 55 static const char* Name() { return "MatrixConvolution"; } |
62 const SkIRect& bounds() const { return fBounds; } | 56 const SkIRect& bounds() const { return fBounds; } |
63 const SkISize& kernelSize() const { return fKernelSize; } | 57 const SkISize& kernelSize() const { return fKernelSize; } |
64 const float* kernelOffset() const { return fKernelOffset; } | 58 const float* kernelOffset() const { return fKernelOffset; } |
65 const float* kernel() const { return fKernel; } | 59 const float* kernel() const { return fKernel; } |
66 float gain() const { return fGain; } | 60 float gain() const { return fGain; } |
67 float bias() const { return fBias; } | 61 float bias() const { return fBias; } |
68 bool convolveAlpha() const { return fConvolveAlpha; } | 62 bool convolveAlpha() const { return fConvolveAlpha; } |
69 const GrTextureDomain& domain() const { return fDomain; } | 63 const GrTextureDomain& domain() const { return fDomain; } |
70 | 64 |
71 typedef GrGLMatrixConvolutionEffect GLProcessor; | 65 typedef GrGLMatrixConvolutionEffect GLProcessor; |
72 | 66 |
73 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 67 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
74 | 68 |
75 private: | 69 private: |
76 GrMatrixConvolutionEffect(GrTexture*, | 70 GrMatrixConvolutionEffect(GrTexture*, |
77 const SkIRect& bounds, | 71 const SkIRect& bounds, |
78 const SkISize& kernelSize, | 72 const SkISize& kernelSize, |
79 const SkScalar* kernel, | 73 const SkScalar* kernel, |
80 SkScalar gain, | 74 SkScalar gain, |
81 SkScalar bias, | 75 SkScalar bias, |
82 const SkIPoint& kernelOffset, | 76 const SkIPoint& kernelOffset, |
83 GrTextureDomain::Mode tileMode, | 77 GrTextureDomain::Mode tileMode, |
84 bool convolveAlpha); | 78 bool convolveAlpha); |
85 | 79 |
86 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 80 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; |
87 | 81 |
| 82 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { |
| 83 // TODO: Try to do better? |
| 84 inout->fValidFlags = 0; |
| 85 inout->fIsSingleComponent = false; |
| 86 } |
| 87 |
88 SkIRect fBounds; | 88 SkIRect fBounds; |
89 SkISize fKernelSize; | 89 SkISize fKernelSize; |
90 float fKernel[MAX_KERNEL_SIZE]; | 90 float fKernel[MAX_KERNEL_SIZE]; |
91 float fGain; | 91 float fGain; |
92 float fBias; | 92 float fBias; |
93 float fKernelOffset[2]; | 93 float fKernelOffset[2]; |
94 bool fConvolveAlpha; | 94 bool fConvolveAlpha; |
95 GrTextureDomain fDomain; | 95 GrTextureDomain fDomain; |
96 | 96 |
97 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 97 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
98 | 98 |
99 typedef GrSingleTextureEffect INHERITED; | 99 typedef GrSingleTextureEffect INHERITED; |
100 }; | 100 }; |
101 | 101 |
102 #endif | 102 #endif |
OLD | NEW |