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

@ -118,10 +118,10 @@ void Compositor::compose()
return;
}
dirty_rects.add(Gfx::Rect::intersection(m_last_geometry_label_rect, Screen::the().rect()));
dirty_rects.add(Gfx::Rect::intersection(m_last_cursor_rect, Screen::the().rect()));
dirty_rects.add(Gfx::Rect::intersection(m_last_dnd_rect, Screen::the().rect()));
dirty_rects.add(Gfx::Rect::intersection(current_cursor_rect(), Screen::the().rect()));
dirty_rects.add(Gfx::IntRect::intersection(m_last_geometry_label_rect, Screen::the().rect()));
dirty_rects.add(Gfx::IntRect::intersection(m_last_cursor_rect, Screen::the().rect()));
dirty_rects.add(Gfx::IntRect::intersection(m_last_dnd_rect, Screen::the().rect()));
dirty_rects.add(Gfx::IntRect::intersection(current_cursor_rect(), Screen::the().rect()));
auto any_dirty_rect_intersects_window = [&dirty_rects](const Window& window) {
auto window_frame_rect = window.frame().rect();
@ -148,7 +148,7 @@ void Compositor::compose()
if (m_wallpaper_mode == WallpaperMode::Simple) {
m_back_painter->blit(dirty_rect.location(), *m_wallpaper, dirty_rect);
} else if (m_wallpaper_mode == WallpaperMode::Center) {
Gfx::Point offset { ws.size().width() / 2 - m_wallpaper->size().width() / 2,
Gfx::IntPoint offset { ws.size().width() / 2 - m_wallpaper->size().width() / 2,
ws.size().height() / 2 - m_wallpaper->size().height() / 2 };
m_back_painter->blit_offset(dirty_rect.location(), *m_wallpaper,
dirty_rect, offset);
@ -191,7 +191,7 @@ void Compositor::compose()
// we want to try to blit the backing store at the same place
// it was previously, and fill the rest of the window with its
// background color.
Gfx::Rect backing_rect;
Gfx::IntRect backing_rect;
backing_rect.set_size(backing_store->size());
switch (WindowManager::the().resize_direction_of_window(window)) {
case ResizeDirection::None:
@ -216,7 +216,7 @@ void Compositor::compose()
break;
}
Gfx::Rect dirty_rect_in_backing_coordinates = dirty_rect
Gfx::IntRect dirty_rect_in_backing_coordinates = dirty_rect
.intersected(window.rect())
.intersected(backing_rect)
.translated(-backing_rect.location());
@ -259,9 +259,9 @@ void Compositor::compose()
flush(r);
}
void Compositor::flush(const Gfx::Rect& a_rect)
void Compositor::flush(const Gfx::IntRect& a_rect)
{
auto rect = Gfx::Rect::intersection(a_rect, Screen::the().rect());
auto rect = Gfx::IntRect::intersection(a_rect, Screen::the().rect());
Gfx::RGBA32* front_ptr = m_front_bitmap->scanline(rect.y()) + rect.x();
Gfx::RGBA32* back_ptr = m_back_bitmap->scanline(rect.y()) + rect.x();
@ -300,9 +300,9 @@ void Compositor::invalidate()
invalidate(Screen::the().rect());
}
void Compositor::invalidate(const Gfx::Rect& a_rect)
void Compositor::invalidate(const Gfx::IntRect& a_rect)
{
auto rect = Gfx::Rect::intersection(a_rect, Screen::the().rect());
auto rect = Gfx::IntRect::intersection(a_rect, Screen::the().rect());
if (rect.is_empty())
return;
@ -384,7 +384,7 @@ void Compositor::run_animations()
float width_delta_per_step = (float)(from_rect.width() - to_rect.width()) / minimize_animation_steps;
float height_delta_per_step = (float)(from_rect.height() - to_rect.height()) / minimize_animation_steps;
Gfx::Rect rect {
Gfx::IntRect rect {
from_rect.x() - (int)(x_delta_per_step * animation_index),
from_rect.y() - (int)(y_delta_per_step * animation_index),
from_rect.width() - (int)(width_delta_per_step * animation_index),
@ -421,7 +421,7 @@ bool Compositor::set_resolution(int desired_width, int desired_height)
return success;
}
Gfx::Rect Compositor::current_cursor_rect() const
Gfx::IntRect Compositor::current_cursor_rect() const
{
auto& wm = WindowManager::the();
return { Screen::the().cursor_location().translated(-wm.active_cursor().hotspot()), wm.active_cursor().size() };
@ -449,7 +449,7 @@ void Compositor::draw_geometry_label()
int height_steps = (window_being_moved_or_resized->height() - window_being_moved_or_resized->base_size().height()) / window_being_moved_or_resized->size_increment().height();
geometry_string = String::format("%s (%dx%d)", geometry_string.characters(), width_steps, height_steps);
}
auto geometry_label_rect = Gfx::Rect { 0, 0, wm.font().width(geometry_string) + 16, wm.font().glyph_height() + 10 };
auto geometry_label_rect = Gfx::IntRect { 0, 0, wm.font().width(geometry_string) + 16, wm.font().glyph_height() + 10 };
geometry_label_rect.center_within(window_being_moved_or_resized->rect());
m_back_painter->fill_rect(geometry_label_rect, wm.palette().window());
m_back_painter->draw_rect(geometry_label_rect, wm.palette().threed_shadow2());
@ -460,7 +460,7 @@ void Compositor::draw_geometry_label()
void Compositor::draw_cursor()
{
auto& wm = WindowManager::the();
Gfx::Rect cursor_rect = current_cursor_rect();
Gfx::IntRect cursor_rect = current_cursor_rect();
m_back_painter->blit(cursor_rect.location(), wm.active_cursor().bitmap(), wm.active_cursor().rect());
if (wm.dnd_client()) {
@ -504,7 +504,7 @@ void Compositor::decrement_display_link_count(Badge<ClientConnection>)
m_display_link_notify_timer->stop();
}
bool Compositor::any_opaque_window_contains_rect(const Gfx::Rect& rect)
bool Compositor::any_opaque_window_contains_rect(const Gfx::IntRect& rect)
{
bool found_containing_window = false;
WindowManager::the().for_each_visible_window_from_back_to_front([&](Window& window) {
@ -527,7 +527,7 @@ bool Compositor::any_opaque_window_contains_rect(const Gfx::Rect& rect)
};
bool Compositor::any_opaque_window_above_this_one_contains_rect(const Window& a_window, const Gfx::Rect& rect)
bool Compositor::any_opaque_window_above_this_one_contains_rect(const Window& a_window, const Gfx::IntRect& rect)
{
bool found_containing_window = false;
bool checking = false;