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

Unified Diff: cc/output/shader.cc

Issue 639773010: Prevent division by 0 in set_luminance shader function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjusting test error values Created 6 years, 2 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 | cc/trees/layer_tree_host_pixeltest_blending.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/shader.cc
diff --git a/cc/output/shader.cc b/cc/output/shader.cc
index b2d76a7e02e770b3f1da95f2abd5873ef70a4092..354f65f67b92ffb17447b9219c7b9c6102d2ed8e 100644
--- a/cc/output/shader.cc
+++ b/cc/output/shader.cc
@@ -804,12 +804,12 @@ std::string FragmentTexBlendMode::GetHelperFunctions() const {
float outLum = luminance(outColor);
float minComp = min(min(outColor.r, outColor.g), outColor.b);
float maxComp = max(max(outColor.r, outColor.g), outColor.b);
- if (minComp < 0.0) {
+ if (minComp < 0.0 && outLum != minComp) {
outColor = outLum +
((outColor - vec3(outLum, outLum, outLum)) * outLum) /
(outLum - minComp);
}
- if (maxComp > alpha) {
+ if (maxComp > alpha && maxComp != outLum) {
outColor =
outLum +
((outColor - vec3(outLum, outLum, outLum)) * (alpha - outLum)) /
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_pixeltest_blending.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698