blob: 6bd0072b6147237d7b5a9b587f5e99d21754a64e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Forward.h>
#include <AK/Function.h>
#include <AK/NonnullRefPtr.h>
#include <AK/RefCounted.h>
#include <LibCore/ElapsedTimer.h>
#include <LibGfx/Forward.h>
namespace WindowServer {
class Compositor;
class Screen;
class Animation : public RefCounted<Animation> {
public:
static NonnullRefPtr<Animation> create() { return adopt_ref(*new Animation); }
~Animation();
bool is_running() const { return m_running; }
void start();
void stop();
void set_length(int length_in_ms);
int length() const { return m_length; }
void update(Badge<Compositor>, Gfx::Painter&, Screen&, Gfx::DisjointRectSet& flush_rects);
Function<void(float progress, Gfx::Painter&, Screen&, Gfx::DisjointRectSet& flush_rects)> on_update;
Function<void()> on_stop;
private:
Animation();
Core::ElapsedTimer m_timer;
int m_length { 0 };
bool m_running { false };
};
}
|