diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-10 10:57:59 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-10 10:59:04 +0200 |
commit | 116cf92156090bb3f5c15d5be145f1283884d65d (patch) | |
tree | 4496ab3e8c90add1c40da2eceee71324369ec0c6 /Libraries/LibVT | |
parent | 656b01eb0fb659fb2d3ee4e6e4413a82543414e3 (diff) | |
download | serenity-116cf92156090bb3f5c15d5be145f1283884d65d.zip |
LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize
This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
Diffstat (limited to 'Libraries/LibVT')
-rw-r--r-- | Libraries/LibVT/TerminalWidget.cpp | 18 | ||||
-rw-r--r-- | Libraries/LibVT/TerminalWidget.h | 12 |
2 files changed, 15 insertions, 15 deletions
diff --git a/Libraries/LibVT/TerminalWidget.cpp b/Libraries/LibVT/TerminalWidget.cpp index ab666cc641..cf56948ae7 100644 --- a/Libraries/LibVT/TerminalWidget.cpp +++ b/Libraries/LibVT/TerminalWidget.cpp @@ -147,17 +147,17 @@ static inline Color color_from_rgb(unsigned color) return Color::from_rgb(color); } -Gfx::Rect TerminalWidget::glyph_rect(u16 row, u16 column) +Gfx::IntRect TerminalWidget::glyph_rect(u16 row, u16 column) { int y = row * m_line_height; int x = column * font().glyph_width('x'); return { x + frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x'), font().glyph_height() }; } -Gfx::Rect TerminalWidget::row_rect(u16 row) +Gfx::IntRect TerminalWidget::row_rect(u16 row) { int y = row * m_line_height; - Gfx::Rect rect = { frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x') * m_terminal.columns(), font().glyph_height() }; + Gfx::IntRect rect = { frame_thickness() + m_inset, y + frame_thickness() + m_inset, font().glyph_width('x') * m_terminal.columns(), font().glyph_height() }; rect.inflate(0, m_line_spacing); return rect; } @@ -264,7 +264,7 @@ void TerminalWidget::paint_event(GUI::PaintEvent& event) painter.add_clip_rect(event.rect()); - Gfx::Rect terminal_buffer_rect(frame_inner_rect().top_left(), { frame_inner_rect().width() - m_scrollbar->width(), frame_inner_rect().height() }); + Gfx::IntRect terminal_buffer_rect(frame_inner_rect().top_left(), { frame_inner_rect().width() - m_scrollbar->width(), frame_inner_rect().height() }); painter.add_clip_rect(terminal_buffer_rect); if (m_visual_beep_timer->is_active()) @@ -394,7 +394,7 @@ void TerminalWidget::flush_dirty_lines() m_terminal.m_need_full_flush = false; return; } - Gfx::Rect rect; + Gfx::IntRect rect; for (int i = 0; i < m_terminal.rows(); ++i) { if (m_terminal.visible_line(i).is_dirty()) { rect = rect.united(row_rect(i)); @@ -415,7 +415,7 @@ void TerminalWidget::resize_event(GUI::ResizeEvent& event) relayout(event.size()); } -void TerminalWidget::relayout(const Gfx::Size& size) +void TerminalWidget::relayout(const Gfx::IntSize& size) { if (!m_scrollbar) return; @@ -425,7 +425,7 @@ void TerminalWidget::relayout(const Gfx::Size& size) int new_rows = (size.height() - base_size.height()) / m_line_height; m_terminal.set_size(new_columns, new_rows); - Gfx::Rect scrollbar_rect = { + Gfx::IntRect scrollbar_rect = { size.width() - m_scrollbar->width() - frame_thickness(), frame_thickness(), m_scrollbar->width(), @@ -434,7 +434,7 @@ void TerminalWidget::relayout(const Gfx::Size& size) m_scrollbar->set_relative_rect(scrollbar_rect); } -Gfx::Size TerminalWidget::compute_base_size() const +Gfx::IntSize TerminalWidget::compute_base_size() const { int base_width = frame_thickness() * 2 + m_inset * 2 + m_scrollbar->width(); int base_height = frame_thickness() * 2 + m_inset * 2; @@ -499,7 +499,7 @@ bool TerminalWidget::selection_contains(const VT::Position& position) const return position >= normalized_selection_start() && position <= normalized_selection_end(); } -VT::Position TerminalWidget::buffer_position_at(const Gfx::Point& position) const +VT::Position TerminalWidget::buffer_position_at(const Gfx::IntPoint& position) const { auto adjusted_position = position.translated(-(frame_thickness() + m_inset), -(frame_thickness() + m_inset)); int row = adjusted_position.y() / m_line_height; diff --git a/Libraries/LibVT/TerminalWidget.h b/Libraries/LibVT/TerminalWidget.h index 6b48308955..6be5328079 100644 --- a/Libraries/LibVT/TerminalWidget.h +++ b/Libraries/LibVT/TerminalWidget.h @@ -69,7 +69,7 @@ public: bool has_selection() const; bool selection_contains(const VT::Position&) const; String selected_text() const; - VT::Position buffer_position_at(const Gfx::Point&) const; + VT::Position buffer_position_at(const Gfx::IntPoint&) const; VT::Position normalized_selection_start() const; VT::Position normalized_selection_end() const; @@ -115,15 +115,15 @@ private: void set_logical_focus(bool); - Gfx::Rect glyph_rect(u16 row, u16 column); - Gfx::Rect row_rect(u16 row); + Gfx::IntRect glyph_rect(u16 row, u16 column); + Gfx::IntRect row_rect(u16 row); void update_cursor(); void invalidate_cursor(); - void relayout(const Gfx::Size&); + void relayout(const Gfx::IntSize&); - Gfx::Size compute_base_size() const; + Gfx::IntSize compute_base_size() const; int first_selection_column_on_row(int row) const; int last_selection_column_on_row(int row) const; @@ -182,5 +182,5 @@ private: Core::ElapsedTimer m_triple_click_timer; - Gfx::Point m_left_mousedown_position; + Gfx::IntPoint m_left_mousedown_position; }; |