mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibGfx: Use same order for macOS and Vulkan specific code
No functional changes.
This commit is contained in:
parent
4fbeea6482
commit
1d81c4d8eb
Notes:
github-actions[bot]
2025-01-31 12:29:33 +00:00
Author: https://github.com/gmta
Commit: 1d81c4d8eb
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3400
Reviewed-by: https://github.com/kalenikaliaksandr
3 changed files with 25 additions and 26 deletions
|
@ -9,14 +9,14 @@
|
||||||
#include <AK/Noncopyable.h>
|
#include <AK/Noncopyable.h>
|
||||||
#include <AK/RefCounted.h>
|
#include <AK/RefCounted.h>
|
||||||
|
|
||||||
#ifdef AK_OS_MACOS
|
|
||||||
# include <LibGfx/MetalContext.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_VULKAN
|
#ifdef USE_VULKAN
|
||||||
# include <LibGfx/VulkanContext.h>
|
# include <LibGfx/VulkanContext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef AK_OS_MACOS
|
||||||
|
# include <LibGfx/MetalContext.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
class GrDirectContext;
|
class GrDirectContext;
|
||||||
class SkSurface;
|
class SkSurface;
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ class SkiaBackendContext : public RefCounted<SkiaBackendContext> {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef USE_VULKAN
|
#ifdef USE_VULKAN
|
||||||
static RefPtr<SkiaBackendContext> create_vulkan_context(Gfx::VulkanContext&);
|
static RefPtr<SkiaBackendContext> create_vulkan_context(VulkanContext&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AK_OS_MACOS
|
#ifdef AK_OS_MACOS
|
||||||
static RefPtr<Gfx::SkiaBackendContext> create_metal_context(MetalContext&);
|
static RefPtr<SkiaBackendContext> create_metal_context(MetalContext&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SkiaBackendContext() { }
|
SkiaBackendContext() { }
|
||||||
|
|
|
@ -29,14 +29,6 @@ TraversableNavigable::TraversableNavigable(GC::Ref<Page> page)
|
||||||
: Navigable(page)
|
: Navigable(page)
|
||||||
, m_session_history_traversal_queue(vm().heap().allocate<SessionHistoryTraversalQueue>())
|
, m_session_history_traversal_queue(vm().heap().allocate<SessionHistoryTraversalQueue>())
|
||||||
{
|
{
|
||||||
#ifdef AK_OS_MACOS
|
|
||||||
auto display_list_player_type = page->client().display_list_player_type();
|
|
||||||
if (display_list_player_type == DisplayListPlayerType::SkiaGPUIfAvailable)
|
|
||||||
auto metal_context = Gfx::get_metal_context();
|
|
||||||
m_skia_backend_context = Gfx::SkiaBackendContext::create_metal_context(*metal_context);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_VULKAN
|
#ifdef USE_VULKAN
|
||||||
auto display_list_player_type = page->client().display_list_player_type();
|
auto display_list_player_type = page->client().display_list_player_type();
|
||||||
if (display_list_player_type == DisplayListPlayerType::SkiaGPUIfAvailable) {
|
if (display_list_player_type == DisplayListPlayerType::SkiaGPUIfAvailable) {
|
||||||
|
@ -49,6 +41,13 @@ TraversableNavigable::TraversableNavigable(GC::Ref<Page> page)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef AK_OS_MACOS
|
||||||
|
auto display_list_player_type = page->client().display_list_player_type();
|
||||||
|
if (display_list_player_type == DisplayListPlayerType::SkiaGPUIfAvailable)
|
||||||
|
auto metal_context = Gfx::get_metal_context();
|
||||||
|
m_skia_backend_context = Gfx::SkiaBackendContext::create_metal_context(*metal_context);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TraversableNavigable::~TraversableNavigable() = default;
|
TraversableNavigable::~TraversableNavigable() = default;
|
||||||
|
@ -1402,19 +1401,19 @@ void TraversableNavigable::paint(DevicePixelRect const& content_rect, Painting::
|
||||||
|
|
||||||
switch (page().client().display_list_player_type()) {
|
switch (page().client().display_list_player_type()) {
|
||||||
case DisplayListPlayerType::SkiaGPUIfAvailable: {
|
case DisplayListPlayerType::SkiaGPUIfAvailable: {
|
||||||
#ifdef AK_OS_MACOS
|
#ifdef USE_VULKAN
|
||||||
if (m_skia_backend_context && is<Painting::IOSurfaceBackingStore>(target)) {
|
if (m_skia_backend_context) {
|
||||||
auto& iosurface_backing_store = static_cast<Painting::IOSurfaceBackingStore&>(target);
|
Painting::DisplayListPlayerSkia player(*m_skia_backend_context, target.bitmap());
|
||||||
auto painting_surface = Gfx::PaintingSurface::wrap_iosurface(iosurface_backing_store.iosurface_handle(), *m_skia_backend_context);
|
|
||||||
Painting::DisplayListPlayerSkia player(*m_skia_backend_context, painting_surface);
|
|
||||||
player.execute(*display_list);
|
player.execute(*display_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_VULKAN
|
#ifdef AK_OS_MACOS
|
||||||
if (m_skia_backend_context) {
|
if (m_skia_backend_context && is<Painting::IOSurfaceBackingStore>(target)) {
|
||||||
Painting::DisplayListPlayerSkia player(*m_skia_backend_context, target.bitmap());
|
auto& iosurface_backing_store = static_cast<Painting::IOSurfaceBackingStore&>(target);
|
||||||
|
auto painting_surface = Gfx::PaintingSurface::wrap_iosurface(iosurface_backing_store.iosurface_handle(), *m_skia_backend_context);
|
||||||
|
Painting::DisplayListPlayerSkia player(*m_skia_backend_context, painting_surface);
|
||||||
player.execute(*display_list);
|
player.execute(*display_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
|
||||||
#include <LibWeb/StorageAPI/StorageShed.h>
|
#include <LibWeb/StorageAPI/StorageShed.h>
|
||||||
|
|
||||||
#ifdef AK_OS_MACOS
|
|
||||||
# include <LibGfx/MetalContext.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_VULKAN
|
#ifdef USE_VULKAN
|
||||||
# include <LibGfx/VulkanContext.h>
|
# include <LibGfx/VulkanContext.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef AK_OS_MACOS
|
||||||
|
# include <LibGfx/MetalContext.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#traversable-navigable
|
// https://html.spec.whatwg.org/multipage/document-sequences.html#traversable-navigable
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue