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

Ladybird+WebContent: Add option to use GPU painter

Adds `--enable-gpu-painting` param to enable painting command executor
that uses LibAccelGfx.
This commit is contained in:
Aliaksandr Kalenik 2023-10-27 17:28:18 +02:00 committed by Andreas Kling
parent 7d26cbf523
commit b6732b0234
17 changed files with 63 additions and 17 deletions

View file

@ -21,6 +21,10 @@
#include <WebContent/WebContentClientEndpoint.h>
#include <WebContent/WebDriverConnection.h>
#ifdef AK_OS_LINUX
# include <LibWeb/Painting/PaintingCommandExecutorGPU.h>
#endif
namespace WebContent {
PageHost::PageHost(ConnectionFromClient& client)
@ -36,6 +40,13 @@ PageHost::PageHost(ConnectionFromClient& client)
PageHost::~PageHost() = default;
static bool s_use_gpu_painter = false;
void PageHost::set_use_gpu_painter()
{
s_use_gpu_painter = true;
}
void PageHost::set_has_focus(bool has_focus)
{
m_has_focus = has_focus;
@ -145,8 +156,15 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ
context.set_has_focus(m_has_focus);
document->paintable()->paint_all_phases(context);
Web::Painting::PaintingCommandExecutorCPU painting_command_executor(target);
recording_painter.execute(painting_command_executor);
if (s_use_gpu_painter) {
#ifdef AK_OS_LINUX
Web::Painting::PaintingCommandExecutorGPU painting_command_executor(target);
recording_painter.execute(painting_command_executor);
#endif
} else {
Web::Painting::PaintingCommandExecutorCPU painting_command_executor(target);
recording_painter.execute(painting_command_executor);
}
}
void PageHost::set_viewport_rect(Web::DevicePixelRect const& rect)