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 "gl/builders/GrGLProgramBuilder.h" | 10 #include "gl/builders/GrGLProgramBuilder.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder, | 54 void GrGLBicubicEffect::emitCode(GrGLFPBuilder* builder, |
55 const GrFragmentProcessor& effect, | 55 const GrFragmentProcessor& effect, |
56 const char* outputColor, | 56 const char* outputColor, |
57 const char* inputColor, | 57 const char* inputColor, |
58 const TransformedCoordsArray& coords, | 58 const TransformedCoordsArray& coords, |
59 const TextureSamplerArray& samplers) { | 59 const TextureSamplerArray& samplers) { |
60 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain(); | 60 const GrTextureDomain& domain = effect.cast<GrBicubicEffect>().domain(); |
61 | 61 |
62 fCoefficientsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibil
ity, | 62 fCoefficientsUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibil
ity, |
63 kMat44f_GrSLType, "Coefficients"); | 63 kMat44f_GrSLType, kDefault_GrSLPrecis
ion, |
| 64 "Coefficients"); |
64 fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, | 65 fImageIncrementUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, |
65 kVec2f_GrSLType, "ImageIncrement"); | 66 kVec2f_GrSLType, kDefault_GrSLPreci
sion, |
| 67 "ImageIncrement"); |
66 | 68 |
67 const char* imgInc = builder->getUniformCStr(fImageIncrementUni); | 69 const char* imgInc = builder->getUniformCStr(fImageIncrementUni); |
68 const char* coeff = builder->getUniformCStr(fCoefficientsUni); | 70 const char* coeff = builder->getUniformCStr(fCoefficientsUni); |
69 | 71 |
70 SkString cubicBlendName; | 72 SkString cubicBlendName; |
71 | 73 |
72 static const GrGLShaderVar gCubicBlendArgs[] = { | 74 static const GrGLShaderVar gCubicBlendArgs[] = { |
73 GrGLShaderVar("coefficients", kMat44f_GrSLType), | 75 GrGLShaderVar("coefficients", kMat44f_GrSLType), |
74 GrGLShaderVar("t", kFloat_GrSLType), | 76 GrGLShaderVar("t", kFloat_GrSLType), |
75 GrGLShaderVar("c0", kVec4f_GrSLType), | 77 GrGLShaderVar("c0", kVec4f_GrSLType), |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // Use bilerp to handle rotation or fractional translation. | 218 // Use bilerp to handle rotation or fractional translation. |
217 *filterMode = GrTextureParams::kBilerp_FilterMode; | 219 *filterMode = GrTextureParams::kBilerp_FilterMode; |
218 } | 220 } |
219 return false; | 221 return false; |
220 } | 222 } |
221 // When we use the bicubic filtering effect each sample is read from the tex
ture using | 223 // When we use the bicubic filtering effect each sample is read from the tex
ture using |
222 // nearest neighbor sampling. | 224 // nearest neighbor sampling. |
223 *filterMode = GrTextureParams::kNone_FilterMode; | 225 *filterMode = GrTextureParams::kNone_FilterMode; |
224 return true; | 226 return true; |
225 } | 227 } |
OLD | NEW |