Remove all clamping to "valid" premultiplied colors
Previously, we were abundantly cautious about producing premultiplied
colors with RGB > A, when the color-type was normalized fixed-point.
I'm not seeing any evidence that code cares about that. If it does, I
suggest we fix the issue at the API border, or via dedicated pass. In
the common case, this makes Skia less opinionated, which (in general)
makes it more versatile.
Change-Id: Iae524ff61f6c81073c34d0f2dced973c229cdfb7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/452558
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index 428af17..7fac5ee 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -439,14 +439,14 @@
effect.uniform("gColor") = float4{ 0.0f, 0.25f, 0.75f, 1.0f };
effect.test(0xFFBF4000);
effect.uniform("gColor") = float4{ 1.0f, 0.0f, 0.0f, 0.498f };
- effect.test(0x7F00007F); // Tests that we clamp to valid premul
+ effect.test(0x7F0000FF); // Tests that we don't clamp to valid premul
// Same, with integer uniforms
effect.build("uniform int4 gColor; half4 main(float2 p) { return half4(gColor) / 255.0; }");
effect.uniform("gColor") = int4{ 0x00, 0x40, 0xBF, 0xFF };
effect.test(0xFFBF4000);
effect.uniform("gColor") = int4{ 0xFF, 0x00, 0x00, 0x7F };
- effect.test(0x7F00007F); // Tests that we clamp to valid premul
+ effect.test(0x7F0000FF); // Tests that we don't clamp to valid premul
// Test sk_FragCoord (device coords). Rotate the canvas to be sure we're seeing device coords.
// Since the surface is 2x2, we should see (0,0), (1,0), (0,1), (1,1). Multiply by 0.498 to
@@ -540,7 +540,7 @@
effect.uniform("gColor") = float4{ 0.0f, 0.25f, 0.75f, 1.0f };
effect.test(0xFFBF4000);
effect.uniform("gColor") = float4{ 1.0f, 0.0f, 0.0f, 0.498f };
- effect.test(0x7F0000FF); // Unlike SkShaders, we don't clamp here
+ effect.test(0x7F0000FF); // We don't clamp here either
// Same, with integer uniforms
effect.build("uniform int4 gColor;"
@@ -548,7 +548,7 @@
effect.uniform("gColor") = int4{ 0x00, 0x40, 0xBF, 0xFF };
effect.test(0xFFBF4000);
effect.uniform("gColor") = int4{ 0xFF, 0x00, 0x00, 0x7F };
- effect.test(0x7F0000FF); // Unlike SkShaders, we don't clamp here
+ effect.test(0x7F0000FF); // We don't clamp here either
// Verify that mutating the source and destination colors is allowed
effect.build("half4 main(half4 s, half4 d) { s += d; d += s; return half4(1); }");