Index: src/effects/SkTableColorFilter.cpp |
=================================================================== |
--- src/effects/SkTableColorFilter.cpp (revision 8005) |
+++ src/effects/SkTableColorFilter.cpp (working copy) |
@@ -289,39 +289,38 @@ |
static const float kColorScaleFactor = 255.0f / 256.0f; |
static const float kColorOffsetFactor = 1.0f / 512.0f; |
- SkString* code = &builder->fFSCode; |
if (NULL == inputColor) { |
// the input color is solid white (all ones). |
static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor; |
- code->appendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n", |
- kMaxValue, kMaxValue, kMaxValue, kMaxValue); |
+ builder->fsCodeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n", |
+ kMaxValue, kMaxValue, kMaxValue, kMaxValue); |
} else { |
- code->appendf("\t\tfloat nonZeroAlpha = max(%s.a, .0001);\n", inputColor); |
- code->appendf("\t\tvec4 coord = vec4(%s.rgb / nonZeroAlpha, nonZeroAlpha);\n", inputColor); |
- code->appendf("\t\tcoord = coord * %f + vec4(%f, %f, %f, %f);\n", |
- kColorScaleFactor, |
- kColorOffsetFactor, kColorOffsetFactor, |
- kColorOffsetFactor, kColorOffsetFactor); |
+ builder->fsCodeAppendf("\t\tfloat nonZeroAlpha = max(%s.a, .0001);\n", inputColor); |
+ builder->fsCodeAppendf("\t\tvec4 coord = vec4(%s.rgb / nonZeroAlpha, nonZeroAlpha);\n", inputColor); |
+ builder->fsCodeAppendf("\t\tcoord = coord * %f + vec4(%f, %f, %f, %f);\n", |
+ kColorScaleFactor, |
+ kColorOffsetFactor, kColorOffsetFactor, |
+ kColorOffsetFactor, kColorOffsetFactor); |
} |
- code->appendf("\t\t%s.a = ", outputColor); |
- builder->appendTextureLookup(code, samplers[0], "vec2(coord.a, 0.125)"); |
- code->append(";\n"); |
+ builder->fsCodeAppendf("\t\t%s.a = ", outputColor); |
+ builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, samplers[0], "vec2(coord.a, 0.125)"); |
+ builder->fsCodeAppend(";\n"); |
- code->appendf("\t\t%s.r = ", outputColor); |
- builder->appendTextureLookup(code, samplers[0], "vec2(coord.r, 0.375)"); |
- code->append(";\n"); |
+ builder->fsCodeAppendf("\t\t%s.r = ", outputColor); |
+ builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, samplers[0], "vec2(coord.r, 0.375)"); |
+ builder->fsCodeAppend(";\n"); |
- code->appendf("\t\t%s.g = ", outputColor); |
- builder->appendTextureLookup(code, samplers[0], "vec2(coord.g, 0.625)"); |
- code->append(";\n"); |
+ builder->fsCodeAppendf("\t\t%s.g = ", outputColor); |
+ builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, samplers[0], "vec2(coord.g, 0.625)"); |
+ builder->fsCodeAppend(";\n"); |
- code->appendf("\t\t%s.b = ", outputColor); |
- builder->appendTextureLookup(code, samplers[0], "vec2(coord.b, 0.875)"); |
- code->append(";\n"); |
+ builder->fsCodeAppendf("\t\t%s.b = ", outputColor); |
+ builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, samplers[0], "vec2(coord.b, 0.875)"); |
+ builder->fsCodeAppend(";\n"); |
- code->appendf("\t\t%s.rgb *= %s.a;\n", outputColor, outputColor); |
+ builder->fsCodeAppendf("\t\t%s.rgb *= %s.a;\n", outputColor, outputColor); |
} |
GrGLEffect::EffectKey GLColorTableEffect::GenKey(const GrEffectStage&, const GrGLCaps&) { |