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

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.
This commit is contained in:
Andreas Kling 2020-06-10 10:57:59 +02:00
parent 656b01eb0f
commit 116cf92156
212 changed files with 1144 additions and 1144 deletions

View file

@ -179,7 +179,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event)
int x = 0;
int i = 0;
for (;;) {
Gfx::Rect rect(x, 0, white_key_width, frame_inner_rect().height());
Gfx::IntRect rect(x, 0, white_key_width, frame_inner_rect().height());
painter.fill_rect(rect, m_key_on[note] ? note_pressed_color : Color::White);
painter.draw_rect(rect, Color::Black);
if (i < white_key_labels_count) {
@ -201,7 +201,7 @@ void KeysWidget::paint_event(GUI::PaintEvent& event)
x = white_key_width - black_key_x_offset;
i = 0;
for (;;) {
Gfx::Rect rect(x, 0, black_key_width, black_key_height);
Gfx::IntRect rect(x, 0, black_key_width, black_key_height);
painter.fill_rect(rect, m_key_on[note] ? note_pressed_color : Color::Black);
painter.draw_rect(rect, Color::Black);
if (i < black_key_labels_count) {
@ -245,7 +245,7 @@ static inline int note_from_white_keys(int white_keys)
return note;
}
int KeysWidget::note_for_event_position(const Gfx::Point& a_point) const
int KeysWidget::note_for_event_position(const Gfx::IntPoint& a_point) const
{
if (!frame_inner_rect().contains(a_point))
return -1;
@ -259,7 +259,7 @@ int KeysWidget::note_for_event_position(const Gfx::Point& a_point) const
bool black_key_on_left = note != 0 && key_pattern[(note - 1) % notes_per_octave] == Black;
if (black_key_on_left) {
int black_key_x = (white_keys * white_key_width) - black_key_x_offset;
Gfx::Rect black_key(black_key_x, 0, black_key_width, black_key_height);
Gfx::IntRect black_key(black_key_x, 0, black_key_width, black_key_height);
if (black_key.contains(point))
return note - 1;
}
@ -267,7 +267,7 @@ int KeysWidget::note_for_event_position(const Gfx::Point& a_point) const
bool black_key_on_right = key_pattern[(note + 1) % notes_per_octave] == Black;
if (black_key_on_right) {
int black_key_x = ((white_keys + 1) * white_key_width) - black_key_x_offset;
Gfx::Rect black_key(black_key_x, 0, black_key_width, black_key_height);
Gfx::IntRect black_key(black_key_x, 0, black_key_width, black_key_height);
if (black_key.contains(point))
return note + 1;
}

View file

@ -50,7 +50,7 @@ private:
virtual void mouseup_event(GUI::MouseEvent&) override;
virtual void mousemove_event(GUI::MouseEvent&) override;
int note_for_event_position(const Gfx::Point&) const;
int note_for_event_position(const Gfx::IntPoint&) const;
AudioEngine& m_audio_engine;

View file

@ -98,7 +98,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
int x_pos = x * m_note_width;
int next_x_pos = (x + 1) * m_note_width;
int distance_to_next_x = next_x_pos - x_pos;
Gfx::Rect rect(x_pos, y_pos, distance_to_next_x, note_height);
Gfx::IntRect rect(x_pos, y_pos, distance_to_next_x, note_height);
if (key_pattern[key_pattern_index] == Black)
painter.fill_rect(rect, Color::LightGray);
@ -128,7 +128,7 @@ void RollWidget::paint_event(GUI::PaintEvent& event)
int y = ((note_count - 1) - note) * note_height;
int height = note_height;
Gfx::Rect rect(x, y, width, height);
Gfx::IntRect rect(x, y, width, height);
painter.fill_rect(rect, note_pressed_color);
painter.draw_rect(rect, Color::Black);
}

View file

@ -74,12 +74,12 @@ void WaveEditor::paint_event(GUI::PaintEvent& event)
int left_y = sample_to_y(recorded_sample[x].left);
int right_y = sample_to_y(recorded_sample[x].right);
Gfx::Point left_point1(prev_x * width_scale, left_prev_y);
Gfx::Point left_point2(x * width_scale, left_y);
Gfx::IntPoint left_point1(prev_x * width_scale, left_prev_y);
Gfx::IntPoint left_point2(x * width_scale, left_y);
painter.draw_line(left_point1, left_point2, left_wave_colors[RecordedSample]);
Gfx::Point right_point1(prev_x * width_scale, right_prev_y);
Gfx::Point right_point2(x * width_scale, right_y);
Gfx::IntPoint right_point1(prev_x * width_scale, right_prev_y);
Gfx::IntPoint right_point2(x * width_scale, right_y);
painter.draw_line(right_point1, right_point2, right_wave_colors[RecordedSample]);
prev_x = x;

View file

@ -71,12 +71,12 @@ void WaveWidget::paint_event(GUI::PaintEvent& event)
int y_left = sample_to_y(buffer[x].left);
int y_right = sample_to_y(buffer[x].right);
Gfx::Point point1_left(prev_x * width_scale, prev_y_left);
Gfx::Point point2_left(x * width_scale, y_left);
Gfx::IntPoint point1_left(prev_x * width_scale, prev_y_left);
Gfx::IntPoint point2_left(x * width_scale, y_left);
painter.draw_line(point1_left, point2_left, left_wave_color);
Gfx::Point point1_right(prev_x * width_scale, prev_y_right);
Gfx::Point point2_right(x * width_scale, y_right);
Gfx::IntPoint point1_right(prev_x * width_scale, prev_y_right);
Gfx::IntPoint point2_right(x * width_scale, y_right);
painter.draw_line(point1_right, point2_right, right_wave_color);
prev_x = x;