Skip to content

Commit

Permalink
LibGUI: Fix 1px misalignment of ColorButton selections in ColorPicker
Browse files Browse the repository at this point in the history
Also use shrunken() to calculate the selection rects.
  • Loading branch information
xTibor authored and awesomekling committed Oct 2, 2020
1 parent a2ffe95 commit 18c67b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Libraries/LibGUI/ColorPicker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,12 @@ void ColorButton::paint_event(PaintEvent& event)

Gfx::StylePainter::paint_button(painter, rect(), palette(), Gfx::ButtonStyle::Normal, is_being_pressed(), is_hovered(), is_checked(), is_enabled());

painter.fill_rect({ 1, 1, rect().width() - 2, rect().height() - 2 }, m_color);
painter.fill_rect(rect().shrunken(2, 2), m_color);

if (m_selected) {
painter.fill_rect({ 3, 3, rect().width() - 6, rect().height() - 6 }, Color::Black);
painter.fill_rect({ 5, 5, rect().width() - 10, rect().height() - 10 }, Color::White);
painter.fill_rect({ 7, 6, rect().width() - 14, rect().height() - 14 }, m_color);
painter.fill_rect(rect().shrunken(6, 6), Color::Black);
painter.fill_rect(rect().shrunken(10, 10), Color::White);
painter.fill_rect(rect().shrunken(14, 14), m_color);
}
}

Expand Down

0 comments on commit 18c67b4

Please sign in to comment.