mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +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:
parent
ac238b3bd6
commit
88cfaf7bf0
48 changed files with 282 additions and 187 deletions
|
@ -197,7 +197,7 @@ void TabWidget::paint_event(PaintEvent& event)
|
|||
if (!icon)
|
||||
return;
|
||||
Gfx::IntRect icon_rect { button_rect.x(), button_rect.y(), 16, 16 };
|
||||
icon_rect.move_by(4, 3);
|
||||
icon_rect.translate_by(4, 3);
|
||||
painter.draw_scaled_bitmap(icon_rect, *icon, icon->rect());
|
||||
text_rect.set_x(icon_rect.right() + 1 + 4);
|
||||
text_rect.intersect(button_rect);
|
||||
|
@ -281,13 +281,13 @@ Gfx::IntRect TabWidget::button_rect(int index) const
|
|||
}
|
||||
Gfx::IntRect rect { x_offset, 0, m_uniform_tabs ? uniform_tab_width() : m_tabs[index].width(font()), bar_height() };
|
||||
if (m_tabs[index].widget != m_active_widget) {
|
||||
rect.move_by(0, m_tab_position == TabPosition::Top ? 2 : 0);
|
||||
rect.translate_by(0, m_tab_position == TabPosition::Top ? 2 : 0);
|
||||
rect.set_height(rect.height() - 2);
|
||||
} else {
|
||||
rect.move_by(-2, 0);
|
||||
rect.translate_by(-2, 0);
|
||||
rect.set_width(rect.width() + 4);
|
||||
}
|
||||
rect.move_by(bar_rect().location());
|
||||
rect.translate_by(bar_rect().location());
|
||||
return rect;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue