LibWeb: Allow construction of PaintingSurface directly from IOSurface

Previously, constructing a PaintingSurface from an IOSurface required
wrapping IOSurface into a Metal texture before passing it to the
PaintingSurface constructor. This process was cumbersome, as the caller
needed access to a MetalContext to perform the wrapping.

With this change SkiaBackendContext maintains a reference to the
MetalContext which makes it possible to do:
IOSurface -> MetalTexture -> SkSurface within a PaintingSurface
constructor.
This commit is contained in:
Aliaksandr Kalenik 2024-11-29 20:11:20 +01:00 committed by Alexander Kalenik
commit e683700fe6
Notes: github-actions[bot] 2024-12-03 22:38:00 +00:00
9 changed files with 31 additions and 18 deletions

View file

@ -22,6 +22,8 @@ class SkSurface;
namespace Gfx {
class MetalContext;
class SkiaBackendContext : public RefCounted<SkiaBackendContext> {
AK_MAKE_NONCOPYABLE(SkiaBackendContext);
AK_MAKE_NONMOVABLE(SkiaBackendContext);
@ -32,7 +34,7 @@ public:
#endif
#ifdef AK_OS_MACOS
static RefPtr<Gfx::SkiaBackendContext> create_metal_context(Gfx::MetalContext const&);
static RefPtr<Gfx::SkiaBackendContext> create_metal_context(MetalContext&);
#endif
SkiaBackendContext() {};
@ -40,6 +42,8 @@ public:
virtual void flush_and_submit(SkSurface*) {};
virtual GrDirectContext* sk_context() const = 0;
virtual MetalContext& metal_context() = 0;
};
}