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

Unified Diff: src/core/SkXfermode.cpp

Issue 666043003: Preventing division by 0 in non-separable blend mode shaders. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adding myself to AUTHORS Created 6 years, 1 month 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 | « gm/mixedxfermodes.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermode.cpp
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 0cc120dfa7db2104edd36c0240ba55b74c9b99c4..6d893a426d13e9b5d7edddd1b9c707ee7f02a071 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -1100,10 +1100,10 @@ public:
setLumBody.appendf("\tfloat outLum = %s(outColor);\n", getFunction.c_str());
setLumBody.append("\tfloat minComp = min(min(outColor.r, outColor.g), outColor.b);\n"
"\tfloat maxComp = max(max(outColor.r, outColor.g), outColor.b);\n"
- "\tif (minComp < 0.0) {\n"
+ "\tif (minComp < 0.0 && outLum != minComp) {\n"
"\t\toutColor = outLum + ((outColor - vec3(outLum, outLum, outLum)) * outLum) / (outLum - minComp);\n"
"\t}\n"
- "\tif (maxComp > alpha) {\n"
+ "\tif (maxComp > alpha && maxComp != outLum) {\n"
"\t\toutColor = outLum + ((outColor - vec3(outLum, outLum, outLum)) * (alpha - outLum)) / (maxComp - outLum);\n"
"\t}\n"
"\treturn outColor;\n");
« no previous file with comments | « gm/mixedxfermodes.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698