mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 15:43:20 +00:00
LibWeb: Round integral values to the nearest integer when interpolating
Previously, color components were being incorrectly rounded when interpolating.
This commit is contained in:
parent
3c3f1f9fad
commit
3ae48776fd
Notes:
github-actions[bot]
2025-07-30 08:53:04 +00:00
Author: https://github.com/tcl3
Commit: 3ae48776fd
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5651
Reviewed-by: https://github.com/gmta ✅
5 changed files with 63 additions and 63 deletions
|
@ -42,7 +42,7 @@ static T interpolate_raw(T from, T to, float delta)
|
|||
} else if constexpr (AK::Detail::IsIntegral<T>) {
|
||||
auto from_float = static_cast<float>(from);
|
||||
auto to_float = static_cast<float>(to);
|
||||
auto unclamped_result = from_float + (to_float - from_float) * delta;
|
||||
auto unclamped_result = roundf(from_float + (to_float - from_float) * delta);
|
||||
return static_cast<AK::Detail::RemoveCVReference<T>>(clamp(unclamped_result, NumericLimits<T>::min(), NumericLimits<T>::max()));
|
||||
}
|
||||
return static_cast<AK::Detail::RemoveCVReference<T>>(from + (to - from) * delta);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue