Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: src/effects/SkArithmeticMode.cpp

Issue 16214002: Speculative fix for Tegra-based Androids: don't try to unpremultiply dstColor in-place; put it in a… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkArithmeticMode.cpp
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index fc81191c0e6e0b6abef2f264c0412a3b97cc20e8..1d062648774da53ff0f06214a6035458bb423333 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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698