1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:47:34 +00:00

LibGfx: Correct off by one error in Point::constrain()

Previously, the y value would be clamped to a value one less than
necessary.
This commit is contained in:
Tim Ledbetter 2023-03-29 18:00:42 +01:00 committed by Sam Atkins
parent ea0b527675
commit fc137a7827

View file

@ -15,8 +15,8 @@ namespace Gfx {
template<typename T>
void Point<T>::constrain(Rect<T> const& rect)
{
m_x = AK::clamp<T>(x(), rect.left(), rect.right());
m_y = AK::clamp<T>(y(), rect.top(), rect.bottom());
m_x = AK::clamp<T>(x(), rect.left(), rect.left() + rect.width());
m_y = AK::clamp<T>(y(), rect.top(), rect.top() + rect.height());
}
template<typename T>