| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 SkString coord; | 92 SkString coord; |
| 93 coord.printf("coord + %s * vec2(%d, %d)", imgInc, x - 1, y - 1); | 93 coord.printf("coord + %s * vec2(%d, %d)", imgInc, x - 1, y - 1); |
| 94 SkString sampleVar; | 94 SkString sampleVar; |
| 95 sampleVar.printf("rowColors[%d]", x); | 95 sampleVar.printf("rowColors[%d]", x); |
| 96 fDomain.sampleTexture(fragBuilder, | 96 fDomain.sampleTexture(fragBuilder, |
| 97 args.fUniformHandler, | 97 args.fUniformHandler, |
| 98 args.fGLSLCaps, | 98 args.fGLSLCaps, |
| 99 domain, | 99 domain, |
| 100 sampleVar.c_str(), | 100 sampleVar.c_str(), |
| 101 coord, | 101 coord, |
| 102 args.fTexSamplers[0]); | 102 uniformHandler->getSampler(args.fTexSamplers[0
])); |
| 103 } | 103 } |
| 104 fragBuilder->codeAppendf( | 104 fragBuilder->codeAppendf( |
| 105 "\tvec4 s%d = %s(%s, f.x, rowColors[0], rowColors[1], rowColors[2],
rowColors[3]);\n", | 105 "\tvec4 s%d = %s(%s, f.x, rowColors[0], rowColors[1], rowColors[2],
rowColors[3]);\n", |
| 106 y, cubicBlendName.c_str(), coeff); | 106 y, cubicBlendName.c_str(), coeff); |
| 107 } | 107 } |
| 108 SkString bicubicColor; | 108 SkString bicubicColor; |
| 109 bicubicColor.printf("%s(%s, f.y, s0, s1, s2, s3)", cubicBlendName.c_str(), c
oeff); | 109 bicubicColor.printf("%s(%s, f.y, s0, s1, s2, s3)", cubicBlendName.c_str(), c
oeff); |
| 110 fragBuilder->codeAppendf("\t%s = %s;\n", | 110 fragBuilder->codeAppendf("\t%s = %s;\n", |
| 111 args.fOutputColor, (GrGLSLExpr4(bicubicColor.c_str(
)) * | 111 args.fOutputColor, (GrGLSLExpr4(bicubicColor.c_str(
)) * |
| 112 GrGLSLExpr4(args.fInputColor)).
c_str()); | 112 GrGLSLExpr4(args.fInputColor)).
c_str()); |
| (...skipping 101 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 |