2024-09-19 16:34:53 -04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/Noncopyable.h>
|
2024-09-25 08:25:43 -04:00
|
|
|
#include <AK/RefCounted.h>
|
2024-09-19 16:34:53 -04:00
|
|
|
|
|
|
|
#ifdef AK_OS_MACOS
|
2024-09-26 11:01:07 -04:00
|
|
|
# include <LibGfx/MetalContext.h>
|
2024-09-19 16:34:53 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USE_VULKAN
|
2024-09-26 11:27:58 -04:00
|
|
|
# include <LibGfx/VulkanContext.h>
|
2024-09-19 16:34:53 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
class GrDirectContext;
|
2024-09-25 09:42:15 -04:00
|
|
|
class SkSurface;
|
2024-09-19 16:34:53 -04:00
|
|
|
|
|
|
|
namespace Gfx {
|
|
|
|
|
2024-11-29 14:11:20 -05:00
|
|
|
class MetalContext;
|
|
|
|
|
2024-09-25 08:25:43 -04:00
|
|
|
class SkiaBackendContext : public RefCounted<SkiaBackendContext> {
|
2024-09-19 16:34:53 -04:00
|
|
|
AK_MAKE_NONCOPYABLE(SkiaBackendContext);
|
|
|
|
AK_MAKE_NONMOVABLE(SkiaBackendContext);
|
|
|
|
|
|
|
|
public:
|
|
|
|
#ifdef USE_VULKAN
|
2024-09-26 11:27:58 -04:00
|
|
|
static RefPtr<SkiaBackendContext> create_vulkan_context(Gfx::VulkanContext&);
|
2024-09-19 16:34:53 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef AK_OS_MACOS
|
2024-11-29 14:11:20 -05:00
|
|
|
static RefPtr<Gfx::SkiaBackendContext> create_metal_context(MetalContext&);
|
2024-09-19 16:34:53 -04:00
|
|
|
#endif
|
|
|
|
|
2024-12-27 18:47:33 -05:00
|
|
|
SkiaBackendContext() { }
|
|
|
|
virtual ~SkiaBackendContext() { }
|
2024-09-19 16:34:53 -04:00
|
|
|
|
2024-12-27 18:47:33 -05:00
|
|
|
virtual void flush_and_submit(SkSurface*) { }
|
2024-09-19 16:34:53 -04:00
|
|
|
virtual GrDirectContext* sk_context() const = 0;
|
2024-11-29 14:11:20 -05:00
|
|
|
|
|
|
|
virtual MetalContext& metal_context() = 0;
|
2024-09-19 16:34:53 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|