Fix D2D1TransformMapper<T> unit tests on .NET Standard 2.0

このコミットが含まれているのは:
Sergio Pedri committed 2022-11-29 22:34:07 +01:00
1 親 1a3e78a945
コミット 46940df3b0
2ファイル変更
+73 -71

検索条件に一致するファイルはありません

@@ -1,7 +1,9 @@
using System;
using System.Drawing;
using System.Runtime.CompilerServices;
#if NET6_0_OR_GREATER
using System.Runtime.InteropServices;
#endif
using ComputeSharp.D2D1.Extensions;
using ComputeSharp.D2D1.Interop.Effects;
using TerraFX.Interop.Windows;
@@ -14,77 +16,6 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
/// <inheritdoc/>
unsafe partial struct D2D1TransformMapperImpl
{
#if !NET6_0_OR_GREATER
/// <inheritdoc cref="IUnknown.QueryInterface"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int QueryInterfaceDelegate(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject);
/// <inheritdoc cref="IUnknown.AddRef"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate uint AddRefDelegate(D2D1TransformMapperImpl* @this);
/// <inheritdoc cref="IUnknown.Release"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate uint ReleaseDelegate(D2D1TransformMapperImpl* @this);
/// <inheritdoc cref="ID2D1TransformMapper.MapInputRectsToOutputRect"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int MapInputRectsToOutputRectDelegate(
D2D1TransformMapperImpl* @this,
ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext,
RECT* inputRects,
RECT* inputOpaqueSubRects,
uint inputRectCount,
RECT* outputRect,
RECT* outputOpaqueSubRect);
/// <inheritdoc cref="ID2D1TransformMapper.MapOutputRectToInputRects"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int MapOutputRectToInputRectsDelegate(
D2D1TransformMapperImpl* @this,
RECT* outputRect,
RECT* inputRects,
uint inputRectsCount);
/// <inheritdoc cref="ID2D1TransformMapper.MapInvalidRect"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int MapInvalidRectDelegate(
D2D1TransformMapperImpl* @this,
uint inputIndex,
RECT invalidInputRect,
RECT* invalidOutputRect);
/// <summary>
/// A cached <see cref="QueryInterfaceDelegate"/> instance wrapping <see cref="QueryInterface(Guid*, void**)"/>.
/// </summary>
private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface;
/// <summary>
/// A cached <see cref="AddRefDelegate"/> instance wrapping <see cref="AddRef()"/>.
/// </summary>
private static readonly AddRefDelegate AddRefWrapper = AddRef;
/// <summary>
/// A cached <see cref="ReleaseDelegate"/> instance wrapping <see cref="Release()"/>.
/// </summary>
private static readonly ReleaseDelegate ReleaseWrapper = Release;
/// <summary>
/// A cached <see cref="MapInputRectsToOutputRectDelegate"/> instance wrapping <see cref="MapInputRectsToOutputRect"/>.
/// </summary>
private static readonly MapInputRectsToOutputRectDelegate MapInputRectsToOutputRectWrapper = MapInputRectsToOutputRect;
/// <summary>
/// A cached <see cref="MapOutputRectToInputRectsDelegate"/> instance wrapping <see cref="MapOutputRectToInputRects"/>.
/// </summary>
private static readonly MapOutputRectToInputRectsDelegate MapOutputRectToInputRectsWrapper = MapOutputRectToInputRects;
/// <summary>
/// A cached <see cref="MapInvalidRectDelegate"/> instance wrapping <see cref="MapInvalidRect"/>.
/// </summary>
private static readonly MapInvalidRectDelegate MapInvalidRectWrapper = MapInvalidRect;
#endif
/// <inheritdoc cref="QueryInterface(Guid*, void**)"/>
[UnmanagedCallersOnly]
private static int QueryInterface(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject)
@@ -18,6 +18,77 @@ namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
/// </summary>
internal unsafe partial struct D2D1TransformMapperImpl
{
#if !NET6_0_OR_GREATER
/// <inheritdoc cref="IUnknown.QueryInterface"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int QueryInterfaceDelegate(D2D1TransformMapperImpl* @this, Guid* riid, void** ppvObject);
/// <inheritdoc cref="IUnknown.AddRef"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate uint AddRefDelegate(D2D1TransformMapperImpl* @this);
/// <inheritdoc cref="IUnknown.Release"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate uint ReleaseDelegate(D2D1TransformMapperImpl* @this);
/// <inheritdoc cref="ID2D1TransformMapper.MapInputRectsToOutputRect"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int MapInputRectsToOutputRectDelegate(
D2D1TransformMapperImpl* @this,
ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext,
RECT* inputRects,
RECT* inputOpaqueSubRects,
uint inputRectCount,
RECT* outputRect,
RECT* outputOpaqueSubRect);
/// <inheritdoc cref="ID2D1TransformMapper.MapOutputRectToInputRects"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int MapOutputRectToInputRectsDelegate(
D2D1TransformMapperImpl* @this,
RECT* outputRect,
RECT* inputRects,
uint inputRectsCount);
/// <inheritdoc cref="ID2D1TransformMapper.MapInvalidRect"/>
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int MapInvalidRectDelegate(
D2D1TransformMapperImpl* @this,
uint inputIndex,
RECT invalidInputRect,
RECT* invalidOutputRect);
/// <summary>
/// A cached <see cref="QueryInterfaceDelegate"/> instance wrapping <see cref="QueryInterface(Guid*, void**)"/>.
/// </summary>
private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface;
/// <summary>
/// A cached <see cref="AddRefDelegate"/> instance wrapping <see cref="AddRef()"/>.
/// </summary>
private static readonly AddRefDelegate AddRefWrapper = AddRef;
/// <summary>
/// A cached <see cref="ReleaseDelegate"/> instance wrapping <see cref="Release()"/>.
/// </summary>
private static readonly ReleaseDelegate ReleaseWrapper = Release;
/// <summary>
/// A cached <see cref="MapInputRectsToOutputRectDelegate"/> instance wrapping <see cref="MapInputRectsToOutputRect"/>.
/// </summary>
private static readonly MapInputRectsToOutputRectDelegate MapInputRectsToOutputRectWrapper = MapInputRectsToOutputRect;
/// <summary>
/// A cached <see cref="MapOutputRectToInputRectsDelegate"/> instance wrapping <see cref="MapOutputRectToInputRects"/>.
/// </summary>
private static readonly MapOutputRectToInputRectsDelegate MapOutputRectToInputRectsWrapper = MapOutputRectToInputRects;
/// <summary>
/// A cached <see cref="MapInvalidRectDelegate"/> instance wrapping <see cref="MapInvalidRect"/>.
/// </summary>
private static readonly MapInvalidRectDelegate MapInvalidRectWrapper = MapInvalidRect;
#endif
/// <summary>
/// The shared method table pointer for all <see cref="ID2D1TransformMapper"/> instances.
/// </summary>