Eyes: Correctly calculate the eye bounds for arbitrary number of eyes
This commit is contained in:
parent
07af2e6b2c
commit
46dacbfb3e
Notes:
sideshowbarker
2024-07-19 06:09:19 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/46dacbfb3e2 Pull-request: https://github.com/SerenityOS/serenity/pull/2378 Reviewed-by: https://github.com/bugaevc ✅
1 changed files with 4 additions and 3 deletions
|
@ -65,11 +65,12 @@ void EyesWidget::render_eyeball(int index, GUI::Painter& painter) const
|
|||
{
|
||||
auto eye_width = width() / m_num_eyes;
|
||||
Gfx::Rect bounds { index * eye_width, 0, eye_width, height() };
|
||||
auto thickness = max((width() + height()) / 15, 1);
|
||||
auto width_thickness = max(int(eye_width / 5.5), 1);
|
||||
auto height_thickness = max(int(height() / 5.5), 1);
|
||||
|
||||
bounds.shrink(width() / 25, 0);
|
||||
bounds.shrink(int(eye_width / 12.5), 0);
|
||||
painter.fill_ellipse(bounds, palette().base_text());
|
||||
bounds.shrink(thickness, thickness);
|
||||
bounds.shrink(width_thickness, height_thickness);
|
||||
painter.fill_ellipse(bounds, palette().base());
|
||||
|
||||
Gfx::Point pupil_center = this->pupil_center(bounds);
|
||||
|
|
Loading…
Add table
Reference in a new issue