1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:57:35 +00:00

WebContent: Coalesce pending paint events to reduce overdraw

Instead of painting synchronously whenever a Paint request comes in,
the WebContent process will now buffer pending paints and coalesce
them and defer the actual paint using a zero-timer.

This significantly reduces flickering already, without doing any
double-buffering in the WebContentView widget.
This commit is contained in:
Andreas Kling 2020-07-05 16:26:15 +02:00
parent ddbdd0e686
commit 668fe61b1d
2 changed files with 29 additions and 2 deletions

View file

@ -58,7 +58,16 @@ private:
virtual void handle(const Messages::WebContentServer::MouseMove&) override;
virtual void handle(const Messages::WebContentServer::MouseUp&) override;
void flush_pending_paint_requests();
NonnullOwnPtr<PageHost> m_page_host;
struct PaintRequest {
Gfx::IntRect content_rect;
NonnullRefPtr<Gfx::Bitmap> bitmap;
};
Vector<PaintRequest> m_pending_paint_requests;
RefPtr<Core::Timer> m_paint_flush_timer;
};
}