mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibGfx/ICC: Simplify lerp_1d() a bit
No behavior change.
This commit is contained in:
parent
9372f6d726
commit
b138bc0004
Notes:
sideshowbarker
2024-07-17 00:47:29 +09:00
Author: https://github.com/nico
Commit: b138bc0004
Pull-request: https://github.com/SerenityOS/serenity/pull/22159
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