Clamp GrSkSLFP output to valid premul
Added this as an option to GrSaturateProcessor (also renamed it to
be more generic and end with FragmentProcessor).
Added a tweak to the unit test to check the new behavior.
(Raster was already doing the clamp).
Change-Id: Ic49fa5cd72b6c63430fb773baf8121546bf2b80d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/265580
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index c31407a..6982cdc 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -155,9 +155,9 @@
TestEffect pickColor(r, "in int flag; uniform half4 gColors[2];", "color = gColors[flag];");
pickColor["gColors"] =
- std::array<float4, 2>{float4{1.0f, 0.0f, 0.0f, 1.0f}, float4{0.0f, 1.0f, 0.0f, 1.0f}};
+ std::array<float4, 2>{float4{1.0f, 0.0f, 0.0f, 0.498f}, float4{0.0f, 1.0f, 0.0f, 1.0f}};
pickColor["flag"] = 0;
- pickColor.test(r, surface, 0xFF0000FF);
+ pickColor.test(r, surface, 0x7F00007F); // Tests that we clamp to valid premul
pickColor["flag"] = 1;
pickColor.test(r, surface, 0xFF00FF00);
}