summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGfx/Point.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/Userland/Libraries/LibGfx/Point.cpp b/Userland/Libraries/LibGfx/Point.cpp
index c2cdf7fda8..aaa2563362 100644
--- a/Userland/Libraries/LibGfx/Point.cpp
+++ b/Userland/Libraries/LibGfx/Point.cpp
@@ -15,17 +15,8 @@ namespace Gfx {
template<typename T>
void Point<T>::constrain(Rect<T> const& rect)
{
- if (x() < rect.left()) {
- set_x(rect.left());
- } else if (x() > rect.right()) {
- set_x(rect.right());
- }
-
- if (y() < rect.top()) {
- set_y(rect.top());
- } else if (y() > rect.bottom()) {
- set_y(rect.bottom());
- }
+ m_x = AK::clamp<T>(x(), rect.left(), rect.right());
+ m_y = AK::clamp<T>(y(), rect.top(), rect.bottom());
}
template<>