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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 const SkIRect& bounds() const { return fBounds; } | 54 const SkIRect& bounds() const { return fBounds; } |
55 const SkISize& kernelSize() const { return fKernelSize; } | 55 const SkISize& kernelSize() const { return fKernelSize; } |
56 const float* kernelOffset() const { return fKernelOffset; } | 56 const float* kernelOffset() const { return fKernelOffset; } |
57 const float* kernel() const { return fKernel; } | 57 const float* kernel() const { return fKernel; } |
58 float gain() const { return fGain; } | 58 float gain() const { return fGain; } |
59 float bias() const { return fBias; } | 59 float bias() const { return fBias; } |
60 bool convolveAlpha() const { return fConvolveAlpha; } | 60 bool convolveAlpha() const { return fConvolveAlpha; } |
61 const GrTextureDomain& domain() const { return fDomain; } | 61 const GrTextureDomain& domain() const { return fDomain; } |
62 | 62 |
63 virtual const char* name() const SK_OVERRIDE { return "MatrixConvolution"; } | 63 const char* name() const SK_OVERRIDE { return "MatrixConvolution"; } |
64 | 64 |
65 virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) cons
t SK_OVERRIDE; | 65 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE
RRIDE; |
66 | 66 |
67 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 67 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; |
68 | 68 |
69 private: | 69 private: |
70 GrMatrixConvolutionEffect(GrTexture*, | 70 GrMatrixConvolutionEffect(GrTexture*, |
71 const SkIRect& bounds, | 71 const SkIRect& bounds, |
72 const SkISize& kernelSize, | 72 const SkISize& kernelSize, |
73 const SkScalar* kernel, | 73 const SkScalar* kernel, |
74 SkScalar gain, | 74 SkScalar gain, |
75 SkScalar bias, | 75 SkScalar bias, |
76 const SkIPoint& kernelOffset, | 76 const SkIPoint& kernelOffset, |
77 GrTextureDomain::Mode tileMode, | 77 GrTextureDomain::Mode tileMode, |
78 bool convolveAlpha); | 78 bool convolveAlpha); |
79 | 79 |
80 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 80 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
81 | 81 |
82 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { | 82 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE { |
83 // TODO: Try to do better? | 83 // TODO: Try to do better? |
84 inout->mulByUnknownFourComponents(); | 84 inout->mulByUnknownFourComponents(); |
85 } | 85 } |
86 | 86 |
87 SkIRect fBounds; | 87 SkIRect fBounds; |
88 SkISize fKernelSize; | 88 SkISize fKernelSize; |
89 float fKernel[MAX_KERNEL_SIZE]; | 89 float fKernel[MAX_KERNEL_SIZE]; |
90 float fGain; | 90 float fGain; |
91 float fBias; | 91 float fBias; |
92 float fKernelOffset[2]; | 92 float fKernelOffset[2]; |
93 bool fConvolveAlpha; | 93 bool fConvolveAlpha; |
94 GrTextureDomain fDomain; | 94 GrTextureDomain fDomain; |
95 | 95 |
96 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 96 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
97 | 97 |
98 typedef GrSingleTextureEffect INHERITED; | 98 typedef GrSingleTextureEffect INHERITED; |
99 }; | 99 }; |
100 | 100 |
101 #endif | 101 #endif |
OLD | NEW |