LibGfx: Draw checked buttons with a dithered base background

This looks just so right in the taskbar. :^)
This commit is contained in:
Andreas Kling 2020-12-14 21:47:07 +01:00
parent 396b09a1ec
commit 96233bfc53
Notes: sideshowbarker 2024-07-19 00:52:22 +09:00

View File

@ -113,7 +113,11 @@ static void paint_button_new(Painter& painter, const IntRect& rect, const Palett
if (pressed || checked) {
// Base
painter.fill_rect({ 1, 1, rect.width() - 2, rect.height() - 2 }, button_color);
Gfx::IntRect base_rect { 1, 1, rect.width() - 2, rect.height() - 2 };
if (checked && !pressed)
painter.fill_rect_with_dither_pattern(base_rect, palette.button().lightened(1.3f), palette.button());
else
painter.fill_rect(base_rect, button_color);
// Top shadow
painter.draw_line({ 0, 0 }, { rect.width() - 2, 0 }, shadow_color2);