From fc137a7827f5e291c2c5e442fcfaab22ea4c6019 Mon Sep 17 00:00:00 2001 From: Tim Ledbetter Date: Wed, 29 Mar 2023 18:00:42 +0100 Subject: [PATCH] LibGfx: Correct off by one error in Point::constrain() Previously, the y value would be clamped to a value one less than necessary. --- Userland/Libraries/LibGfx/Point.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGfx/Point.cpp b/Userland/Libraries/LibGfx/Point.cpp index 1b35b50203..88d542bc38 100644 --- a/Userland/Libraries/LibGfx/Point.cpp +++ b/Userland/Libraries/LibGfx/Point.cpp @@ -15,8 +15,8 @@ namespace Gfx { template void Point::constrain(Rect const& rect) { - m_x = AK::clamp(x(), rect.left(), rect.right()); - m_y = AK::clamp(y(), rect.top(), rect.bottom()); + m_x = AK::clamp(x(), rect.left(), rect.left() + rect.width()); + m_y = AK::clamp(y(), rect.top(), rect.top() + rect.height()); } template