LibGfx+LibWeb: Reuse DisplayListPlayer and PaintingSurface when possible

Previously, we were reinstantiating the DisplayListPlayer and
PaintingSurface on every paint.
This commit is contained in:
Jelle Raaijmakers 2025-01-29 10:24:57 +01:00 committed by Alexander Kalenik
commit 342cb7addf
Notes: github-actions[bot] 2025-01-31 12:29:12 +00:00
12 changed files with 107 additions and 104 deletions

View file

@ -14,21 +14,13 @@ class GrDirectContext;
namespace Web::Painting {
class DisplayListPlayerSkia : public DisplayListPlayer {
class DisplayListPlayerSkia final : public DisplayListPlayer {
public:
DisplayListPlayerSkia(Gfx::Bitmap&);
#ifdef USE_VULKAN
DisplayListPlayerSkia(Gfx::SkiaBackendContext&, Gfx::Bitmap&);
#endif
#ifdef AK_OS_MACOS
DisplayListPlayerSkia(Gfx::SkiaBackendContext&, NonnullRefPtr<Gfx::PaintingSurface>);
#endif
virtual ~DisplayListPlayerSkia() override;
DisplayListPlayerSkia(RefPtr<Gfx::SkiaBackendContext>);
DisplayListPlayerSkia();
private:
void flush() override;
void draw_glyph_run(DrawGlyphRun const&) override;
void fill_rect(FillRect const&) override;
void draw_painting_surface(DrawPaintingSurface const&) override;
@ -68,12 +60,7 @@ private:
bool would_be_fully_clipped_by_painter(Gfx::IntRect) const override;
Gfx::PaintingSurface& surface() const;
RefPtr<Gfx::SkiaBackendContext> m_context {};
RefPtr<Gfx::PaintingSurface> m_surface {};
Function<void()> m_flush_context;
RefPtr<Gfx::SkiaBackendContext> m_context;
};
}