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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 SkString modulate; | 107 SkString modulate; |
108 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); | 108 GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor); |
109 fragBuilder->codeAppend(modulate.c_str()); | 109 fragBuilder->codeAppend(modulate.c_str()); |
110 } | 110 } |
111 | 111 |
112 void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor, | 112 void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor, |
113 const GrGLSLCaps&, GrProcessorKeyBuilde
r* b) { | 113 const GrGLSLCaps&, GrProcessorKeyBuilde
r* b) { |
114 const GrMatrixConvolutionEffect& m = processor.cast<GrMatrixConvolutionEffec
t>(); | 114 const GrMatrixConvolutionEffect& m = processor.cast<GrMatrixConvolutionEffec
t>(); |
115 SkASSERT(m.kernelSize().width() <= 0x7FFF && m.kernelSize().height() <= 0xFF
FF); | 115 SkASSERT(m.kernelSize().width() <= 0x7FFF && m.kernelSize().height() <= 0xFF
FF); |
116 uint32_t key = m.kernelSize().width() << 16 | m.kernelSize().height(); | 116 uint32_t key = m.kernelSize().width() << 16 | m.kernelSize().height(); |
117 key |= m.convolveAlpha() ? 1 << 31 : 0; | 117 key |= m.convolveAlpha() ? 1U << 31 : 0; |
118 b->add32(key); | 118 b->add32(key); |
119 b->add32(GrTextureDomain::GLDomain::DomainKey(m.domain())); | 119 b->add32(GrTextureDomain::GLDomain::DomainKey(m.domain())); |
120 } | 120 } |
121 | 121 |
122 void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdma
n, | 122 void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdma
n, |
123 const GrProcessor& processor) { | 123 const GrProcessor& processor) { |
124 const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEf
fect>(); | 124 const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEf
fect>(); |
125 GrTexture& texture = *conv.texture(0); | 125 GrTexture& texture = *conv.texture(0); |
126 | 126 |
127 float imageIncrement[2]; | 127 float imageIncrement[2]; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx], | 248 return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx], |
249 bounds, | 249 bounds, |
250 kernelSize, | 250 kernelSize, |
251 kernel.get(), | 251 kernel.get(), |
252 gain, | 252 gain, |
253 bias, | 253 bias, |
254 kernelOffset, | 254 kernelOffset, |
255 tileMode, | 255 tileMode, |
256 convolveAlpha); | 256 convolveAlpha); |
257 } | 257 } |
OLD | NEW |