LibGfx: Refactor Point.constrain to use AK

This commit is contained in:
FrHun 2021-07-16 22:47:21 +02:00 committed by Andreas Kling
parent cc829ed9d2
commit c88756078a
Notes: sideshowbarker 2024-07-18 07:44:55 +09:00

View file

@ -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<>