Add ID2D1TransformMapperInterop interface
このコミットが含まれているのは:
1 親
079a3de5b6
コミット
4d983905b8
3ファイル変更
+64
-4
検索条件に一致するファイルはありません
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.D2D1.Interop.Effects;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop;
|
||||
|
||||
@@ -18,7 +20,7 @@ namespace ComputeSharp.D2D1.Interop;
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// These managers are COM objects implementing the following interface:
|
||||
/// <code>
|
||||
/// <code language="cpp">
|
||||
/// [uuid(02E6D48D-B892-4FBC-AA54-119203BAB802)]
|
||||
/// interface ID2D1TransformMapper : IUnknown
|
||||
/// {
|
||||
@@ -87,7 +89,7 @@ namespace ComputeSharp.D2D1.Interop;
|
||||
/// <see cref="ICustomQueryInterface"/> interface, and this can then be passed to an existing D2D1 effect instance.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public abstract class D2D1TransformMapper<T>
|
||||
public abstract unsafe class D2D1TransformMapper<T> : ID2D1TransformMapperInterop
|
||||
where T : unmanaged, ID2D1PixelShader
|
||||
{
|
||||
/// <summary>
|
||||
@@ -155,5 +157,33 @@ public abstract class D2D1TransformMapper<T>
|
||||
/// For more info, see <see href="https://docs.microsoft.com/windows/win32/api/d2d1effectauthor/nf-d2d1effectauthor-id2d1transform-mapinvalidrect"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public abstract void MapInvalidOutput(int inputIndex, Rectangle invalidInput, out Rectangle invalidOutput);
|
||||
public abstract void MapInvalidOutput(int inputIndex, in Rectangle invalidInput, out Rectangle invalidOutput);
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1TransformMapperInterop.MapInputsToOutput(
|
||||
ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext,
|
||||
ReadOnlySpan<Rectangle> inputs,
|
||||
ReadOnlySpan<Rectangle> opaqueInputs,
|
||||
out Rectangle output,
|
||||
out Rectangle opaqueOutput)
|
||||
{
|
||||
MapInputsToOutput(
|
||||
new D2D1DrawInfoUpdateContext<T>(d2D1DrawInfoUpdateContext),
|
||||
inputs,
|
||||
opaqueInputs,
|
||||
out output,
|
||||
out opaqueOutput);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1TransformMapperInterop.MapOutputToInputs(in Rectangle output, Span<Rectangle> inputs)
|
||||
{
|
||||
MapOutputToInputs(in output, inputs);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
void ID2D1TransformMapperInterop.MapInvalidOutput(int inputIndex, in Rectangle invalidInput, out Rectangle invalidOutput)
|
||||
{
|
||||
MapInvalidOutput(inputIndex, in invalidInput, out invalidOutput);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
|
||||
|
||||
namespace ComputeSharp.D2D1.Interop.Effects;
|
||||
|
||||
/// <summary>
|
||||
/// A base type to support non-generic <see cref="D2D1TransformMapper{T}"/> uses.
|
||||
/// </summary>
|
||||
internal unsafe interface ID2D1TransformMapperInterop
|
||||
{
|
||||
/// <inheritdoc cref="D2D1TransformMapper{T}.MapInputsToOutput"/>
|
||||
/// <param name="d2D1DrawInfoUpdateContext">The <see cref="ID2D1DrawInfoUpdateContext"/> instance associated with the current effect.</param>
|
||||
/// <param name="inputs">The input rectangles to be mapped to the output rectangle. This parameter is always equal to the input bounds.</param>
|
||||
/// <param name="opaqueInputs">The input rectangles to be mapped to the opaque output rectangle.</param>
|
||||
/// <param name="output">The output rectangle that maps to the corresponding input rectangle.</param>
|
||||
/// <param name="opaqueOutput">The output rectangle that maps to the corresponding opaque input rectangle.</param>
|
||||
void MapInputsToOutput(
|
||||
ID2D1DrawInfoUpdateContext* d2D1DrawInfoUpdateContext,
|
||||
ReadOnlySpan<Rectangle> inputs,
|
||||
ReadOnlySpan<Rectangle> opaqueInputs,
|
||||
out Rectangle output,
|
||||
out Rectangle opaqueOutput);
|
||||
|
||||
/// <inheritdoc cref="D2D1TransformMapper{T}.MapOutputToInputs"/>
|
||||
void MapOutputToInputs(in Rectangle output, Span<Rectangle> inputs);
|
||||
|
||||
/// <inheritdoc cref="D2D1TransformMapper{T}.MapInvalidOutput"/>
|
||||
void MapInvalidOutput(int inputIndex, in Rectangle invalidInput, out Rectangle invalidOutput);
|
||||
}
|
||||
+1
-1
@@ -64,7 +64,7 @@ internal abstract class D2D1TransformMapper<T, TParameters> : D2D1TransformMappe
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void MapInvalidOutput(int inputIndex, Rectangle invalidInput, out Rectangle invalidOutput)
|
||||
public override void MapInvalidOutput(int inputIndex, in Rectangle invalidInput, out Rectangle invalidOutput)
|
||||
{
|
||||
Rectangle64 output64 = Rectangle64.FromRectangle(invalidInput);
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする