mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 01:17:46 +00:00
WindowServer: Add a more generic mechanism for animations
This patch adds the WindowServer::Animation class, which represents a simple animation driven by the compositor. An animation has a length (in milliseconds) and two hooks: - on_update: called whenever the animation should render something. - on_stop: called when the animation is finished and/or stopped. This patch also ports the window minimization animation to this new mechanism. :^)
This commit is contained in:
parent
1f33c517df
commit
75f870a93f
7 changed files with 171 additions and 70 deletions
|
@ -16,6 +16,7 @@
|
|||
|
||||
namespace WindowServer {
|
||||
|
||||
class Animation;
|
||||
class ClientConnection;
|
||||
class Cursor;
|
||||
class MultiScaleBitmaps;
|
||||
|
@ -95,11 +96,12 @@ public:
|
|||
const Gfx::Bitmap* cursor_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const;
|
||||
const Gfx::Bitmap& front_bitmap_for_screenshot(Badge<ClientConnection>, Screen&) const;
|
||||
|
||||
void register_animation(Badge<Animation>, Animation&);
|
||||
void unregister_animation(Badge<Animation>, Animation&);
|
||||
|
||||
private:
|
||||
Compositor();
|
||||
void init_bitmaps();
|
||||
bool render_animation_frame(Screen&, Gfx::DisjointRectSet&);
|
||||
void step_animations();
|
||||
void invalidate_current_screen_number_rects();
|
||||
void overlays_theme_changed();
|
||||
|
||||
|
@ -114,6 +116,7 @@ private:
|
|||
bool any_opaque_window_above_this_one_contains_rect(const Window&, const Gfx::IntRect&);
|
||||
void change_cursor(const Cursor*);
|
||||
void flush(Screen&);
|
||||
void update_animations(Screen&, Gfx::DisjointRectSet& flush_rects);
|
||||
|
||||
RefPtr<Core::Timer> m_compose_timer;
|
||||
RefPtr<Core::Timer> m_immediate_compose_timer;
|
||||
|
@ -195,6 +198,8 @@ private:
|
|||
|
||||
size_t m_show_screen_number_count { 0 };
|
||||
Optional<Gfx::Color> m_custom_background_color;
|
||||
|
||||
HashTable<Animation*> m_animations;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue