OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrConvolutionEffect_DEFINED | 8 #ifndef GrConvolutionEffect_DEFINED |
9 #define GrConvolutionEffect_DEFINED | 9 #define GrConvolutionEffect_DEFINED |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 bounds)); | 50 bounds)); |
51 } | 51 } |
52 | 52 |
53 virtual ~GrConvolutionEffect(); | 53 virtual ~GrConvolutionEffect(); |
54 | 54 |
55 const float* kernel() const { return fKernel; } | 55 const float* kernel() const { return fKernel; } |
56 | 56 |
57 const float* bounds() const { return fBounds; } | 57 const float* bounds() const { return fBounds; } |
58 bool useBounds() const { return fUseBounds; } | 58 bool useBounds() const { return fUseBounds; } |
59 | 59 |
60 const char* name() const SK_OVERRIDE { return "Convolution"; } | 60 const char* name() const override { return "Convolution"; } |
61 | 61 |
62 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE
RRIDE; | 62 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri
de; |
63 | 63 |
64 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 64 GrGLFragmentProcessor* createGLInstance() const override; |
65 | 65 |
66 enum { | 66 enum { |
67 // This was decided based on the min allowed value for the max texture | 67 // This was decided based on the min allowed value for the max texture |
68 // samples per fragment program run in DX9SM2 (32). A sigma param of 4.0 | 68 // samples per fragment program run in DX9SM2 (32). A sigma param of 4.0 |
69 // on a blur filter gives a kernel width of 25 while a sigma of 5.0 | 69 // on a blur filter gives a kernel width of 25 while a sigma of 5.0 |
70 // would exceed a 32 wide kernel. | 70 // would exceed a 32 wide kernel. |
71 kMaxKernelRadius = 12, | 71 kMaxKernelRadius = 12, |
72 // With a C++11 we could have a constexpr version of WidthFromRadius() | 72 // With a C++11 we could have a constexpr version of WidthFromRadius() |
73 // and not have to duplicate this calculation. | 73 // and not have to duplicate this calculation. |
74 kMaxKernelWidth = 2 * kMaxKernelRadius + 1, | 74 kMaxKernelWidth = 2 * kMaxKernelRadius + 1, |
(...skipping 12 matching lines...) Expand all Loading... |
87 bool useBounds, | 87 bool useBounds, |
88 float bounds[2]); | 88 float bounds[2]); |
89 | 89 |
90 /// Convolve with a Gaussian kernel | 90 /// Convolve with a Gaussian kernel |
91 GrConvolutionEffect(GrTexture*, Direction, | 91 GrConvolutionEffect(GrTexture*, Direction, |
92 int halfWidth, | 92 int halfWidth, |
93 float gaussianSigma, | 93 float gaussianSigma, |
94 bool useBounds, | 94 bool useBounds, |
95 float bounds[2]); | 95 float bounds[2]); |
96 | 96 |
97 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 97 bool onIsEqual(const GrFragmentProcessor&) const override; |
98 | 98 |
99 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE { | 99 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
100 // If the texture was opaque we could know that the output color if we k
new the sum of the | 100 // If the texture was opaque we could know that the output color if we k
new the sum of the |
101 // kernel values. | 101 // kernel values. |
102 inout->mulByUnknownFourComponents(); | 102 inout->mulByUnknownFourComponents(); |
103 } | 103 } |
104 | 104 |
105 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 105 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
106 | 106 |
107 typedef Gr1DKernelEffect INHERITED; | 107 typedef Gr1DKernelEffect INHERITED; |
108 }; | 108 }; |
109 | 109 |
110 #endif | 110 #endif |
OLD | NEW |