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 | 7 |
8 #include "GrBicubicEffect.h" | 8 #include "GrBicubicEffect.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 10 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 UniformHandle fImageIncrementUni; | 41 UniformHandle fImageIncrementUni; |
42 GrTextureDomain::GLDomain fDomain; | 42 GrTextureDomain::GLDomain fDomain; |
43 | 43 |
44 typedef GrGLSLFragmentProcessor INHERITED; | 44 typedef GrGLSLFragmentProcessor INHERITED; |
45 }; | 45 }; |
46 | 46 |
47 void GrGLBicubicEffect::emitCode(EmitArgs& args) { | 47 void GrGLBicubicEffect::emitCode(EmitArgs& args) { |
48 const GrTextureDomain& domain = args.fFp.cast<GrBicubicEffect>().domain(); | 48 const GrTextureDomain& domain = args.fFp.cast<GrBicubicEffect>().domain(); |
49 | 49 |
50 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; | 50 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
51 fCoefficientsUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragmen
t_Visibility, | 51 fCoefficientsUni = uniformHandler->addUniform(kFragment_GrShaderFlag, |
52 kMat44f_GrSLType, kDefault_GrS
LPrecision, | 52 kMat44f_GrSLType, kDefault_GrS
LPrecision, |
53 "Coefficients"); | 53 "Coefficients"); |
54 fImageIncrementUni = uniformHandler->addUniform(GrGLSLUniformHandler::kFragm
ent_Visibility, | 54 fImageIncrementUni = uniformHandler->addUniform(kFragment_GrShaderFlag, |
55 kVec2f_GrSLType, kDefault_Gr
SLPrecision, | 55 kVec2f_GrSLType, kDefault_Gr
SLPrecision, |
56 "ImageIncrement"); | 56 "ImageIncrement"); |
57 | 57 |
58 const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni); | 58 const char* imgInc = uniformHandler->getUniformCStr(fImageIncrementUni); |
59 const char* coeff = uniformHandler->getUniformCStr(fCoefficientsUni); | 59 const char* coeff = uniformHandler->getUniformCStr(fCoefficientsUni); |
60 | 60 |
61 SkString cubicBlendName; | 61 SkString cubicBlendName; |
62 | 62 |
63 static const GrGLSLShaderVar gCubicBlendArgs[] = { | 63 static const GrGLSLShaderVar gCubicBlendArgs[] = { |
64 GrGLSLShaderVar("coefficients", kMat44f_GrSLType), | 64 GrGLSLShaderVar("coefficients", kMat44f_GrSLType), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Use bilerp to handle rotation or fractional translation. | 214 // Use bilerp to handle rotation or fractional translation. |
215 *filterMode = GrTextureParams::kBilerp_FilterMode; | 215 *filterMode = GrTextureParams::kBilerp_FilterMode; |
216 } | 216 } |
217 return false; | 217 return false; |
218 } | 218 } |
219 // When we use the bicubic filtering effect each sample is read from the tex
ture using | 219 // When we use the bicubic filtering effect each sample is read from the tex
ture using |
220 // nearest neighbor sampling. | 220 // nearest neighbor sampling. |
221 *filterMode = GrTextureParams::kNone_FilterMode; | 221 *filterMode = GrTextureParams::kNone_FilterMode; |
222 return true; | 222 return true; |
223 } | 223 } |
OLD | NEW |