| Index: src/effects/SkTableColorFilter.cpp
|
| diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
|
| index 083b54c4886691a9c3f7663e0e702533c2de1839..5bbe64f29f59e0578fbbbce7ecbe096acbb9214b 100644
|
| --- a/src/effects/SkTableColorFilter.cpp
|
| +++ b/src/effects/SkTableColorFilter.cpp
|
| @@ -271,7 +271,7 @@ public:
|
| const GrDrawEffect&,
|
| EffectKey,
|
| const char* outputColor,
|
| - const char* inputColor,
|
| + const GrGLSLExpr4& inputColor,
|
| const TransformedCoordsArray&,
|
| const TextureSamplerArray&) SK_OVERRIDE;
|
|
|
| @@ -292,21 +292,21 @@ void GLColorTableEffect::emitCode(GrGLShaderBuilder* builder,
|
| const GrDrawEffect&,
|
| EffectKey,
|
| const char* outputColor,
|
| - const char* inputColor,
|
| + const GrGLSLExpr4& inputColor,
|
| const TransformedCoordsArray&,
|
| const TextureSamplerArray& samplers) {
|
|
|
| static const float kColorScaleFactor = 255.0f / 256.0f;
|
| static const float kColorOffsetFactor = 1.0f / 512.0f;
|
| - if (NULL == inputColor) {
|
| + if (inputColor.isOnes()) {
|
| // the input color is solid white (all ones).
|
| static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor;
|
| builder->fsCodeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n",
|
| kMaxValue, kMaxValue, kMaxValue, kMaxValue);
|
|
|
| } else {
|
| - 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\tfloat nonZeroAlpha = %s;\n", GrGLSL::max(inputColor.a(), 0.0001f).c_str());
|
| + builder->fsCodeAppendf("\t\tvec4 coord = vec4(%s.rgb / nonZeroAlpha, nonZeroAlpha);\n", inputColor.c_str());
|
| builder->fsCodeAppendf("\t\tcoord = coord * %f + vec4(%f, %f, %f, %f);\n",
|
| kColorScaleFactor,
|
| kColorOffsetFactor, kColorOffsetFactor,
|
|
|