Revert "added support for SkSL unpremul function"
This reverts commit ffdc3e668061cff14ea55ba087e9105f2ff219fc.
Reason for revert: breaking Chrome roll
Original change's description:
> added support for SkSL unpremul function
>
> Change-Id: I970f1ad0dd0859448c874498fe02342f8abc3aa3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/242897
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
TBR=bsalomon@google.com,brianosman@google.com,ethannicholas@google.com
Change-Id: I72dacea82b1f4ea2aa6cd600122a4810657aa32e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/243117
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
diff --git a/src/gpu/glsl/GrGLSLShaderBuilder.cpp b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
index a75479d..a87d591 100644
--- a/src/gpu/glsl/GrGLSLShaderBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLShaderBuilder.cpp
@@ -159,7 +159,8 @@
const GrShaderVar gColorXformArgs[] = { GrShaderVar("color", kHalf4_GrSLType) };
SkString body;
if (colorXformHelper->applyUnpremul()) {
- body.append("color = unpremul(color);");
+ body.append("half nonZeroAlpha = max(color.a, 0.0001);");
+ body.append("color = half4(color.rgb / nonZeroAlpha, nonZeroAlpha);");
}
if (colorXformHelper->applySrcTF()) {
body.appendf("color.r = %s(color.r);", srcTFFuncName.c_str());