Use infinite RECT for default mapping with 0 inputs

このコミットが含まれているのは:
Sergio Pedri committed 2022-04-24 21:04:32 +02:00
1 親 58cba3f6d1
コミット 4aeb97113a
2ファイル変更
+17 -2

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

+13
ファイルの表示
@@ -14,6 +14,19 @@ namespace ComputeSharp.D2D1.Extensions;
/// </summary>
internal static class RECTExtensions
{
/// <summary>
/// Modifies a target <see cref="RECT"/> instance to be a D2D1 infinite rectangle.
/// </summary>
/// <param name="rect">The target <see cref="RECT"/> instance to modify.</param>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void MakeD2D1Infinite(this ref RECT rect)
{
rect.left = int.MinValue;
rect.top = int.MinValue;
rect.right = int.MaxValue;
rect.bottom = int.MaxValue;
}
/// <summary>
/// Creates a <see cref="Rectangle"/> from a <see cref="RECT"/> value.
/// </summary>
@@ -208,8 +208,10 @@ partial struct PixelShaderEffect
}
else if (inputRectCount == 0)
{
// If there are no inputs, just ignore (users will need a custom mapping)
*outputRect = default;
// If there are no inputs, make the output rectangle infinite. This is useful
// to make output-only effects work fine by default, without needing a custom
// transform. In this case, the target area will be the output node anyway.
outputRect->MakeD2D1Infinite();
@this->inputRect = default;