1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibGfx: Make Rect<T> methods work when T is not int or float

Putting the implementations in the .cpp file meant that they only
existed for `IntRect` and `FloatRect`, since those were instantiated at
the bottom of the file. Now they work for other types. :^)

A couple of places in WindowServer had to be modified to disambiguate
between the two `Rect::intersected()` overloads.

Co-authored-by: davidot <davidot@serenityos.org>
This commit is contained in:
Sam Atkins 2022-10-19 19:55:34 +01:00 committed by Linus Groh
parent ae950816b5
commit 732aa2c5c7
4 changed files with 280 additions and 310 deletions

View file

@ -349,7 +349,7 @@ void WindowFrame::PerScaleRenderedCache::paint(WindowFrame& frame, Gfx::Painter&
auto top_bottom_height = frame_rect.height() - window_rect.height();
if (m_bottom_y > 0) {
// We have a top piece
auto src_rect = rect.intersected({ frame_rect.location(), { frame_rect.width(), m_bottom_y } });
auto src_rect = rect.intersected(Gfx::Rect { frame_rect.location(), { frame_rect.width(), m_bottom_y } });
if (!src_rect.is_empty())
painter.blit(src_rect.location(), *m_top_bottom, src_rect.translated(-frame_rect.location()), frame.opacity());
}