Change D2D1PixelShader input APIs to use int values

このコミットが含まれているのは:
Sergio Pedri committed 2022-05-07 03:35:55 +02:00
1 親 295cdb1c8d
コミット 4bb96e1fcd
2ファイル変更
+9 -9

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

+5 -5
ファイルの表示
@@ -85,12 +85,12 @@ public static class D2D1PixelShader
/// </summary>
/// <typeparam name="T">The type of D2D1 pixel shader to get the input count for.</typeparam>
/// <returns>The number of inputs for the D2D1 pixel shader of type <typeparamref name="T"/>.</returns>
public static uint GetInputCount<T>()
public static int GetInputCount<T>()
where T : unmanaged, ID2D1PixelShader
{
Unsafe.SkipInit(out T shader);
return shader.GetInputCount();
return (int)shader.GetInputCount();
}
/// <summary>
@@ -100,17 +100,17 @@ public static class D2D1PixelShader
/// <param name="index">The index of the input to get the type for.</param>
/// <returns>The type of the input of the target D2D1 pixel shader at the specified index.</returns>
/// <exception cref="ArgumentOutOfRangeException">Thrown if <paramref name="index"/> is not in range for the available inputs for the shader type.</exception>
public static D2D1PixelShaderInputType GetInputType<T>(uint index)
public static D2D1PixelShaderInputType GetInputType<T>(int index)
where T : unmanaged, ID2D1PixelShader
{
Unsafe.SkipInit(out T shader);
if (index >= shader.GetInputCount())
if ((uint)index >= shader.GetInputCount())
{
ThrowHelper.ThrowArgumentOutOfRangeException(nameof(index), "The input index is outside of range for the target pixel shader type.");
}
return (D2D1PixelShaderInputType)shader.GetInputType(index);
return (D2D1PixelShaderInputType)shader.GetInputType((uint)index);
}
/// <summary>
+4 -4
ファイルの表示
@@ -11,10 +11,10 @@ public partial class D2D1InteropServicesTests
[TestMethod]
public unsafe void GetInputCount()
{
Assert.AreEqual(D2D1PixelShader.GetInputCount<InvertEffect>(), 1u);
Assert.AreEqual(D2D1PixelShader.GetInputCount<PixelateEffect.Shader>(), 1u);
Assert.AreEqual(D2D1PixelShader.GetInputCount<ZonePlateEffect>(), 0u);
Assert.AreEqual(D2D1PixelShader.GetInputCount<ShaderWithMultipleInputs>(), 7u);
Assert.AreEqual(D2D1PixelShader.GetInputCount<InvertEffect>(), 1);
Assert.AreEqual(D2D1PixelShader.GetInputCount<PixelateEffect.Shader>(), 1);
Assert.AreEqual(D2D1PixelShader.GetInputCount<ZonePlateEffect>(), 0);
Assert.AreEqual(D2D1PixelShader.GetInputCount<ShaderWithMultipleInputs>(), 7);
}
[TestMethod]