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 #include "gl/builders/GrGLProgramBuilder.h" | 7 #include "gl/builders/GrGLProgramBuilder.h" |
8 #include "GrMatrixConvolutionEffect.h" | 8 #include "GrMatrixConvolutionEffect.h" |
9 #include "gl/GrGLEffect.h" | 9 #include "gl/GrGLEffect.h" |
10 #include "gl/GrGLSL.h" | 10 #include "gl/GrGLSL.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture, | 151 GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture, |
152 const SkIRect& bounds, | 152 const SkIRect& bounds, |
153 const SkISize& kernelSize, | 153 const SkISize& kernelSize, |
154 const SkScalar* kernel, | 154 const SkScalar* kernel, |
155 SkScalar gain, | 155 SkScalar gain, |
156 SkScalar bias, | 156 SkScalar bias, |
157 const SkIPoint& kernelOffse
t, | 157 const SkIPoint& kernelOffse
t, |
158 GrTextureDomain::Mode tileM
ode, | 158 GrTextureDomain::Mode tileM
ode, |
159 bool convolveAlpha) | 159 bool convolveAlpha) |
160 : INHERITED(texture, MakeDivByTextureWHMatrix(texture)), | 160 : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)), |
161 fKernelSize(kernelSize), | 161 fKernelSize(kernelSize), |
162 fGain(SkScalarToFloat(gain)), | 162 fGain(SkScalarToFloat(gain)), |
163 fBias(SkScalarToFloat(bias) / 255.0f), | 163 fBias(SkScalarToFloat(bias) / 255.0f), |
164 fConvolveAlpha(convolveAlpha), | 164 fConvolveAlpha(convolveAlpha), |
165 fDomain(GrTextureDomain::MakeTexelDomain(texture, bounds), tileMode) { | 165 fDomain(GrTextureDomain::MakeTexelDomain(texture, bounds), tileMode) { |
166 for (int i = 0; i < kernelSize.width() * kernelSize.height(); i++) { | 166 for (int i = 0; i < kernelSize.width() * kernelSize.height(); i++) { |
167 fKernel[i] = SkScalarToFloat(kernel[i]); | 167 fKernel[i] = SkScalarToFloat(kernel[i]); |
168 } | 168 } |
169 fKernelOffset[0] = static_cast<float>(kernelOffset.x()); | 169 fKernelOffset[0] = static_cast<float>(kernelOffset.x()); |
170 fKernelOffset[1] = static_cast<float>(kernelOffset.y()); | 170 fKernelOffset[1] = static_cast<float>(kernelOffset.y()); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 return GrMatrixConvolutionEffect::Create(textures[texIdx], | 266 return GrMatrixConvolutionEffect::Create(textures[texIdx], |
267 bounds, | 267 bounds, |
268 kernelSize, | 268 kernelSize, |
269 kernel.get(), | 269 kernel.get(), |
270 gain, | 270 gain, |
271 bias, | 271 bias, |
272 kernelOffset, | 272 kernelOffset, |
273 tileMode, | 273 tileMode, |
274 convolveAlpha); | 274 convolveAlpha); |
275 } | 275 } |
OLD | NEW |