mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Ladybird+LibWeb+WebContent: Add an option to enable Skia painter
This commit is contained in:
parent
8a7cd8055f
commit
25c4355406
Notes:
sideshowbarker
2024-07-17 05:23:40 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/25c4355406 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/182 Reviewed-by: https://github.com/ADKaster
7 changed files with 26 additions and 0 deletions
|
@ -89,6 +89,8 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
|||
arguments.append("--use-lagom-networking"sv);
|
||||
if (web_content_options.enable_gpu_painting == Ladybird::EnableGPUPainting::Yes)
|
||||
arguments.append("--use-gpu-painting"sv);
|
||||
if (web_content_options.enable_skia_painting == Ladybird::EnableSkiaPainting::Yes)
|
||||
arguments.append("--use-skia-painting"sv);
|
||||
if (web_content_options.enable_experimental_cpu_transforms == Ladybird::EnableExperimentalCPUTransforms::Yes)
|
||||
arguments.append("--experimental-cpu-transforms"sv);
|
||||
if (web_content_options.wait_for_debugger == Ladybird::WaitForDebugger::Yes)
|
||||
|
|
|
@ -96,6 +96,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool enable_qt_networking = false;
|
||||
bool expose_internals_object = false;
|
||||
bool use_gpu_painting = false;
|
||||
bool use_skia_painting = false;
|
||||
bool use_experimental_cpu_transform_support = false;
|
||||
bool debug_web_content = false;
|
||||
bool log_all_js_exceptions = false;
|
||||
|
@ -112,6 +113,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(disable_sql_database, "Disable SQL database", "disable-sql-database");
|
||||
args_parser.add_option(enable_qt_networking, "Enable Qt as the backend networking service", "enable-qt-networking");
|
||||
args_parser.add_option(use_gpu_painting, "Enable GPU painting", "enable-gpu-painting");
|
||||
args_parser.add_option(use_skia_painting, "Enable Skia painting", "enable-skia-painting");
|
||||
args_parser.add_option(use_experimental_cpu_transform_support, "Enable experimental CPU transform support", "experimental-cpu-transforms");
|
||||
args_parser.add_option(debug_web_content, "Wait for debugger to attach to WebContent", "debug-web-content");
|
||||
args_parser.add_option(certificates, "Path to a certificate file", "certificate", 'C', "certificate");
|
||||
|
@ -175,6 +177,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
.enable_callgrind_profiling = enable_callgrind_profiling ? Ladybird::EnableCallgrindProfiling::Yes : Ladybird::EnableCallgrindProfiling::No,
|
||||
.enable_gpu_painting = use_gpu_painting ? Ladybird::EnableGPUPainting::Yes : Ladybird::EnableGPUPainting::No,
|
||||
.enable_experimental_cpu_transforms = use_experimental_cpu_transform_support ? Ladybird::EnableExperimentalCPUTransforms::Yes : Ladybird::EnableExperimentalCPUTransforms::No,
|
||||
.enable_skia_painting = use_skia_painting ? Ladybird::EnableSkiaPainting::Yes : Ladybird::EnableSkiaPainting::No,
|
||||
.use_lagom_networking = enable_qt_networking ? Ladybird::UseLagomNetworking::No : Ladybird::UseLagomNetworking::Yes,
|
||||
.wait_for_debugger = debug_web_content ? Ladybird::WaitForDebugger::Yes : Ladybird::WaitForDebugger::No,
|
||||
.log_all_js_exceptions = log_all_js_exceptions ? Ladybird::LogAllJSExceptions::Yes : Ladybird::LogAllJSExceptions::No,
|
||||
|
|
|
@ -25,6 +25,11 @@ enum class EnableExperimentalCPUTransforms {
|
|||
Yes
|
||||
};
|
||||
|
||||
enum class EnableSkiaPainting {
|
||||
No,
|
||||
Yes
|
||||
};
|
||||
|
||||
enum class IsLayoutTestMode {
|
||||
No,
|
||||
Yes
|
||||
|
@ -61,6 +66,7 @@ struct WebContentOptions {
|
|||
EnableCallgrindProfiling enable_callgrind_profiling { EnableCallgrindProfiling::No };
|
||||
EnableGPUPainting enable_gpu_painting { EnableGPUPainting::No };
|
||||
EnableExperimentalCPUTransforms enable_experimental_cpu_transforms { EnableExperimentalCPUTransforms::No };
|
||||
EnableSkiaPainting enable_skia_painting { EnableSkiaPainting::No };
|
||||
IsLayoutTestMode is_layout_test_mode { IsLayoutTestMode::No };
|
||||
UseLagomNetworking use_lagom_networking { UseLagomNetworking::Yes };
|
||||
WaitForDebugger wait_for_debugger { WaitForDebugger::No };
|
||||
|
|
|
@ -98,6 +98,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
bool use_lagom_networking = false;
|
||||
bool use_gpu_painting = false;
|
||||
bool use_experimental_cpu_transform_support = false;
|
||||
bool use_skia_painter = false;
|
||||
bool wait_for_debugger = false;
|
||||
bool log_all_js_exceptions = false;
|
||||
bool enable_idl_tracing = false;
|
||||
|
@ -111,6 +112,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.add_option(use_lagom_networking, "Enable Lagom servers for networking", "use-lagom-networking");
|
||||
args_parser.add_option(use_gpu_painting, "Enable GPU painting", "use-gpu-painting");
|
||||
args_parser.add_option(use_experimental_cpu_transform_support, "Enable experimental CPU transform support", "experimental-cpu-transforms");
|
||||
args_parser.add_option(use_skia_painter, "Enable Skia painter", "use-skia-painting");
|
||||
args_parser.add_option(wait_for_debugger, "Wait for debugger", "wait-for-debugger");
|
||||
args_parser.add_option(mach_server_name, "Mach server name", "mach-server-name", 0, "mach_server_name");
|
||||
args_parser.add_option(log_all_js_exceptions, "Log all JavaScript exceptions", "log-all-js-exceptions");
|
||||
|
@ -132,6 +134,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
WebContent::PageClient::set_use_gpu_painter();
|
||||
}
|
||||
|
||||
if (use_skia_painter) {
|
||||
WebContent::PageClient::set_use_skia_painter();
|
||||
}
|
||||
|
||||
if (use_experimental_cpu_transform_support) {
|
||||
WebContent::PageClient::set_use_experimental_cpu_transform_support();
|
||||
}
|
||||
|
|
|
@ -270,6 +270,7 @@ struct PaintOptions {
|
|||
bool has_focus { false };
|
||||
|
||||
bool use_gpu_painter { false };
|
||||
bool use_skia_painter { false };
|
||||
bool use_experimental_cpu_transform_support { false };
|
||||
|
||||
#ifdef HAS_ACCELERATED_GRAPHICS
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace WebContent {
|
|||
|
||||
static bool s_use_gpu_painter = false;
|
||||
static bool s_use_experimental_cpu_transform_support = false;
|
||||
static bool s_use_skia_painter = false;
|
||||
|
||||
JS_DEFINE_ALLOCATOR(PageClient);
|
||||
|
||||
|
@ -41,6 +42,11 @@ void PageClient::set_use_gpu_painter()
|
|||
s_use_gpu_painter = true;
|
||||
}
|
||||
|
||||
void PageClient::set_use_skia_painter()
|
||||
{
|
||||
s_use_skia_painter = true;
|
||||
}
|
||||
|
||||
void PageClient::set_use_experimental_cpu_transform_support()
|
||||
{
|
||||
s_use_experimental_cpu_transform_support = true;
|
||||
|
@ -220,6 +226,7 @@ void PageClient::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& ta
|
|||
paint_options.accelerated_graphics_context = m_accelerated_graphics_context.ptr();
|
||||
#endif
|
||||
paint_options.use_gpu_painter = s_use_gpu_painter;
|
||||
paint_options.use_skia_painter = s_use_skia_painter;
|
||||
paint_options.use_experimental_cpu_transform_support = s_use_experimental_cpu_transform_support;
|
||||
page().top_level_traversable()->paint(content_rect, target, paint_options);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
virtual ~PageClient() override;
|
||||
|
||||
static void set_use_gpu_painter();
|
||||
static void set_use_skia_painter();
|
||||
static void set_use_experimental_cpu_transform_support();
|
||||
|
||||
virtual void schedule_repaint() override;
|
||||
|
|
Loading…
Reference in a new issue