Stop using built-in COM interop in D2D1 sample

このコミットが含まれているのは:
Sergio Pedri committed 2023-04-22 01:34:36 +02:00
1 親 09c0c1e874
コミット c86b198b46
2ファイル変更
+18 -6

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

@@ -1,8 +1,10 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
using TerraFX.Interop;
using System;
using WinRT;
using WinRT.Interop;
#pragma warning disable CS0649, IDE1006
@@ -79,12 +81,23 @@ internal unsafe struct ICanvasFactoryNative : IUnknown.Interface
}
/// <summary>
/// The COM import interface for <see cref="ICanvasFactoryNative"/>.
/// The managed interface for <see cref="ICanvasFactoryNative"/>.
/// </summary>
[Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[WindowsRuntimeType]
[WindowsRuntimeHelperType(typeof(Interface))]
public interface Interface
{
/// <summary>
/// The vtable type for <see cref="Interface"/>.
/// </summary>
[Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
public readonly struct Vftbl
{
/// <summary>
/// Allows CsWinRT to retrieve a pointer to the projection vtable (the name is hardcoded by convention).
/// </summary>
public static readonly IntPtr AbiToProjectionVftablePtr = IUnknownVftbl.AbiToProjectionVftblPtr;
}
}
}
+1 -2
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using ABI.Microsoft.Graphics.Canvas;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -122,7 +121,7 @@ internal sealed class Win32Application
{
ICanvasFactoryNative.Interface canvasDeviceActivationFactory = CanvasDevice.As<ICanvasFactoryNative.Interface>();
canvasFactoryNativeUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasDeviceActivationFactory));
canvasFactoryNativeUnknown.Attach((IUnknown*)MarshalInterface<ICanvasFactoryNative.Interface>.FromManaged(canvasDeviceActivationFactory));
hresult = canvasFactoryNativeUnknown.CopyTo(canvasFactoryNative.GetAddressOf());