1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 17:28:11 +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

@ -381,7 +381,7 @@ void IconView::update_item_rects(int item_index, ItemData& item_data) const
{
auto item_rect = this->item_rect(item_index);
item_data.icon_rect.center_within(item_rect);
item_data.icon_rect.move_by(0, item_data.icon_offset_y);
item_data.icon_rect.translate_by(0, item_data.icon_offset_y);
item_data.text_rect.center_horizontally_within(item_rect);
item_data.text_rect.set_top(item_rect.y() + item_data.text_offset_y);
}
@ -418,7 +418,7 @@ void IconView::get_item_rects(int item_index, ItemData& item_data, const Gfx::Fo
item_data.icon_rect = { 0, 0, 32, 32 };
item_data.icon_rect.center_within(item_rect);
item_data.icon_offset_y = -font.glyph_height() - 6;
item_data.icon_rect.move_by(0, item_data.icon_offset_y);
item_data.icon_rect.translate_by(0, item_data.icon_offset_y);
int unwrapped_text_width = font.width(item_data.text);
int available_width = item_rect.width() - 6;