From 93f5a6f217516da94f74c4ca3617aba8047ca318 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 12 Apr 2023 09:05:27 -0400 Subject: [PATCH] LibGfx/ICC: Use mix() in CurveTagData::evaluate() No behavior change. (Well, technically mix() uses the other simple implementation of lerp and the two have slightly different behavior if the arguments are of very different magnitude and in various corner cases. But in practice, for ICC profiles, it shouldn't matter. For a few profiles I tested, it didn't have a measurable effect.) --- Userland/Libraries/LibGfx/ICC/TagTypes.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/ICC/TagTypes.h b/Userland/Libraries/LibGfx/ICC/TagTypes.h index 83007fe403..ed7ee726bc 100644 --- a/Userland/Libraries/LibGfx/ICC/TagTypes.h +++ b/Userland/Libraries/LibGfx/ICC/TagTypes.h @@ -176,8 +176,7 @@ public: --i; float f = x * (values().size() - 1) - i; - - return (1 - f) * (values()[i] / 65535.f) + f * (values()[i + 1] / 65535.f); + return mix(values()[i] / 65535.f, values()[i + 1] / 65535.f, f); } private: