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

@ -11,6 +11,8 @@ static_assert(false, "This file must only be used for macOS");
#endif
#include <AK/Forward.h>
#include <AK/RefCounted.h>
#include <AK/RefPtr.h>
#include <LibCore/IOSurface.h>
namespace Gfx {
@ -24,7 +26,7 @@ public:
virtual ~MetalTexture() {};
};
class MetalContext {
class MetalContext : public RefCounted<MetalContext> {
public:
virtual void const* device() const = 0;
virtual void const* queue() const = 0;
@ -34,6 +36,6 @@ public:
virtual ~MetalContext() {};
};
OwnPtr<MetalContext> get_metal_context();
RefPtr<MetalContext> get_metal_context();
}