summaryrefslogtreecommitdiff
path: root/Demos/Eyes
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2020-05-25 21:11:04 +0430
committerAndreas Kling <kling@serenityos.org>2020-05-25 19:06:06 +0200
commit46dacbfb3e2f63b2f4c63d34db7e856ed469932b (patch)
treeaeae9a6445ac0624a4a1a63ab243dcfd404001d8 /Demos/Eyes
parent07af2e6b2cf2dd0f6bd94e8918f5a1894d83633b (diff)
downloadserenity-46dacbfb3e2f63b2f4c63d34db7e856ed469932b.zip
Eyes: Correctly calculate the eye bounds for arbitrary number of eyes
Diffstat (limited to 'Demos/Eyes')
-rw-r--r--Demos/Eyes/EyesWidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/Demos/Eyes/EyesWidget.cpp b/Demos/Eyes/EyesWidget.cpp
index e7a229c33c..b26f856daa 100644
--- a/Demos/Eyes/EyesWidget.cpp
+++ b/Demos/Eyes/EyesWidget.cpp
@@ -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);