-
-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #464 from Sergio0694/dev/device-context-pool
Add support for ID2D1DeviceContextPool Win2D APIs
- Loading branch information
Showing
9 changed files
with
176 additions
and
57 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
src/ComputeSharp.D2D1.Uwp/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextLease.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using TerraFX.Interop; | ||
using TerraFX.Interop.DirectX; | ||
using TerraFX.Interop.Windows; | ||
|
||
#pragma warning disable CS0649, IDE1006 | ||
|
||
namespace ABI.Microsoft.Graphics.Canvas; | ||
|
||
/// <summary> | ||
/// An interface for a COM object that provides access to a pooled <see cref="ID2D1DeviceContext"/> object. | ||
/// </summary> | ||
[Guid("A0928F38-F7D5-44DD-A5C9-E23D94734BBB")] | ||
[NativeTypeName("class ID2D1DeviceContextLease : IUnknown")] | ||
[NativeInheritance("IUnknown")] | ||
internal unsafe struct ID2D1DeviceContextLease | ||
{ | ||
public void** lpVtbl; | ||
|
||
/// <inheritdoc cref="IUnknown.QueryInterface"/> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(0)] | ||
public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject) | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextLease*, Guid*, void**, int>)this.lpVtbl[0])((ID2D1DeviceContextLease*)Unsafe.AsPointer(ref this), riid, ppvObject); | ||
} | ||
|
||
/// <inheritdoc cref="IUnknown.AddRef"/> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(1)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint AddRef() | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextLease*, uint>)this.lpVtbl[1])((ID2D1DeviceContextLease*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
/// <inheritdoc cref="IUnknown.Release"/> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(2)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint Release() | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextLease*, uint>)this.lpVtbl[2])((ID2D1DeviceContextLease*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
/// <summary> | ||
/// Provides access to the <see cref="ID2D1DeviceContext"/> object wrapped by the current instance. | ||
/// </summary> | ||
/// <param name="deviceContext">The resulting <see cref="ID2D1DeviceContext"/> object wrapped by the current instance.</param> | ||
/// <returns>The <see cref="HRESULT"/> for the operation.</returns> | ||
/// <remarks>The returned <see cref="ID2D1DeviceContext"/> cannot be used once the owning lease has been released.</remarks> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(3)] | ||
public HRESULT GetD2DDeviceContext(ID2D1DeviceContext** deviceContext) | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextLease*, ID2D1DeviceContext**, int>)this.lpVtbl[3])((ID2D1DeviceContextLease*)Unsafe.AsPointer(ref this), deviceContext); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/ComputeSharp.D2D1.Uwp/ABI.Microsoft.Graphics.Canvas/ID2D1DeviceContextPool.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
using System; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using TerraFX.Interop; | ||
using TerraFX.Interop.Windows; | ||
|
||
#pragma warning disable CS0649, IDE1006 | ||
|
||
namespace ABI.Microsoft.Graphics.Canvas; | ||
|
||
/// <summary> | ||
/// An interface for an object that provides access to pooled <see cref="TerraFX.Interop.DirectX.ID2D1DeviceContext"/> objects. | ||
/// </summary> | ||
[Guid("454A82A1-F024-40DB-BD5B-8F527FD58AD0")] | ||
[NativeTypeName("class ID2D1DeviceContextPool : IUnknown")] | ||
[NativeInheritance("IUnknown")] | ||
internal unsafe struct ID2D1DeviceContextPool | ||
{ | ||
public void** lpVtbl; | ||
|
||
/// <inheritdoc cref="IUnknown.QueryInterface"/> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(0)] | ||
public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject) | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextPool*, Guid*, void**, int>)this.lpVtbl[0])((ID2D1DeviceContextPool*)Unsafe.AsPointer(ref this), riid, ppvObject); | ||
} | ||
|
||
/// <inheritdoc cref="IUnknown.AddRef"/> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(1)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint AddRef() | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextPool*, uint>)this.lpVtbl[1])((ID2D1DeviceContextPool*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
/// <inheritdoc cref="IUnknown.Release"/> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(2)] | ||
[return: NativeTypeName("ULONG")] | ||
public uint Release() | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextPool*, uint>)this.lpVtbl[2])((ID2D1DeviceContextPool*)Unsafe.AsPointer(ref this)); | ||
} | ||
|
||
/// <summary> | ||
/// Retrieves a new <see cref="ID2D1DeviceContextLease"/> object from the current instance. | ||
/// </summary> | ||
/// <param name="lease">The resulting <see cref="ID2D1DeviceContextLease"/> object to use.</param> | ||
/// <returns>The <see cref="HRESULT"/> for the operation.</returns> | ||
[MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
[VtblIndex(3)] | ||
public HRESULT GetDeviceContextLease(ID2D1DeviceContextLease** lease) | ||
{ | ||
return ((delegate* unmanaged[Stdcall]<ID2D1DeviceContextPool*, ID2D1DeviceContextLease**, int>)this.lpVtbl[3])((ID2D1DeviceContextPool*)Unsafe.AsPointer(ref this), lease); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
src/TerraFX.Interop.Windows.D2D1/DirectX/um/d2d1_1/D2D1_DEVICE_CONTEXT_OPTIONS.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters