| 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/GrGLSLProgramBuilder.h" | 9 #include "glsl/GrGLSLProgramBuilder.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 for (int i = 0; i < kernelSize.width() * kernelSize.height(); i++) { | 148 for (int i = 0; i < kernelSize.width() * kernelSize.height(); i++) { |
| 149 fKernel[i] = SkScalarToFloat(kernel[i]); | 149 fKernel[i] = SkScalarToFloat(kernel[i]); |
| 150 } | 150 } |
| 151 fKernelOffset[0] = static_cast<float>(kernelOffset.x()); | 151 fKernelOffset[0] = static_cast<float>(kernelOffset.x()); |
| 152 fKernelOffset[1] = static_cast<float>(kernelOffset.y()); | 152 fKernelOffset[1] = static_cast<float>(kernelOffset.y()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 GrMatrixConvolutionEffect::~GrMatrixConvolutionEffect() { | 155 GrMatrixConvolutionEffect::~GrMatrixConvolutionEffect() { |
| 156 } | 156 } |
| 157 | 157 |
| 158 void GrMatrixConvolutionEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, | 158 void GrMatrixConvolutionEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, |
| 159 GrProcessorKeyBuilder* b) cons
t { | 159 GrProcessorKeyBuilder* b)
const { |
| 160 GrGLMatrixConvolutionEffect::GenKey(*this, caps, b); | 160 GrGLMatrixConvolutionEffect::GenKey(*this, caps, b); |
| 161 } | 161 } |
| 162 | 162 |
| 163 GrGLSLFragmentProcessor* GrMatrixConvolutionEffect::onCreateGLInstance() const
{ | 163 GrGLSLFragmentProcessor* GrMatrixConvolutionEffect::onCreateGLSLInstance() const
{ |
| 164 return new GrGLMatrixConvolutionEffect(*this); | 164 return new GrGLMatrixConvolutionEffect(*this); |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool GrMatrixConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) cons
t { | 167 bool GrMatrixConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) cons
t { |
| 168 const GrMatrixConvolutionEffect& s = sBase.cast<GrMatrixConvolutionEffect>()
; | 168 const GrMatrixConvolutionEffect& s = sBase.cast<GrMatrixConvolutionEffect>()
; |
| 169 return fKernelSize == s.kernelSize() && | 169 return fKernelSize == s.kernelSize() && |
| 170 !memcmp(fKernel, s.kernel(), | 170 !memcmp(fKernel, s.kernel(), |
| 171 fKernelSize.width() * fKernelSize.height() * sizeof(float)) &
& | 171 fKernelSize.width() * fKernelSize.height() * sizeof(float)) &
& |
| 172 fGain == s.gain() && | 172 fGain == s.gain() && |
| 173 fBias == s.bias() && | 173 fBias == s.bias() && |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx], | 244 return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx], |
| 245 bounds, | 245 bounds, |
| 246 kernelSize, | 246 kernelSize, |
| 247 kernel.get(), | 247 kernel.get(), |
| 248 gain, | 248 gain, |
| 249 bias, | 249 bias, |
| 250 kernelOffset, | 250 kernelOffset, |
| 251 tileMode, | 251 tileMode, |
| 252 convolveAlpha); | 252 convolveAlpha); |
| 253 } | 253 } |
| OLD | NEW |