mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:57:47 +00:00
LibGfx/ICC: Simplify lerp_1d() a bit
No behavior change.
This commit is contained in:
parent
9372f6d726
commit
b138bc0004
1 changed files with 1 additions and 4 deletions
|
@ -28,10 +28,7 @@ template<class T>
|
||||||
float lerp_1d(ReadonlySpan<T> values, float x)
|
float lerp_1d(ReadonlySpan<T> values, float x)
|
||||||
{
|
{
|
||||||
size_t n = values.size() - 1;
|
size_t n = values.size() - 1;
|
||||||
size_t i = static_cast<size_t>(x * n);
|
size_t i = min(static_cast<size_t>(x * n), n - 1);
|
||||||
if (i == values.size() - 1)
|
|
||||||
--i;
|
|
||||||
|
|
||||||
return mix(static_cast<float>(values[i]), static_cast<float>(values[i + 1]), x * n - i);
|
return mix(static_cast<float>(values[i]), static_cast<float>(values[i + 1]), x * n - i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue