1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibGfx+Overall: Remove is_null from Point, Rect and Size

Having a `Point`, `Rect` or `Size` claim it's `null` is silly. We have
`Optional<T>` for that. For `Point`, rename `is_null` to `is_zero` to
better reflect what we're testing. For `Rect` and `Size`, `is_null` is
removed outright.

Also, remove `is_empty` from `Point`. Points can't be empty.
This commit is contained in:
Jelle Raaijmakers 2022-12-28 22:43:30 +01:00 committed by Tim Flynn
parent d5630bd20e
commit 7b0adee487
12 changed files with 20 additions and 22 deletions

View file

@ -175,7 +175,7 @@ void Scrollbar::paint_event(PaintEvent& event)
hovered_component_for_painting = Component::None;
painter.fill_rect_with_dither_pattern(rect(), palette().button().lightened(1.3f), palette().button());
if (m_gutter_click_state != GutterClickState::NotPressed && has_scrubber() && !scrubber_rect().is_null() && hovered_component_for_painting == Component::Gutter) {
if (m_gutter_click_state != GutterClickState::NotPressed && has_scrubber() && !scrubber_rect().is_empty() && hovered_component_for_painting == Component::Gutter) {
Gfx::IntRect rect_to_fill = rect();
if (orientation() == Orientation::Vertical) {
if (m_gutter_click_state == GutterClickState::BeforeScrubber) {
@ -221,7 +221,7 @@ void Scrollbar::paint_event(PaintEvent& event)
painter.draw_triangle(increment_location, orientation() == Orientation::Vertical ? s_down_arrow_coords : s_right_arrow_coords, (has_scrubber() && is_enabled() && !is_max()) ? palette().button_text() : palette().threed_shadow1());
}
if (has_scrubber() && !scrubber_rect().is_null())
if (has_scrubber() && !scrubber_rect().is_empty())
Gfx::StylePainter::paint_button(painter, scrubber_rect(), palette(), Gfx::ButtonStyle::ThickCap, false, hovered_component_for_painting == Component::Scrubber || m_pressed_component == Component::Scrubber);
}