1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +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

@ -120,7 +120,7 @@ void BookmarksBarWidget::did_update_model()
auto title = model()->data(model()->index(item_index, 0)).to_string();
auto url = model()->data(model()->index(item_index, 1)).to_string();
Gfx::Rect rect { width, 0, font().width(title) + 32, height() };
Gfx::IntRect rect { width, 0, font().width(title) + 32, height() };
auto& button = add<GUI::Button>();
m_bookmarks.append(button);

View file

@ -409,7 +409,7 @@ void Tab::did_become_active()
GUI::Application::the().set_menubar(m_menubar);
}
void Tab::context_menu_requested(const Gfx::Point& screen_position)
void Tab::context_menu_requested(const Gfx::IntPoint& screen_position)
{
m_tab_context_menu->popup(screen_position);
}

View file

@ -43,7 +43,7 @@ public:
void load(const URL&);
void did_become_active();
void context_menu_requested(const Gfx::Point& screen_position);
void context_menu_requested(const Gfx::IntPoint& screen_position);
Function<void(String)> on_title_change;
Function<void(const URL&)> on_tab_open_request;

View file

@ -249,16 +249,16 @@ void CalendarWidget::CalendarTile::paint_event(GUI::PaintEvent& event)
painter.draw_line(frame_inner_rect().top_left(), frame_inner_rect().top_right(), Color::NamedColor::Black);
painter.draw_line(frame_inner_rect().bottom_left(), frame_inner_rect().bottom_right(), Color::NamedColor::Black);
Gfx::Rect day_rect = Gfx::Rect(frame_inner_rect().x(), frame_inner_rect().y(), frame_inner_rect().width(), font().glyph_height() + 4);
Gfx::IntRect day_rect = Gfx::IntRect(frame_inner_rect().x(), frame_inner_rect().y(), frame_inner_rect().width(), font().glyph_height() + 4);
int weekday_characters_width = (font().glyph_width('0') * (m_weekday_name.length() + 1)) + 4;
if (m_display_weekday_name && (frame_inner_rect().height() > (font().glyph_height() + 4) * 2) && (frame_inner_rect().width() > weekday_characters_width)) {
auto weekday_rect = Gfx::Rect(frame_inner_rect().x(), frame_inner_rect().y(), frame_inner_rect().width(), font().glyph_height() + 4);
auto weekday_rect = Gfx::IntRect(frame_inner_rect().x(), frame_inner_rect().y(), frame_inner_rect().width(), font().glyph_height() + 4);
weekday_rect.set_top(frame_inner_rect().y() + 2);
painter.draw_text(weekday_rect, m_weekday_name, Gfx::Font::default_bold_font(), Gfx::TextAlignment::Center, palette().base_text());
day_rect.set_y(frame_inner_rect().y() + 15);
} else {
day_rect = Gfx::Rect(frame_inner_rect().x(), frame_inner_rect().y(), frame_inner_rect().width(), font().glyph_height() + 4);
day_rect = Gfx::IntRect(frame_inner_rect().x(), frame_inner_rect().y(), frame_inner_rect().width(), font().glyph_height() + 4);
day_rect.set_y(frame_inner_rect().y() + 4);
}
@ -266,7 +266,7 @@ void CalendarWidget::CalendarTile::paint_event(GUI::PaintEvent& event)
auto display_date = (m_date_time.day() == 1 && frame_inner_rect().width() > highlight_rect_width) ? m_display_date : String::number(m_date_time.day());
if (m_calendar.is_today(m_date_time)) {
auto highlight_rect = Gfx::Rect(day_rect.width() / 2 - (highlight_rect_width / 2), day_rect.y(), highlight_rect_width, font().glyph_height() + 4);
auto highlight_rect = Gfx::IntRect(day_rect.width() / 2 - (highlight_rect_width / 2), day_rect.y(), highlight_rect_width, font().glyph_height() + 4);
painter.draw_rect(highlight_rect, palette().base_text());
painter.draw_text(day_rect, display_date, Gfx::Font::default_bold_font(), Gfx::TextAlignment::Center, palette().base_text());
} else

View file

@ -198,7 +198,7 @@ void DisplaySettingsWidget::create_frame()
m_resolution_combo->set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed);
m_resolution_combo->set_preferred_size(0, 22);
m_resolution_combo->set_only_allow_values_from_model(true);
m_resolution_combo->set_model(*ItemListModel<Gfx::Size>::create(m_resolutions));
m_resolution_combo->set_model(*ItemListModel<Gfx::IntSize>::create(m_resolutions));
m_resolution_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
this->m_monitor_widget->set_desktop_resolution(m_resolutions.at(index.row()));
this->m_monitor_widget->update();
@ -301,7 +301,7 @@ void DisplaySettingsWidget::load_current_settings()
}
/// Resolution ////////////////////////////////////////////////////////////////////////////////
Gfx::Size find_size;
Gfx::IntSize find_size;
bool okay = false;
// Let's attempt to find the current resolution and select it!
@ -318,7 +318,7 @@ void DisplaySettingsWidget::load_current_settings()
}
size_t index = m_resolutions.find_first_index(find_size).value_or(0);
Gfx::Size m_current_resolution = m_resolutions.at(index);
Gfx::IntSize m_current_resolution = m_resolutions.at(index);
m_monitor_widget->set_desktop_resolution(m_current_resolution);
m_resolution_combo->set_selected_index(index);

View file

@ -47,7 +47,7 @@ private:
Vector<String> m_wallpapers;
Vector<String> m_modes;
Vector<Gfx::Size> m_resolutions;
Vector<Gfx::IntSize> m_resolutions;
RefPtr<GUI::Widget> m_root_widget;
RefPtr<MonitorWidget> m_monitor_widget;

View file

@ -54,12 +54,12 @@ String MonitorWidget::wallpaper_mode()
return m_desktop_wallpaper_mode;
}
void MonitorWidget::set_desktop_resolution(Gfx::Size resolution)
void MonitorWidget::set_desktop_resolution(Gfx::IntSize resolution)
{
m_desktop_resolution = resolution;
}
Gfx::Size MonitorWidget::desktop_resolution()
Gfx::IntSize MonitorWidget::desktop_resolution()
{
return m_desktop_resolution;
}
@ -76,7 +76,7 @@ Gfx::Color MonitorWidget::background_color()
void MonitorWidget::paint_event(GUI::PaintEvent& event)
{
Gfx::Rect screen_rect = { 0, 0, m_desktop_resolution.width(), m_desktop_resolution.height() };
Gfx::IntRect screen_rect = { 0, 0, m_desktop_resolution.width(), m_desktop_resolution.height() };
auto screen_bitmap = Gfx::Bitmap::create(m_monitor_bitmap->format(), m_desktop_resolution);
GUI::Painter screen_painter(*screen_bitmap);
screen_painter.fill_rect(screen_rect, m_desktop_color);
@ -85,7 +85,7 @@ void MonitorWidget::paint_event(GUI::PaintEvent& event)
if (m_desktop_wallpaper_mode == "simple") {
screen_painter.blit({ 0, 0 }, *m_desktop_wallpaper_bitmap, m_desktop_wallpaper_bitmap->rect());
} else if (m_desktop_wallpaper_mode == "center") {
Gfx::Point offset { screen_rect.width() / 2 - m_desktop_wallpaper_bitmap->size().width() / 2, screen_rect.height() / 2 - m_desktop_wallpaper_bitmap->size().height() / 2 };
Gfx::IntPoint offset { screen_rect.width() / 2 - m_desktop_wallpaper_bitmap->size().width() / 2, screen_rect.height() / 2 - m_desktop_wallpaper_bitmap->size().height() / 2 };
screen_painter.blit_offset(screen_rect.location(), *m_desktop_wallpaper_bitmap, screen_rect, offset);
} else if (m_desktop_wallpaper_mode == "tile") {
screen_painter.draw_tiled_bitmap(screen_bitmap->rect(), *m_desktop_wallpaper_bitmap);

View file

@ -41,8 +41,8 @@ public:
void set_wallpaper_mode(String mode);
String wallpaper_mode();
void set_desktop_resolution(Gfx::Size resolution);
Gfx::Size desktop_resolution();
void set_desktop_resolution(Gfx::IntSize resolution);
Gfx::IntSize desktop_resolution();
void set_background_color(Gfx::Color background_color);
Gfx::Color background_color();
@ -50,12 +50,12 @@ public:
private:
virtual void paint_event(GUI::PaintEvent& event) override;
Gfx::Rect m_monitor_rect;
Gfx::IntRect m_monitor_rect;
RefPtr<Gfx::Bitmap> m_monitor_bitmap;
String m_desktop_wallpaper_path;
RefPtr<Gfx::Bitmap> m_desktop_wallpaper_bitmap;
String m_desktop_wallpaper_mode;
Gfx::Size m_desktop_resolution;
Gfx::IntSize m_desktop_resolution;
Gfx::Color m_desktop_color;
};

View file

@ -68,7 +68,7 @@ void GlyphEditorWidget::paint_event(GUI::PaintEvent& event)
for (int y = 0; y < font().glyph_height(); ++y) {
for (int x = 0; x < font().max_glyph_width(); ++x) {
Gfx::Rect rect { x * m_scale, y * m_scale, m_scale, m_scale };
Gfx::IntRect rect { x * m_scale, y * m_scale, m_scale, m_scale };
if (x >= font().glyph_width(m_glyph)) {
painter.fill_rect(rect, palette().threed_shadow1());
} else {

View file

@ -60,11 +60,11 @@ void GlyphMapWidget::set_selected_glyph(int glyph)
update();
}
Gfx::Rect GlyphMapWidget::get_outer_rect(int glyph) const
Gfx::IntRect GlyphMapWidget::get_outer_rect(int glyph) const
{
int row = glyph / columns();
int column = glyph % columns();
return Gfx::Rect {
return Gfx::IntRect {
column * (font().max_glyph_width() + m_horizontal_spacing) + 1,
row * (font().glyph_height() + m_vertical_spacing) + 1,
font().max_glyph_width() + m_horizontal_spacing,
@ -89,8 +89,8 @@ void GlyphMapWidget::paint_event(GUI::PaintEvent& event)
painter.fill_rect(frame_inner_rect(), palette().base());
for (int glyph = 0; glyph < m_glyph_count; ++glyph) {
Gfx::Rect outer_rect = get_outer_rect(glyph);
Gfx::Rect inner_rect(
Gfx::IntRect outer_rect = get_outer_rect(glyph);
Gfx::IntRect inner_rect(
outer_rect.x() + m_horizontal_spacing / 2,
outer_rect.y() + m_vertical_spacing / 2,
font().max_glyph_width(),

View file

@ -58,7 +58,7 @@ private:
virtual void mousedown_event(GUI::MouseEvent&) override;
virtual void keydown_event(GUI::KeyEvent&) override;
Gfx::Rect get_outer_rect(int glyph) const;
Gfx::IntRect get_outer_rect(int glyph) const;
RefPtr<Gfx::Font> m_font;
int m_glyph_count;

View file

@ -336,7 +336,7 @@ void HexEditor::scroll_position_into_view(int position)
{
int y = position / bytes_per_row();
int x = position % bytes_per_row();
Gfx::Rect rect {
Gfx::IntRect rect {
frame_thickness() + offset_margin_width() + (x * (character_width() * 3)) + 10,
frame_thickness() + 5 + (y * line_height()),
(character_width() * 3),
@ -490,7 +490,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
painter.translate(frame_thickness(), frame_thickness());
painter.translate(-horizontal_scrollbar().value(), -vertical_scrollbar().value());
Gfx::Rect offset_clip_rect {
Gfx::IntRect offset_clip_rect {
0,
vertical_scrollbar().value(),
85,
@ -510,7 +510,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
// paint offsets
for (int i = min_row; i < max_row; i++) {
Gfx::Rect side_offset_rect {
Gfx::IntRect side_offset_rect {
frame_thickness() + 5,
frame_thickness() + 5 + (i * line_height()),
width() - width_occupied_by_vertical_scrollbar(),
@ -548,7 +548,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
}
}
Gfx::Rect hex_display_rect {
Gfx::IntRect hex_display_rect {
frame_thickness() + offset_margin_width() + (j * (character_width() * 3)) + 10,
frame_thickness() + 5 + (i * line_height()),
(character_width() * 3),
@ -565,7 +565,7 @@ void HexEditor::paint_event(GUI::PaintEvent& event)
auto line = String::format("%02X", m_buffer[byte_position]);
painter.draw_text(hex_display_rect, line, Gfx::TextAlignment::TopLeft, text_color);
Gfx::Rect text_display_rect {
Gfx::IntRect text_display_rect {
frame_thickness() + offset_margin_width() + (bytes_per_row() * (character_width() * 3)) + (j * character_width()) + 20,
frame_thickness() + 5 + (i * line_height()),
character_width(),

View file

@ -50,7 +50,7 @@ void KeyButton::paint_event(GUI::PaintEvent& event)
painter.fill_rect(content_rect, Color::from_rgb(0x8C7272));
if (!text().is_empty()) {
Gfx::Rect text_rect { 0, 0, font.width(text()), font.glyph_height() };
Gfx::IntRect text_rect { 0, 0, font.width(text()), font.glyph_height() };
text_rect.align_within(content_rect, Gfx::TextAlignment::Center);
auto clipped_rect = rect().intersected(this->rect());

View file

@ -58,7 +58,7 @@ void KeyboardMapperWidget::create_frame()
m_keys.resize(KEY_COUNT);
for (unsigned i = 0; i < KEY_COUNT; i++) {
Gfx::Rect rect = { keys[i].x, keys[i].y, keys[i].width, keys[i].height };
Gfx::IntRect rect = { keys[i].x, keys[i].y, keys[i].width, keys[i].height };
auto& tmp_button = main_widget.add<KeyButton>();
tmp_button.set_relative_rect(rect);

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;

View file

@ -43,7 +43,7 @@ BucketTool::~BucketTool()
{
}
static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::Point& start_position, Color target_color, Color fill_color)
static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::IntPoint& start_position, Color target_color, Color fill_color)
{
ASSERT(bitmap.bpp() == 32);
@ -53,7 +53,7 @@ static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::Point& start_position, Co
if (!bitmap.rect().contains(start_position))
return;
Queue<Gfx::Point> queue;
Queue<Gfx::IntPoint> queue;
queue.enqueue(start_position);
while (!queue.is_empty()) {
auto position = queue.dequeue();

View file

@ -33,7 +33,7 @@
namespace PixelPaint {
CreateNewLayerDialog::CreateNewLayerDialog(const Gfx::Size& suggested_size, GUI::Window* parent_window)
CreateNewLayerDialog::CreateNewLayerDialog(const Gfx::IntSize& suggested_size, GUI::Window* parent_window)
: Dialog(parent_window)
{
set_title("Create new layer");

View file

@ -33,13 +33,13 @@ namespace PixelPaint {
class CreateNewLayerDialog final : public GUI::Dialog {
C_OBJECT(CreateNewLayerDialog);
public:
const Gfx::Size& layer_size() const { return m_layer_size; }
const Gfx::IntSize& layer_size() const { return m_layer_size; }
const String& layer_name() const { return m_layer_name; }
private:
CreateNewLayerDialog(const Gfx::Size& suggested_size, GUI::Window* parent_window);
CreateNewLayerDialog(const Gfx::IntSize& suggested_size, GUI::Window* parent_window);
Gfx::Size m_layer_size;
Gfx::IntSize m_layer_size;
String m_layer_name;
RefPtr<GUI::TextBox> m_name_textbox;

View file

@ -43,7 +43,7 @@ EllipseTool::~EllipseTool()
{
}
void EllipseTool::draw_using(GUI::Painter& painter, const Gfx::Rect& ellipse_intersecting_rect)
void EllipseTool::draw_using(GUI::Painter& painter, const Gfx::IntRect& ellipse_intersecting_rect)
{
switch (m_mode) {
case Mode::Outline:
@ -72,7 +72,7 @@ void EllipseTool::on_mouseup(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve
{
if (event.button() == m_drawing_button) {
GUI::Painter painter(layer.bitmap());
draw_using(painter, Gfx::Rect::from_two_points(m_ellipse_start_position, m_ellipse_end_position));
draw_using(painter, Gfx::IntRect::from_two_points(m_ellipse_start_position, m_ellipse_end_position));
m_drawing_button = GUI::MouseButton::None;
m_editor->update();
}
@ -96,7 +96,7 @@ void EllipseTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event)
painter.add_clip_rect(event.rect());
auto preview_start = m_editor->layer_position_to_editor_position(layer, m_ellipse_start_position).to_int_point();
auto preview_end = m_editor->layer_position_to_editor_position(layer, m_ellipse_end_position).to_int_point();
draw_using(painter, Gfx::Rect::from_two_points(preview_start, preview_end));
draw_using(painter, Gfx::IntRect::from_two_points(preview_start, preview_end));
}
void EllipseTool::on_keydown(GUI::KeyEvent& event)

View file

@ -51,11 +51,11 @@ private:
};
virtual const char* class_name() const override { return "EllipseTool"; }
void draw_using(GUI::Painter&, const Gfx::Rect&);
void draw_using(GUI::Painter&, const Gfx::IntRect&);
GUI::MouseButton m_drawing_button { GUI::MouseButton::None };
Gfx::Point m_ellipse_start_position;
Gfx::Point m_ellipse_end_position;
Gfx::IntPoint m_ellipse_start_position;
Gfx::IntPoint m_ellipse_end_position;
RefPtr<GUI::Menu> m_context_menu;
int m_thickness { 1 };
GUI::ActionGroup m_thickness_actions;

View file

@ -42,21 +42,21 @@ EraseTool::~EraseTool()
{
}
Gfx::Rect EraseTool::build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect)
Gfx::IntRect EraseTool::build_rect(const Gfx::IntPoint& pos, const Gfx::IntRect& widget_rect)
{
const int base_eraser_size = 10;
const int eraser_size = (base_eraser_size * m_thickness);
const int eraser_radius = eraser_size / 2;
const auto ex = pos.x();
const auto ey = pos.y();
return Gfx::Rect(ex - eraser_radius, ey - eraser_radius, eraser_size, eraser_size).intersected(widget_rect);
return Gfx::IntRect(ex - eraser_radius, ey - eraser_radius, eraser_size, eraser_size).intersected(widget_rect);
}
void EraseTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent&)
{
if (event.button() != GUI::MouseButton::Left && event.button() != GUI::MouseButton::Right)
return;
Gfx::Rect r = build_rect(event.position(), layer.rect());
Gfx::IntRect r = build_rect(event.position(), layer.rect());
GUI::Painter painter(layer.bitmap());
painter.clear_rect(r, get_color());
layer.did_modify_bitmap(*m_editor->image());
@ -65,7 +65,7 @@ void EraseTool::on_mousedown(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve
void EraseTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent&)
{
if (event.buttons() & GUI::MouseButton::Left || event.buttons() & GUI::MouseButton::Right) {
Gfx::Rect r = build_rect(event.position(), layer.rect());
Gfx::IntRect r = build_rect(event.position(), layer.rect());
GUI::Painter painter(layer.bitmap());
painter.clear_rect(r, get_color());
layer.did_modify_bitmap(*m_editor->image());

View file

@ -45,7 +45,7 @@ public:
private:
Gfx::Color get_color() const;
virtual const char* class_name() const override { return "EraseTool"; }
Gfx::Rect build_rect(const Gfx::Point& pos, const Gfx::Rect& widget_rect);
Gfx::IntRect build_rect(const Gfx::IntPoint& pos, const Gfx::IntRect& widget_rect);
RefPtr<GUI::Menu> m_context_menu;
bool m_use_secondary_color { false };

View file

@ -32,7 +32,7 @@
namespace PixelPaint {
RefPtr<Image> Image::create_with_size(const Gfx::Size& size)
RefPtr<Image> Image::create_with_size(const Gfx::IntSize& size)
{
if (size.is_empty())
return nullptr;
@ -43,12 +43,12 @@ RefPtr<Image> Image::create_with_size(const Gfx::Size& size)
return adopt(*new Image(size));
}
Image::Image(const Gfx::Size& size)
Image::Image(const Gfx::IntSize& size)
: m_size(size)
{
}
void Image::paint_into(GUI::Painter& painter, const Gfx::Rect& dest_rect)
void Image::paint_into(GUI::Painter& painter, const Gfx::IntRect& dest_rect)
{
float scale = (float)dest_rect.width() / (float)rect().width();
Gfx::PainterStateSaver saver(painter);

View file

@ -51,18 +51,18 @@ public:
class Image : public RefCounted<Image> {
public:
static RefPtr<Image> create_with_size(const Gfx::Size&);
static RefPtr<Image> create_with_size(const Gfx::IntSize&);
size_t layer_count() const { return m_layers.size(); }
const Layer& layer(size_t index) const { return m_layers.at(index); }
Layer& layer(size_t index) { return m_layers.at(index); }
const Gfx::Size& size() const { return m_size; }
Gfx::Rect rect() const { return { {}, m_size }; }
const Gfx::IntSize& size() const { return m_size; }
Gfx::IntRect rect() const { return { {}, m_size }; }
void add_layer(NonnullRefPtr<Layer>);
void paint_into(GUI::Painter&, const Gfx::Rect& dest_rect);
void paint_into(GUI::Painter&, const Gfx::IntRect& dest_rect);
void move_layer_to_front(Layer&);
void move_layer_to_back(Layer&);
@ -79,12 +79,12 @@ public:
size_t index_of(const Layer&) const;
private:
explicit Image(const Gfx::Size&);
explicit Image(const Gfx::IntSize&);
void did_change();
void did_modify_layer_stack();
Gfx::Size m_size;
Gfx::IntSize m_size;
NonnullRefPtrVector<Layer> m_layers;
HashTable<ImageClient*> m_clients;

View file

@ -76,12 +76,12 @@ void ImageEditor::paint_event(GUI::PaintEvent& event)
}
}
Gfx::FloatRect ImageEditor::layer_rect_to_editor_rect(const Layer& layer, const Gfx::Rect& layer_rect) const
Gfx::FloatRect ImageEditor::layer_rect_to_editor_rect(const Layer& layer, const Gfx::IntRect& layer_rect) const
{
return image_rect_to_editor_rect(layer_rect.translated(layer.location()));
}
Gfx::FloatRect ImageEditor::image_rect_to_editor_rect(const Gfx::Rect& image_rect) const
Gfx::FloatRect ImageEditor::image_rect_to_editor_rect(const Gfx::IntRect& image_rect) const
{
Gfx::FloatRect editor_rect;
editor_rect.set_location(image_position_to_editor_position(image_rect.location()));
@ -90,7 +90,7 @@ Gfx::FloatRect ImageEditor::image_rect_to_editor_rect(const Gfx::Rect& image_rec
return editor_rect;
}
Gfx::FloatRect ImageEditor::editor_rect_to_image_rect(const Gfx::Rect& editor_rect) const
Gfx::FloatRect ImageEditor::editor_rect_to_image_rect(const Gfx::IntRect& editor_rect) const
{
Gfx::FloatRect image_rect;
image_rect.set_location(editor_position_to_image_position(editor_rect.location()));
@ -99,12 +99,12 @@ Gfx::FloatRect ImageEditor::editor_rect_to_image_rect(const Gfx::Rect& editor_re
return image_rect;
}
Gfx::FloatPoint ImageEditor::layer_position_to_editor_position(const Layer& layer, const Gfx::Point& layer_position) const
Gfx::FloatPoint ImageEditor::layer_position_to_editor_position(const Layer& layer, const Gfx::IntPoint& layer_position) const
{
return image_position_to_editor_position(layer_position.translated(layer.location()));
}
Gfx::FloatPoint ImageEditor::image_position_to_editor_position(const Gfx::Point& image_position) const
Gfx::FloatPoint ImageEditor::image_position_to_editor_position(const Gfx::IntPoint& image_position) const
{
Gfx::FloatPoint editor_position;
editor_position.set_x(m_editor_image_rect.x() + ((float)image_position.x() * m_scale));
@ -112,7 +112,7 @@ Gfx::FloatPoint ImageEditor::image_position_to_editor_position(const Gfx::Point&
return editor_position;
}
Gfx::FloatPoint ImageEditor::editor_position_to_image_position(const Gfx::Point& editor_position) const
Gfx::FloatPoint ImageEditor::editor_position_to_image_position(const Gfx::IntPoint& editor_position) const
{
Gfx::FloatPoint image_position;
image_position.set_x(((float)editor_position.x() - m_editor_image_rect.x()) / m_scale);
@ -131,7 +131,7 @@ GUI::MouseEvent ImageEditor::event_with_pan_and_scale_applied(const GUI::MouseEv
auto image_position = editor_position_to_image_position(event.position());
return {
static_cast<GUI::Event::Type>(event.type()),
Gfx::Point(image_position.x(), image_position.y()),
Gfx::IntPoint(image_position.x(), image_position.y()),
event.buttons(),
event.button(),
event.modifiers(),
@ -145,7 +145,7 @@ GUI::MouseEvent ImageEditor::event_adjusted_for_layer(const GUI::MouseEvent& eve
image_position.move_by(-layer.location().x(), -layer.location().y());
return {
static_cast<GUI::Event::Type>(event.type()),
Gfx::Point(image_position.x(), image_position.y()),
Gfx::IntPoint(image_position.x(), image_position.y()),
event.buttons(),
event.button(),
event.modifiers(),
@ -331,14 +331,14 @@ void ImageEditor::set_secondary_color(Color color)
on_secondary_color_change(color);
}
Layer* ImageEditor::layer_at_editor_position(const Gfx::Point& editor_position)
Layer* ImageEditor::layer_at_editor_position(const Gfx::IntPoint& editor_position)
{
if (!m_image)
return nullptr;
auto image_position = editor_position_to_image_position(editor_position);
for (ssize_t i = m_image->layer_count() - 1; i >= 0; --i) {
auto& layer = m_image->layer(i);
if (layer.relative_rect().contains(Gfx::Point(image_position.x(), image_position.y())))
if (layer.relative_rect().contains(Gfx::IntPoint(image_position.x(), image_position.y())))
return const_cast<Layer*>(&layer);
}
return nullptr;
@ -350,12 +350,12 @@ void ImageEditor::relayout()
return;
auto& image = *this->image();
Gfx::Size new_size;
Gfx::IntSize new_size;
new_size.set_width(image.size().width() * m_scale);
new_size.set_height(image.size().height() * m_scale);
m_editor_image_rect.set_size(new_size);
Gfx::Point new_location;
Gfx::IntPoint new_location;
new_location.set_x((width() / 2) - (new_size.width() / 2) - (m_pan_origin.x() * m_scale));
new_location.set_y((height() / 2) - (new_size.height() / 2) - (m_pan_origin.y() * m_scale));
m_editor_image_rect.set_location(new_location);

View file

@ -56,7 +56,7 @@ public:
void layers_did_change();
Layer* layer_at_editor_position(const Gfx::Point&);
Layer* layer_at_editor_position(const Gfx::IntPoint&);
Color primary_color() const { return m_primary_color; }
void set_primary_color(Color);
@ -72,12 +72,12 @@ public:
Function<void(Layer*)> on_active_layer_change;
Gfx::FloatRect layer_rect_to_editor_rect(const Layer&, const Gfx::Rect&) const;
Gfx::FloatRect image_rect_to_editor_rect(const Gfx::Rect&) const;
Gfx::FloatRect editor_rect_to_image_rect(const Gfx::Rect&) const;
Gfx::FloatPoint layer_position_to_editor_position(const Layer&, const Gfx::Point&) const;
Gfx::FloatPoint image_position_to_editor_position(const Gfx::Point&) const;
Gfx::FloatPoint editor_position_to_image_position(const Gfx::Point&) const;
Gfx::FloatRect layer_rect_to_editor_rect(const Layer&, const Gfx::IntRect&) const;
Gfx::FloatRect image_rect_to_editor_rect(const Gfx::IntRect&) const;
Gfx::FloatRect editor_rect_to_image_rect(const Gfx::IntRect&) const;
Gfx::FloatPoint layer_position_to_editor_position(const Layer&, const Gfx::IntPoint&) const;
Gfx::FloatPoint image_position_to_editor_position(const Gfx::IntPoint&) const;
Gfx::FloatPoint editor_position_to_image_position(const Gfx::IntPoint&) const;
private:
ImageEditor();
@ -110,11 +110,11 @@ private:
Color m_primary_color { Color::Black };
Color m_secondary_color { Color::White };
Gfx::Rect m_editor_image_rect;
Gfx::IntRect m_editor_image_rect;
float m_scale { 1 };
Gfx::FloatPoint m_pan_origin;
Gfx::FloatPoint m_saved_pan_origin;
Gfx::Point m_click_position;
Gfx::IntPoint m_click_position;
};
}

View file

@ -30,7 +30,7 @@
namespace PixelPaint {
RefPtr<Layer> Layer::create_with_size(const Gfx::Size& size, const String& name)
RefPtr<Layer> Layer::create_with_size(const Gfx::IntSize& size, const String& name)
{
if (size.is_empty())
return nullptr;
@ -41,7 +41,7 @@ RefPtr<Layer> Layer::create_with_size(const Gfx::Size& size, const String& name)
return adopt(*new Layer(size, name));
}
Layer::Layer(const Gfx::Size& size, const String& name)
Layer::Layer(const Gfx::IntSize& size, const String& name)
: m_name(name)
{
m_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, size);

View file

@ -40,19 +40,19 @@ class Layer : public RefCounted<Layer> {
AK_MAKE_NONMOVABLE(Layer);
public:
static RefPtr<Layer> create_with_size(const Gfx::Size&, const String& name);
static RefPtr<Layer> create_with_size(const Gfx::IntSize&, const String& name);
~Layer() {}
const Gfx::Point& location() const { return m_location; }
void set_location(const Gfx::Point& location) { m_location = location; }
const Gfx::IntPoint& location() const { return m_location; }
void set_location(const Gfx::IntPoint& location) { m_location = location; }
const Gfx::Bitmap& bitmap() const { return *m_bitmap; }
Gfx::Bitmap& bitmap() { return *m_bitmap; }
Gfx::Size size() const { return bitmap().size(); }
Gfx::IntSize size() const { return bitmap().size(); }
Gfx::Rect relative_rect() const { return { location(), size() }; }
Gfx::Rect rect() const { return { {}, size() }; }
Gfx::IntRect relative_rect() const { return { location(), size() }; }
Gfx::IntRect rect() const { return { {}, size() }; }
const String& name() const { return m_name; }
void set_name(const String& name) { m_name = name; }
@ -63,10 +63,10 @@ public:
bool is_selected() const { return m_selected; }
private:
explicit Layer(const Gfx::Size&, const String& name);
explicit Layer(const Gfx::IntSize&, const String& name);
String m_name;
Gfx::Point m_location;
Gfx::IntPoint m_location;
RefPtr<Gfx::Bitmap> m_bitmap;
bool m_selected { false };

View file

@ -102,11 +102,11 @@ void LayerListWidget::paint_event(GUI::PaintEvent& event)
painter.draw_rect(adjusted_rect, Color::Black);
Gfx::Rect thumbnail_rect { adjusted_rect.x(), adjusted_rect.y(), adjusted_rect.height(), adjusted_rect.height() };
Gfx::IntRect thumbnail_rect { adjusted_rect.x(), adjusted_rect.y(), adjusted_rect.height(), adjusted_rect.height() };
thumbnail_rect.shrink(8, 8);
painter.draw_scaled_bitmap(thumbnail_rect, layer.bitmap(), layer.bitmap().rect());
Gfx::Rect text_rect { thumbnail_rect.right() + 10, adjusted_rect.y(), adjusted_rect.width(), adjusted_rect.height() };
Gfx::IntRect text_rect { thumbnail_rect.right() + 10, adjusted_rect.y(), adjusted_rect.width(), adjusted_rect.height() };
text_rect.intersect(adjusted_rect);
painter.draw_text(text_rect, layer.name(), Gfx::TextAlignment::CenterLeft, layer.is_selected() ? palette().selection_text() : palette().button_text());
@ -121,7 +121,7 @@ void LayerListWidget::paint_event(GUI::PaintEvent& event)
paint_gadget(m_gadgets[m_moving_gadget_index.value()]);
}
Optional<size_t> LayerListWidget::gadget_at(const Gfx::Point& position)
Optional<size_t> LayerListWidget::gadget_at(const Gfx::IntPoint& position)
{
for (size_t i = 0; i < m_gadgets.size(); ++i) {
if (m_gadgets[i].rect.contains(position))

View file

@ -69,21 +69,21 @@ private:
struct Gadget {
size_t layer_index { 0 };
Gfx::Rect rect;
Gfx::Rect temporary_rect_during_move;
Gfx::IntRect rect;
Gfx::IntRect temporary_rect_during_move;
bool is_moving { false };
Gfx::Point movement_delta;
Gfx::IntPoint movement_delta;
};
bool is_moving_gadget() const { return m_moving_gadget_index.has_value(); }
Optional<size_t> gadget_at(const Gfx::Point&);
Optional<size_t> gadget_at(const Gfx::IntPoint&);
Vector<Gadget> m_gadgets;
RefPtr<Image> m_image;
Optional<size_t> m_moving_gadget_index;
Gfx::Point m_moving_event_origin;
Gfx::IntPoint m_moving_event_origin;
};
}

View file

@ -34,7 +34,7 @@
namespace PixelPaint {
static Gfx::Point constrain_line_angle(const Gfx::Point& start_pos, const Gfx::Point& end_pos, float angle_increment)
static Gfx::IntPoint constrain_line_angle(const Gfx::IntPoint& start_pos, const Gfx::IntPoint& end_pos, float angle_increment)
{
float current_angle = atan2(end_pos.y() - start_pos.y(), end_pos.x() - start_pos.x()) + M_PI * 2.;

View file

@ -49,8 +49,8 @@ private:
virtual const char* class_name() const override { return "LineTool"; }
GUI::MouseButton m_drawing_button { GUI::MouseButton::None };
Gfx::Point m_line_start_position;
Gfx::Point m_line_end_position;
Gfx::IntPoint m_line_start_position;
Gfx::IntPoint m_line_end_position;
RefPtr<GUI::Menu> m_context_menu;
GUI::ActionGroup m_thickness_actions;

View file

@ -46,8 +46,8 @@ private:
virtual bool is_move_tool() const override { return true; }
RefPtr<Layer> m_layer_being_moved;
Gfx::Point m_event_origin;
Gfx::Point m_layer_origin;
Gfx::IntPoint m_event_origin;
Gfx::IntPoint m_layer_origin;
RefPtr<GUI::Menu> m_context_menu;
RefPtr<Layer> m_context_menu_layer;
};

View file

@ -88,7 +88,7 @@ PaletteWidget::PaletteWidget(ImageEditor& editor)
set_secondary_color(m_editor.secondary_color());
m_primary_color_widget = add<GUI::Frame>();
Gfx::Rect rect { 0, 0, 38, 15 };
Gfx::IntRect rect { 0, 0, 38, 15 };
rect.center_within(m_secondary_color_widget->relative_rect());
m_primary_color_widget->set_relative_rect(rect);
m_primary_color_widget->set_fill_with_background_color(true);

View file

@ -64,7 +64,7 @@ void PenTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEvent
return;
GUI::Painter painter(layer.bitmap());
if (m_last_drawing_event_position != Gfx::Point(-1, -1))
if (m_last_drawing_event_position != Gfx::IntPoint(-1, -1))
painter.draw_line(m_last_drawing_event_position, event.position(), m_editor->color_for(event), m_thickness);
else
painter.draw_line(event.position(), event.position(), m_editor->color_for(event), m_thickness);

View file

@ -45,7 +45,7 @@ public:
private:
virtual const char* class_name() const override { return "PenTool"; }
Gfx::Point m_last_drawing_event_position { -1, -1 };
Gfx::IntPoint m_last_drawing_event_position { -1, -1 };
RefPtr<GUI::Menu> m_context_menu;
int m_thickness { 1 };
GUI::ActionGroup m_thickness_actions;

View file

@ -43,7 +43,7 @@ RectangleTool::~RectangleTool()
{
}
void RectangleTool::draw_using(GUI::Painter& painter, const Gfx::Rect& rect)
void RectangleTool::draw_using(GUI::Painter& painter, const Gfx::IntRect& rect)
{
switch (m_mode) {
case Mode::Fill:
@ -78,7 +78,7 @@ void RectangleTool::on_mouseup(Layer& layer, GUI::MouseEvent& event, GUI::MouseE
{
if (event.button() == m_drawing_button) {
GUI::Painter painter(layer.bitmap());
auto rect = Gfx::Rect::from_two_points(m_rectangle_start_position, m_rectangle_end_position);
auto rect = Gfx::IntRect::from_two_points(m_rectangle_start_position, m_rectangle_end_position);
draw_using(painter, rect);
m_drawing_button = GUI::MouseButton::None;
layer.did_modify_bitmap(*m_editor->image());
@ -101,7 +101,7 @@ void RectangleTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event)
GUI::Painter painter(*m_editor);
painter.add_clip_rect(event.rect());
auto rect = Gfx::Rect::from_two_points(m_editor->layer_position_to_editor_position(layer, m_rectangle_start_position).to_int_point(), m_editor->layer_position_to_editor_position(layer, m_rectangle_end_position).to_int_point());
auto rect = Gfx::IntRect::from_two_points(m_editor->layer_position_to_editor_position(layer, m_rectangle_start_position).to_int_point(), m_editor->layer_position_to_editor_position(layer, m_rectangle_end_position).to_int_point());
draw_using(painter, rect);
}

View file

@ -52,11 +52,11 @@ private:
};
virtual const char* class_name() const override { return "RectangleTool"; }
void draw_using(GUI::Painter&, const Gfx::Rect&);
void draw_using(GUI::Painter&, const Gfx::IntRect&);
GUI::MouseButton m_drawing_button { GUI::MouseButton::None };
Gfx::Point m_rectangle_start_position;
Gfx::Point m_rectangle_end_position;
Gfx::IntPoint m_rectangle_start_position;
Gfx::IntPoint m_rectangle_end_position;
RefPtr<GUI::Menu> m_context_menu;
Mode m_mode { Mode::Outline };
};

View file

@ -47,7 +47,7 @@ private:
virtual const char* class_name() const override { return "SprayTool"; }
void paint_it();
RefPtr<Core::Timer> m_timer;
Gfx::Point m_last_pos;
Gfx::IntPoint m_last_pos;
Color m_color;
RefPtr<GUI::Menu> m_context_menu;
GUI::ActionGroup m_thickness_actions;

View file

@ -138,12 +138,12 @@ void QSWidget::relayout()
float scale_factor = (float)m_scale / 100.0f;
Gfx::Size new_size;
Gfx::IntSize new_size;
new_size.set_width(m_bitmap->width() * scale_factor);
new_size.set_height(m_bitmap->height() * scale_factor);
m_bitmap_rect.set_size(new_size);
Gfx::Point new_location;
Gfx::IntPoint new_location;
new_location.set_x((width() / 2) - (new_size.width() / 2) - (m_pan_origin.x() * scale_factor));
new_location.set_y((height() / 2) - (new_size.height() / 2) - (m_pan_origin.y() * scale_factor));
m_bitmap_rect.set_location(new_location);

View file

@ -76,11 +76,11 @@ private:
RefPtr<Gfx::Bitmap> m_bitmap;
int m_toolbar_height { 28 };
Gfx::Rect m_bitmap_rect;
Gfx::IntRect m_bitmap_rect;
int m_scale { 100 };
Gfx::FloatPoint m_pan_origin;
Gfx::Point m_click_position;
Gfx::IntPoint m_click_position;
Gfx::FloatPoint m_saved_pan_origin;
Vector<String> m_files_in_same_dir;
};

View file

@ -60,8 +60,8 @@ void SampleWidget::paint_event(GUI::PaintEvent& event)
++count;
if (count >= samples_per_pixel) {
Gfx::Point min_point = { x, y_offset + static_cast<int>(-sample_max * frame_inner_rect().height() / 2) };
Gfx::Point max_point = { x++, y_offset + static_cast<int>(sample_max * frame_inner_rect().height() / 2) };
Gfx::IntPoint min_point = { x, y_offset + static_cast<int>(-sample_max * frame_inner_rect().height() / 2) };
Gfx::IntPoint max_point = { x++, y_offset + static_cast<int>(sample_max * frame_inner_rect().height() / 2) };
painter.draw_line(min_point, max_point, Color::Green);
count = 0;

View file

@ -53,20 +53,20 @@ void GraphWidget::paint_event(GUI::PaintEvent& event)
auto inner_rect = frame_inner_rect();
float scale = (float)inner_rect.height() / (float)m_max;
Gfx::Point prev_point;
Gfx::IntPoint prev_point;
for (size_t i = 0; i < m_values.size(); ++i) {
int x = inner_rect.right() - (i * 2) + 1;
if (x < 0)
break;
float scaled_value = (float)m_values.at(m_values.size() - i - 1) * scale;
Gfx::Point point = { x, inner_rect.bottom() - (int)scaled_value };
Gfx::IntPoint point = { x, inner_rect.bottom() - (int)scaled_value };
if (i != 0)
painter.draw_line(prev_point, point, m_graph_color);
prev_point = point;
}
if (!m_values.is_empty() && text_formatter) {
Gfx::Rect text_rect = inner_rect.shrunken(8, 8);
Gfx::IntRect text_rect = inner_rect.shrunken(8, 8);
text_rect.set_height(font().glyph_height());
auto text = text_formatter(m_values.last(), m_max);
painter.draw_text(text_rect.translated(1, 1), text.characters(), Gfx::TextAlignment::CenterRight, Color::Black);

View file

@ -37,7 +37,7 @@ class PagemapPaintingDelegate final : public GUI::TableCellPaintingDelegate {
public:
virtual ~PagemapPaintingDelegate() override {}
virtual void paint(GUI::Painter& painter, const Gfx::Rect& a_rect, const Gfx::Palette&, const GUI::Model& model, const GUI::ModelIndex& index) override
virtual void paint(GUI::Painter& painter, const Gfx::IntRect& a_rect, const Gfx::Palette&, const GUI::Model& model, const GUI::ModelIndex& index) override
{
auto rect = a_rect.shrunken(2, 2);
auto pagemap = model.data(index, GUI::Model::Role::Custom).to_string();

View file

@ -287,7 +287,7 @@ class ProgressBarPaintingDelegate final : public GUI::TableCellPaintingDelegate
public:
virtual ~ProgressBarPaintingDelegate() override { }
virtual void paint(GUI::Painter& painter, const Gfx::Rect& a_rect, const Palette& palette, const GUI::Model& model, const GUI::ModelIndex& index) override
virtual void paint(GUI::Painter& painter, const Gfx::IntRect& a_rect, const Palette& palette, const GUI::Model& model, const GUI::ModelIndex& index) override
{
auto rect = a_rect.shrunken(2, 2);
auto percentage = model.data(index, GUI::Model::Role::Custom).to_i32();

View file

@ -156,7 +156,7 @@ int main(int argc, char** argv)
auto window = GUI::Window::construct();
window->set_title("Welcome");
Gfx::Rect window_rect { 0, 0, 640, 360 };
Gfx::IntRect window_rect { 0, 0, 640, 360 };
window_rect.center_within(GUI::Desktop::the().rect());
window->set_resizable(true);
window->set_rect(window_rect);