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

@ -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;
};