add an ulp of error on the clamp asserts

Change-Id: I3903e266e2e99ceab647fbc45c764e3526e600af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/275198
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
This commit is contained in:
Mike Klein 2020-03-04 18:33:30 -06:00 committed by Skia Commit-Bot
parent 203b4050ed
commit f1d78a6c68

View File

@ -386,10 +386,10 @@ namespace {
if (src_in_gamut) {
// An in-gamut src blended with an in-gamut dst should stay in gamut.
// Being in-gamut implies all channels are in [0,1], so no need to clamp.
assert_true(eq(src.r, clamp(src.r, splat(0.0f), splat(1.0f))));
assert_true(eq(src.g, clamp(src.g, splat(0.0f), splat(1.0f))));
assert_true(eq(src.b, clamp(src.b, splat(0.0f), splat(1.0f))));
assert_true(eq(src.a, clamp(src.a, splat(0.0f), splat(1.0f))));
assert_true(eq(src.r, clamp(src.r, splat(0.0f), bit_cast(splat(0x3f80'0001)))));
assert_true(eq(src.g, clamp(src.g, splat(0.0f), bit_cast(splat(0x3f80'0001)))));
assert_true(eq(src.b, clamp(src.b, splat(0.0f), bit_cast(splat(0x3f80'0001)))));
assert_true(eq(src.a, clamp(src.a, splat(0.0f), bit_cast(splat(0x3f80'0001)))));
} else if (SkColorTypeIsNormalized(params.colorType)) {
src.r = clamp(src.r, splat(0.0f), splat(1.0f));
src.g = clamp(src.g, splat(0.0f), splat(1.0f));