| 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 #include "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
| 9 #include "GrConvolutionEffect.h" | 9 #include "GrConvolutionEffect.h" |
| 10 #include "gl/GrGLProcessor.h" | 10 #include "gl/GrGLProcessor.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const char* bounds = builder->getUniformCStr(fBoundsUni); | 94 const char* bounds = builder->getUniformCStr(fBoundsUni); |
| 95 const char* component = this->direction() == Gr1DKernelEffect::kY_Di
rection ? "y" : "x"; | 95 const char* component = this->direction() == Gr1DKernelEffect::kY_Di
rection ? "y" : "x"; |
| 96 fsBuilder->codeAppendf(" * float(coord.%s >= %s.x && coord.%s <= %s.
y)", | 96 fsBuilder->codeAppendf(" * float(coord.%s >= %s.x && coord.%s <= %s.
y)", |
| 97 component, bounds, component, bounds); | 97 component, bounds, component, bounds); |
| 98 } | 98 } |
| 99 fsBuilder->codeAppendf(" * %s;\n", kernelIndex.c_str()); | 99 fsBuilder->codeAppendf(" * %s;\n", kernelIndex.c_str()); |
| 100 fsBuilder->codeAppendf("\t\tcoord += %s;\n", imgInc); | 100 fsBuilder->codeAppendf("\t\tcoord += %s;\n", imgInc); |
| 101 } | 101 } |
| 102 | 102 |
| 103 SkString modulate; | 103 SkString modulate; |
| 104 GrGLSLMulVarBy4f(&modulate, 2, outputColor, inputColor); | 104 GrGLSLMulVarBy4f(&modulate, outputColor, inputColor); |
| 105 fsBuilder->codeAppend(modulate.c_str()); | 105 fsBuilder->codeAppend(modulate.c_str()); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void GrGLConvolutionEffect::setData(const GrGLProgramDataManager& pdman, | 108 void GrGLConvolutionEffect::setData(const GrGLProgramDataManager& pdman, |
| 109 const GrProcessor& processor) { | 109 const GrProcessor& processor) { |
| 110 const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>(); | 110 const GrConvolutionEffect& conv = processor.cast<GrConvolutionEffect>(); |
| 111 GrTexture& texture = *conv.texture(0); | 111 GrTexture& texture = *conv.texture(0); |
| 112 // the code we generated was for a specific kernel radius | 112 // the code we generated was for a specific kernel radius |
| 113 SkASSERT(conv.radius() == fRadius); | 113 SkASSERT(conv.radius() == fRadius); |
| 114 float imageIncrement[2] = { 0 }; | 114 float imageIncrement[2] = { 0 }; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 bool useBounds = random->nextBool(); | 234 bool useBounds = random->nextBool(); |
| 235 return GrConvolutionEffect::Create(textures[texIdx], | 235 return GrConvolutionEffect::Create(textures[texIdx], |
| 236 dir, | 236 dir, |
| 237 radius, | 237 radius, |
| 238 kernel, | 238 kernel, |
| 239 useBounds, | 239 useBounds, |
| 240 bounds); | 240 bounds); |
| 241 } | 241 } |
| OLD | NEW |