1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:37:45 +00:00

LibGfx: Draw checkbox check in the center of the checkbox rect

This looks better at larger checkbox sizes than just drawing it in the
top left corner. Ideally we'd have a scalable checkmark, of course.
This commit is contained in:
Andreas Kling 2023-03-02 20:49:29 +01:00
parent ee001cc417
commit 460303b2fe

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2018-2023, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2020, Sarah Taube <metalflakecobaltpaint@gmail.com>
* Copyright (c) 2021, Filiph Sandström <filiph.sandstrom@filfatstudios.com>
* Copyright (c) 2022, Cameron Youell <cameronyouell@gmail.com>
@ -563,7 +563,8 @@ void ClassicStylePainter::paint_check_box(Painter& painter, IntRect const& rect,
}
if (is_checked) {
painter.draw_bitmap(rect.shrunken(4, 4).location(), s_checked_bitmap, is_enabled ? palette.base_text() : palette.threed_shadow1());
auto check_rect = Gfx::IntRect({}, s_checked_bitmap.size()).centered_within(rect);
painter.draw_bitmap(check_rect.location(), s_checked_bitmap, is_enabled ? palette.base_text() : palette.threed_shadow1());
}
}