1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

LibGfx: Unify Rect, Point, and Size

This commit unifies methods and method/param names between the above
classes, as well as adds [[nodiscard]] and ALWAYS_INLINE where
appropriate. It also renamed the various move_by methods to
translate_by, as that more closely matches the transformation
terminology.
This commit is contained in:
Matthew Olsson 2021-04-12 11:47:09 -07:00 committed by Andreas Kling
parent ac238b3bd6
commit 88cfaf7bf0
48 changed files with 282 additions and 187 deletions

View file

@ -575,7 +575,7 @@ Gfx::IntRect Widget::window_relative_rect() const
{
auto rect = relative_rect();
for (auto* parent = parent_widget(); parent; parent = parent->parent_widget()) {
rect.move_by(parent->relative_position());
rect.translate_by(parent->relative_position());
}
return rect;
}
@ -957,7 +957,7 @@ void Widget::set_content_margins(const Margins& margins)
Gfx::IntRect Widget::content_rect() const
{
auto rect = relative_rect();
rect.move_by(m_content_margins.left(), m_content_margins.top());
rect.translate_by(m_content_margins.left(), m_content_margins.top());
rect.set_width(rect.width() - (m_content_margins.left() + m_content_margins.right()));
rect.set_height(rect.height() - (m_content_margins.top() + m_content_margins.bottom()));
return rect;