Tweak gradient shader code to avoid hangs on Tegra3
Bug: skia:
Change-Id: I07d638d5f7b399d279f445c8f2b490ea55414e2f
Reviewed-on: https://skia-review.googlesource.com/64101
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index ddff2c2..8e24919 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -1251,8 +1251,9 @@
}
// If the input colors were floats, or there was a color space xform, we may end up out of
- // range. The simplest solution is to always clamp our (premul) value here.
- fragBuilder->codeAppend("colorTemp.rgb = clamp(colorTemp.rgb, 0, colorTemp.a);");
+ // range. The simplest solution is to always clamp our (premul) value here. We only need to
+ // clamp RGB, but that causes hangs on the Tegra3 Nexus7. Clamping RGBA avoids the problem.
+ fragBuilder->codeAppend("colorTemp = clamp(colorTemp, 0, colorTemp.a);");
fragBuilder->codeAppendf("%s = %s * colorTemp;", outputColor, inputColor);
}