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 |
55 static const char* Name() { return "MatrixConvolution"; } | 61 static const char* Name() { return "MatrixConvolution"; } |
56 const SkIRect& bounds() const { return fBounds; } | 62 const SkIRect& bounds() const { return fBounds; } |
57 const SkISize& kernelSize() const { return fKernelSize; } | 63 const SkISize& kernelSize() const { return fKernelSize; } |
58 const float* kernelOffset() const { return fKernelOffset; } | 64 const float* kernelOffset() const { return fKernelOffset; } |
59 const float* kernel() const { return fKernel; } | 65 const float* kernel() const { return fKernel; } |
60 float gain() const { return fGain; } | 66 float gain() const { return fGain; } |
61 float bias() const { return fBias; } | 67 float bias() const { return fBias; } |
62 bool convolveAlpha() const { return fConvolveAlpha; } | 68 bool convolveAlpha() const { return fConvolveAlpha; } |
63 const GrTextureDomain& domain() const { return fDomain; } | 69 const GrTextureDomain& domain() const { return fDomain; } |
64 | 70 |
65 typedef GrGLMatrixConvolutionEffect GLProcessor; | 71 typedef GrGLMatrixConvolutionEffect GLProcessor; |
66 | 72 |
67 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 73 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
68 | 74 |
69 private: | 75 private: |
70 GrMatrixConvolutionEffect(GrTexture*, | 76 GrMatrixConvolutionEffect(GrTexture*, |
71 const SkIRect& bounds, | 77 const SkIRect& bounds, |
72 const SkISize& kernelSize, | 78 const SkISize& kernelSize, |
73 const SkScalar* kernel, | 79 const SkScalar* kernel, |
74 SkScalar gain, | 80 SkScalar gain, |
75 SkScalar bias, | 81 SkScalar bias, |
76 const SkIPoint& kernelOffset, | 82 const SkIPoint& kernelOffset, |
77 GrTextureDomain::Mode tileMode, | 83 GrTextureDomain::Mode tileMode, |
78 bool convolveAlpha); | 84 bool convolveAlpha); |
79 | 85 |
80 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 86 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; |
81 | 87 |
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 |