diff options
author | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-29 23:41:28 +0000 |
---|---|---|
committer | senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-29 23:41:28 +0000 |
commit | 1afa3fff2987e3f4ea4383477467a13be78bc210 (patch) | |
tree | e4af6a6a320b17cb0149f28670e9f55769e439cb | |
parent | 137f1347abaf0bb6a945e91c2f6cb49f0ee69bc3 (diff) |
Speculative fix for Tegra-based Androids: don't try to unpremultiply dstColor in-place; put it in a temporary.
TBR=bsalomon
Review URL: https://codereview.chromium.org/16214002
git-svn-id: http://skia.googlecode.com/svn/trunk@9336 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/effects/SkArithmeticMode.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp index fc81191c0e..1d06264877 100644 --- a/src/effects/SkArithmeticMode.cpp +++ b/src/effects/SkArithmeticMode.cpp @@ -328,19 +328,18 @@ void GrGLArithmeticEffect::emitCode(GrGLShaderBuilder* builder, kVec4f_GrSLType, "k"); const char* kUni = builder->getUniformCStr(fKUni); - const char* srcColor = "srcColor"; - // We don't try to optimize for this case at all if (NULL == inputColor) { - builder->fsCodeAppendf("\t\tconst vec4 srcColor = %s;\n", GrGLSLOnesVecf(4)); + builder->fsCodeAppendf("\t\tconst vec4 src = %s;\n", GrGLSLOnesVecf(4)); } else { - builder->fsCodeAppendf("\t\tvec4 srcColor = %s;\n", inputColor); - builder->fsCodeAppendf("\t\tsrcColor.rgb = clamp(srcColor.rgb / srcColor.a, 0.0, 1.0);\n"); + builder->fsCodeAppendf("\t\tvec4 src = %s;\n", inputColor); + builder->fsCodeAppendf("\t\tsrc.rgb = clamp(src.rgb / src.a, 0.0, 1.0);\n"); } - builder->fsCodeAppendf("\t\t%s.rgb = clamp(%s.rgb / %s.a, 0.0, 1.0);\n", dstColor, dstColor, dstColor); + builder->fsCodeAppendf("\t\tvec4 dst = %s;\n", dstColor); + builder->fsCodeAppendf("\t\tdst.rgb = clamp(dst.rgb / dst.a, 0.0, 1.0);\n"); - builder->fsCodeAppendf("\t\t%s = %s.x * %s * %s + %s.y * %s + %s.z * %s + %s.w;\n", outputColor, kUni, srcColor, dstColor, kUni, srcColor, kUni, dstColor, kUni); + builder->fsCodeAppendf("\t\t%s = %s.x * src * dst + %s.y * src + %s.z * dst + %s.w;\n", outputColor, kUni, kUni, kUni, kUni); builder->fsCodeAppendf("\t\t%s = clamp(%s, 0.0, 1.0);\n", outputColor, outputColor); builder->fsCodeAppendf("\t\t%s.rgb *= %s.a;\n", outputColor, outputColor); } |