Update GetD2DImageFlags type with new Win2D changes
このコミットが含まれているのは:
1 親
0e7c28f86e
コミット
f31627c472
4ファイル変更
+19
-13
検索条件に一致するファイルはありません
+7
-2
@@ -6,7 +6,7 @@ namespace ABI.Microsoft.Graphics.Canvas;
|
||||
/// Options for fine-tuning the behavior of <see cref="ICanvasImageInterop.Interface.GetD2DImage"/>.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
internal enum CanvasImageGetD2DImageFlags
|
||||
internal enum GetD2DImageFlags
|
||||
{
|
||||
/// <summary>
|
||||
/// No options specified.
|
||||
@@ -36,5 +36,10 @@ internal enum CanvasImageGetD2DImageFlags
|
||||
/// <summary>
|
||||
/// Allow partially configured effect graphs where some inputs are <see langword="null"/>.
|
||||
/// </summary>
|
||||
AllowNullEffectInputs = 16
|
||||
AllowNullEffectInputs = 16,
|
||||
|
||||
/// <summary>
|
||||
/// If an input is invalid, unrealize the effect and set the output image to <see langword="null"/>.
|
||||
/// </summary>
|
||||
UnrealizeOnFailure = 32
|
||||
}
|
||||
@@ -41,7 +41,7 @@ internal unsafe struct ICanvasImageInterop
|
||||
/// <param name="device">The input canvas device (as a marshalled <see cref="global::Microsoft.Graphics.Canvas.CanvasDevice"/>).</param>
|
||||
/// <param name="deviceContext">
|
||||
/// The device context in use. This value is is optional (but recommended), except when the
|
||||
/// <see cref="CanvasImageGetD2DImageFlags.ReadDpiFromDeviceContext"/> flag is specified. This is because
|
||||
/// <see cref="GetD2DImageFlags.ReadDpiFromDeviceContext"/> flag is specified. This is because
|
||||
/// not all callers of <see cref="GetD2DImage"/> have easy access to a context. It is always
|
||||
/// possible to get a resource creation context from the device, but the context is only
|
||||
/// actually necessary if a new effect realization needs to be created, so it is more efficient
|
||||
@@ -51,8 +51,8 @@ internal unsafe struct ICanvasImageInterop
|
||||
/// <param name="targetDpi">
|
||||
/// The DPI of the target device context. This is used to determine when a <c>D2D1DpiCompensation</c>
|
||||
/// effect needs to be inserted. Behavior of this parameter can be overridden by the flag values
|
||||
/// <see cref="CanvasImageGetD2DImageFlags.ReadDpiFromDeviceContext"/>, <see cref="CanvasImageGetD2DImageFlags.AlwaysInsertDpiCompensation"/>
|
||||
/// or <see cref="CanvasImageGetD2DImageFlags.NeverInsertDpiCompensation"/>
|
||||
/// <see cref="GetD2DImageFlags.ReadDpiFromDeviceContext"/>, <see cref="GetD2DImageFlags.AlwaysInsertDpiCompensation"/>
|
||||
/// or <see cref="GetD2DImageFlags.NeverInsertDpiCompensation"/>
|
||||
/// </param>
|
||||
/// <param name="realizeDpi">
|
||||
/// The DPI of a source bitmap, or zero if the image does not have a fixed DPI. A <c>D2D1DpiCompensation</c> effect
|
||||
@@ -65,7 +65,7 @@ internal unsafe struct ICanvasImageInterop
|
||||
int GetD2DImage(
|
||||
ICanvasDevice* device,
|
||||
ID2D1DeviceContext* deviceContext,
|
||||
CanvasImageGetD2DImageFlags flags,
|
||||
GetD2DImageFlags flags,
|
||||
float targetDpi,
|
||||
float* realizeDpi,
|
||||
ID2D1Image** ppImage);
|
||||
|
||||
@@ -52,7 +52,7 @@ unsafe partial class PixelShaderEffect<T>
|
||||
int ICanvasImageInterop.Interface.GetD2DImage(
|
||||
ICanvasDevice* device,
|
||||
ID2D1DeviceContext* deviceContext,
|
||||
CanvasImageGetD2DImageFlags flags,
|
||||
GetD2DImageFlags flags,
|
||||
float targetDpi,
|
||||
float* realizeDpi,
|
||||
ID2D1Image** ppImage)
|
||||
@@ -77,7 +77,7 @@ unsafe partial class PixelShaderEffect<T>
|
||||
lock (this.lockObject)
|
||||
{
|
||||
// Process the ReadDpiFromDeviceContext flag (same logic as CanvasEffect::GetD2DImage)
|
||||
if ((flags & CanvasImageGetD2DImageFlags.ReadDpiFromDeviceContext) != CanvasImageGetD2DImageFlags.None)
|
||||
if ((flags & GetD2DImageFlags.ReadDpiFromDeviceContext) != GetD2DImageFlags.None)
|
||||
{
|
||||
// If ReadDpiFromDeviceContext is used, the context cannot be null
|
||||
if (deviceContext is null)
|
||||
@@ -88,7 +88,7 @@ unsafe partial class PixelShaderEffect<T>
|
||||
if (deviceContext->HasCommandListTarget())
|
||||
{
|
||||
// Command lists are DPI dependent, so DPI compensation effects are always needed
|
||||
flags |= CanvasImageGetD2DImageFlags.AlwaysInsertDpiCompensation;
|
||||
flags |= GetD2DImageFlags.AlwaysInsertDpiCompensation;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -97,7 +97,7 @@ unsafe partial class PixelShaderEffect<T>
|
||||
}
|
||||
|
||||
// ReadDpiFromDeviceContext has been processed, so it can be removed now
|
||||
flags &= ~CanvasImageGetD2DImageFlags.ReadDpiFromDeviceContext;
|
||||
flags &= ~GetD2DImageFlags.ReadDpiFromDeviceContext;
|
||||
}
|
||||
|
||||
using ComPtr<ID2D1Device1> d2D1Device1 = default;
|
||||
@@ -125,7 +125,7 @@ unsafe partial class PixelShaderEffect<T>
|
||||
{
|
||||
Realize(flags, targetDpi, deviceContext);
|
||||
}
|
||||
else if (!flags.HasFlag(CanvasImageGetD2DImageFlags.MinimalRealization))
|
||||
else if (!flags.HasFlag(GetD2DImageFlags.MinimalRealization))
|
||||
{
|
||||
// Recurse through the effect graph and ensure all nodes are initialized
|
||||
RefreshInputs(flags, targetDpi, deviceContext);
|
||||
@@ -183,7 +183,7 @@ unsafe partial class PixelShaderEffect<T>
|
||||
/// <param name="flags">The current flags in use.</param>
|
||||
/// <param name="targetDpi">The target DPI in use.</param>
|
||||
/// <param name="deviceContext">The <see cref="ID2D1DeviceContext"/> instance in use.</param>
|
||||
private void Realize(CanvasImageGetD2DImageFlags flags, float targetDpi, ID2D1DeviceContext* deviceContext)
|
||||
private void Realize(GetD2DImageFlags flags, float targetDpi, ID2D1DeviceContext* deviceContext)
|
||||
{
|
||||
using ComPtr<ID2D1Factory> d2D1Factory = default;
|
||||
|
||||
@@ -258,7 +258,7 @@ unsafe partial class PixelShaderEffect<T>
|
||||
/// <param name="flags">The current flags in use.</param>
|
||||
/// <param name="targetDpi">The target DPI in use.</param>
|
||||
/// <param name="deviceContext">The <see cref="ID2D1DeviceContext"/> instance in use.</param>
|
||||
private void RefreshInputs(CanvasImageGetD2DImageFlags flags, float targetDpi, ID2D1DeviceContext* deviceContext)
|
||||
private void RefreshInputs(GetD2DImageFlags flags, float targetDpi, ID2D1DeviceContext* deviceContext)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ internal abstract class D2D1TransformMapper<T, TParameters> : D2D1TransformMappe
|
||||
Unsafe.SkipInit(out output);
|
||||
|
||||
output.ToD2D1Infinite();
|
||||
|
||||
opaqueOutput = Rectangle.Empty;
|
||||
}
|
||||
else
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする