mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibGfx: Pass MetalContext in an NNRP in SkiaBackendContext
Previously we were move()-ing an lvalue reference, which causes issues with upcoming RefPtr const correctness changes.
This commit is contained in:
parent
1819404e43
commit
0b16514d23
2 changed files with 6 additions and 6 deletions
|
@ -90,7 +90,7 @@ class SkiaMetalBackendContext final : public SkiaBackendContext {
|
|||
AK_MAKE_NONMOVABLE(SkiaMetalBackendContext);
|
||||
|
||||
public:
|
||||
SkiaMetalBackendContext(sk_sp<GrDirectContext> context, MetalContext& metal_context)
|
||||
SkiaMetalBackendContext(sk_sp<GrDirectContext> context, NonnullRefPtr<MetalContext> metal_context)
|
||||
: m_context(move(context))
|
||||
, m_metal_context(move(metal_context))
|
||||
{
|
||||
|
@ -114,13 +114,13 @@ private:
|
|||
NonnullRefPtr<MetalContext> m_metal_context;
|
||||
};
|
||||
|
||||
RefPtr<SkiaBackendContext> SkiaBackendContext::create_metal_context(MetalContext& metal_context)
|
||||
RefPtr<SkiaBackendContext> SkiaBackendContext::create_metal_context(NonnullRefPtr<MetalContext> metal_context)
|
||||
{
|
||||
GrMtlBackendContext backend_context;
|
||||
backend_context.fDevice.retain(metal_context.device());
|
||||
backend_context.fQueue.retain(metal_context.queue());
|
||||
backend_context.fDevice.retain(metal_context->device());
|
||||
backend_context.fQueue.retain(metal_context->queue());
|
||||
sk_sp<GrDirectContext> ctx = GrDirectContexts::MakeMetal(backend_context);
|
||||
return adopt_ref(*new SkiaMetalBackendContext(ctx, metal_context));
|
||||
return adopt_ref(*new SkiaMetalBackendContext(move(ctx), move(metal_context)));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
#endif
|
||||
|
||||
#ifdef AK_OS_MACOS
|
||||
static RefPtr<SkiaBackendContext> create_metal_context(MetalContext&);
|
||||
static RefPtr<SkiaBackendContext> create_metal_context(NonnullRefPtr<MetalContext>);
|
||||
#endif
|
||||
|
||||
SkiaBackendContext() { }
|
||||
|
|
Loading…
Add table
Reference in a new issue