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 "GrMatrixConvolutionEffect.h" | 7 #include "GrMatrixConvolutionEffect.h" |
8 #include "glsl/GrGLSLFragmentProcessor.h" | 8 #include "glsl/GrGLSLFragmentProcessor.h" |
9 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 9 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
10 #include "glsl/GrGLSLProgramDataManager.h" | 10 #include "glsl/GrGLSLProgramDataManager.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture, | 149 GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture, |
150 const SkIRect& bounds, | 150 const SkIRect& bounds, |
151 const SkISize& kernelSize, | 151 const SkISize& kernelSize, |
152 const SkScalar* kernel, | 152 const SkScalar* kernel, |
153 SkScalar gain, | 153 SkScalar gain, |
154 SkScalar bias, | 154 SkScalar bias, |
155 const SkIPoint& kernelOffse
t, | 155 const SkIPoint& kernelOffse
t, |
156 GrTextureDomain::Mode tileM
ode, | 156 GrTextureDomain::Mode tileM
ode, |
157 bool convolveAlpha) | 157 bool convolveAlpha) |
158 : INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)), | 158 : INHERITED(texture, nullptr, GrCoordTransform::MakeDivByTextureWHMatrix(textu
re)), |
159 fKernelSize(kernelSize), | 159 fKernelSize(kernelSize), |
160 fGain(SkScalarToFloat(gain)), | 160 fGain(SkScalarToFloat(gain)), |
161 fBias(SkScalarToFloat(bias) / 255.0f), | 161 fBias(SkScalarToFloat(bias) / 255.0f), |
162 fConvolveAlpha(convolveAlpha), | 162 fConvolveAlpha(convolveAlpha), |
163 fDomain(GrTextureDomain::MakeTexelDomainForMode(texture, bounds, tileMode),
tileMode) { | 163 fDomain(GrTextureDomain::MakeTexelDomainForMode(texture, bounds, tileMode),
tileMode) { |
164 this->initClassID<GrMatrixConvolutionEffect>(); | 164 this->initClassID<GrMatrixConvolutionEffect>(); |
165 for (int i = 0; i < kernelSize.width() * kernelSize.height(); i++) { | 165 for (int i = 0; i < kernelSize.width() * kernelSize.height(); i++) { |
166 fKernel[i] = SkScalarToFloat(kernel[i]); | 166 fKernel[i] = SkScalarToFloat(kernel[i]); |
167 } | 167 } |
168 fKernelOffset[0] = static_cast<float>(kernelOffset.x()); | 168 fKernelOffset[0] = static_cast<float>(kernelOffset.x()); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return GrMatrixConvolutionEffect::Make(d->fTextures[texIdx], | 259 return GrMatrixConvolutionEffect::Make(d->fTextures[texIdx], |
260 bounds, | 260 bounds, |
261 kernelSize, | 261 kernelSize, |
262 kernel.get(), | 262 kernel.get(), |
263 gain, | 263 gain, |
264 bias, | 264 bias, |
265 kernelOffset, | 265 kernelOffset, |
266 tileMode, | 266 tileMode, |
267 convolveAlpha); | 267 convolveAlpha); |
268 } | 268 } |
OLD | NEW |