mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +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)
|
||||
{
|
||||
size_t n = values.size() - 1;
|
||||
size_t i = static_cast<size_t>(x * n);
|
||||
if (i == values.size() - 1)
|
||||
--i;
|
||||
|
||||
size_t i = min(static_cast<size_t>(x * n), n - 1);
|
||||
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