mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 14:25:06 +00:00
WindowServer: Make WSWindowFrame and WSButton deal in relative coordinates.
This was a bit painful to get right. The code is a lot more pleasant to deal with now that all coordinates are relative to their local system instead of being absolute screen coordinates.
This commit is contained in:
parent
2ac2d79a8e
commit
0d60c56b51
6 changed files with 67 additions and 79 deletions
|
@ -16,8 +16,10 @@ WSButton::~WSButton()
|
|||
|
||||
void WSButton::paint(Painter& painter)
|
||||
{
|
||||
StylePainter::paint_button(painter, m_rect, ButtonStyle::Normal, m_pressed);
|
||||
auto x_location = m_rect.center();
|
||||
PainterStateSaver saver(painter);
|
||||
painter.translate(relative_rect().location());
|
||||
StylePainter::paint_button(painter, rect(), ButtonStyle::Normal, m_pressed);
|
||||
auto x_location = rect().center();
|
||||
x_location.move_by(-(m_bitmap->width() / 2), -(m_bitmap->height() / 2));
|
||||
painter.draw_bitmap(x_location, *m_bitmap, Color::Black);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue