summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Sommer <erik.sommer@slub-dresden.de>2021-06-28 20:38:44 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-28 22:29:39 +0200
commitb12e5de04787680ce53955650b510bae9b26d325 (patch)
tree80040c73e3b67370b3f7498c86790f7e52b65dc4
parent0cb937416bdb6adc3a661d0f87f076ce24c4617f (diff)
downloadserenity-b12e5de04787680ce53955650b510bae9b26d325.zip
WindowServer: Change animation time to duration
The time interval for animations is most often described as `duration` in animation contexts and the `WindowServer::Animation` class should reflect that.
-rw-r--r--Userland/Services/WindowServer/Animation.cpp6
-rw-r--r--Userland/Services/WindowServer/Animation.h6
-rw-r--r--Userland/Services/WindowServer/Window.cpp4
3 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Services/WindowServer/Animation.cpp b/Userland/Services/WindowServer/Animation.cpp
index bb35691b4d..7ff6197a25 100644
--- a/Userland/Services/WindowServer/Animation.cpp
+++ b/Userland/Services/WindowServer/Animation.cpp
@@ -20,9 +20,9 @@ Animation::~Animation()
Compositor::the().unregister_animation({}, *this);
}
-void Animation::set_length(int length_in_ms)
+void Animation::set_duration(int duration_in_ms)
{
- m_length = length_in_ms;
+ m_duration = duration_in_ms;
}
void Animation::start()
@@ -41,7 +41,7 @@ void Animation::stop()
void Animation::update(Badge<Compositor>, Gfx::Painter& painter, Screen& screen, Gfx::DisjointRectSet& flush_rects)
{
int elapsed_ms = m_timer.elapsed();
- float progress = min((float)elapsed_ms / (float)m_length, 1.0f);
+ float progress = min((float)elapsed_ms / (float)m_duration, 1.0f);
if (on_update)
on_update(progress, painter, screen, flush_rects);
diff --git a/Userland/Services/WindowServer/Animation.h b/Userland/Services/WindowServer/Animation.h
index 6bd0072b61..b8786d8734 100644
--- a/Userland/Services/WindowServer/Animation.h
+++ b/Userland/Services/WindowServer/Animation.h
@@ -29,8 +29,8 @@ public:
void start();
void stop();
- void set_length(int length_in_ms);
- int length() const { return m_length; }
+ void set_duration(int duration_in_ms);
+ int duration() const { return m_duration; }
void update(Badge<Compositor>, Gfx::Painter&, Screen&, Gfx::DisjointRectSet& flush_rects);
@@ -41,7 +41,7 @@ private:
Animation();
Core::ElapsedTimer m_timer;
- int m_length { 0 };
+ int m_duration { 0 };
bool m_running { false };
};
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index 569a2e75a8..76f92ac1c1 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -346,7 +346,7 @@ void Window::start_minimize_animation()
}
m_animation = Animation::create();
- m_animation->set_length(150);
+ m_animation->set_duration(150);
m_animation->on_update = [this](float progress, Gfx::Painter& painter, Screen& screen, Gfx::DisjointRectSet& flush_rects) {
Gfx::PainterStateSaver saver(painter);
painter.set_draw_op(Gfx::Painter::DrawOp::Invert);
@@ -369,7 +369,7 @@ void Window::start_minimize_animation()
void Window::start_launch_animation(Gfx::IntRect const& launch_origin_rect)
{
m_animation = Animation::create();
- m_animation->set_length(150);
+ m_animation->set_duration(150);
m_animation->on_update = [this, launch_origin_rect](float progress, Gfx::Painter& painter, Screen& screen, Gfx::DisjointRectSet& flush_rects) {
Gfx::PainterStateSaver saver(painter);
painter.set_draw_op(Gfx::Painter::DrawOp::Invert);