From 7a5142698841f1309632add834da14b2b53aa8b7 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 23 Oct 2022 22:59:20 +0200 Subject: [PATCH] Add base ICanvasDevice interface from Win2D --- .../ICanvasDevice.cs | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/ComputeSharp.D2D1.Uwp/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs diff --git a/src/ComputeSharp.D2D1.Uwp/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs b/src/ComputeSharp.D2D1.Uwp/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs new file mode 100644 index 00000000..32fc10b5 --- /dev/null +++ b/src/ComputeSharp.D2D1.Uwp/ABI.Microsoft.Graphics.Canvas/ICanvasDevice.cs @@ -0,0 +1,46 @@ +using System; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using TerraFX.Interop; +using TerraFX.Interop.Windows; + +#pragma warning disable CS0649 + +namespace ABI.Microsoft.Graphics.Canvas; + +/// +/// The native WinRT interface for objects. +/// +[Guid("A27F0B5D-EC2C-4D4F-948F-0AA1E95E33E6")] +[NativeTypeName("class ICanvasDevice : IInspectable")] +[NativeInheritance("IInspectable")] +internal unsafe struct ICanvasDevice +{ + public void** lpVtbl; + + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [VtblIndex(0)] + public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject) + { + return ((delegate* unmanaged[Stdcall])this.lpVtbl[0])((ICanvasResourceWrapperNative*)Unsafe.AsPointer(ref this), riid, ppvObject); + } + + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [VtblIndex(1)] + [return: NativeTypeName("ULONG")] + public uint AddRef() + { + return ((delegate* unmanaged[Stdcall])this.lpVtbl[1])((ICanvasResourceWrapperNative*)Unsafe.AsPointer(ref this)); + } + + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + [VtblIndex(2)] + [return: NativeTypeName("ULONG")] + public uint Release() + { + return ((delegate* unmanaged[Stdcall])this.lpVtbl[2])((ICanvasResourceWrapperNative*)Unsafe.AsPointer(ref this)); + } +} \ No newline at end of file