Remove other WINDOWS_UWP leftover code paths

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-10 21:13:14 +02:00
1 親 d2fdfd8eea
コミット 053a25a088
35ファイル変更
-322

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

@@ -4,10 +4,8 @@ using System.Runtime.InteropServices;
using TerraFX.Interop;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
#if !WINDOWS_UWP
using WinRT;
using WinRT.Interop;
#endif
using IInspectable = TerraFX.Interop.WinRT.IInspectable;
#pragma warning disable CS0649, IDE1006
@@ -78,23 +76,14 @@ internal unsafe struct ICanvasEffectFactoryNative
/// The managed implementation of <see cref="ICanvasEffectFactoryNative"/>.
/// </summary>
[Guid("29BA1A1F-1CFE-44C3-984D-426D61B51427")]
#if WINDOWS_UWP
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
#else
[WindowsRuntimeType]
[WindowsRuntimeHelperType(typeof(Interface))]
#endif
public interface Interface
{
/// <inheritdoc cref="ICanvasEffectFactoryNative.CreateWrapper"/>
#if WINDOWS_UWP
[PreserveSig]
#endif
[return: NativeTypeName("HRESULT")]
int CreateWrapper(ICanvasDevice* device, ID2D1Effect* resource, float dpi, IInspectable** wrapper);
#if !WINDOWS_UWP
/// <summary>
/// The vtable type for <see cref="Interface"/>.
/// </summary>
@@ -147,6 +136,5 @@ internal unsafe struct ICanvasEffectFactoryNative
}
}
}
#endif
}
}
-6
ファイルの表示
@@ -3,13 +3,9 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop;
using TerraFX.Interop.Windows;
#if WINDOWS_UWP
using TerraFX.Interop.WinRT;
#else
using WinRT;
using WinRT.Interop;
using IInspectable = TerraFX.Interop.WinRT.IInspectable;
#endif
#pragma warning disable CS0649, IDE1006
@@ -151,7 +147,6 @@ internal unsafe struct ICanvasFactoryNative
effectId);
}
#if !WINDOWS_UWP
/// <summary>
/// The managed interface for <see cref="ICanvasFactoryNative"/>.
/// </summary>
@@ -172,5 +167,4 @@ internal unsafe struct ICanvasFactoryNative
public static readonly IntPtr AbiToProjectionVftablePtr = IUnknownVftbl.AbiToProjectionVftblPtr;
}
}
#endif
}
-15
ファイルの表示
@@ -4,10 +4,8 @@ using System.Runtime.InteropServices;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
using TerraFX.Interop;
#if !WINDOWS_UWP
using WinRT;
using WinRT.Interop;
#endif
#pragma warning disable CS0649, IDE1006
@@ -86,26 +84,15 @@ internal unsafe struct ICanvasImageInterop
/// The managed implementation of <see cref="ICanvasImageInterop"/>.
/// </summary>
[Guid("E042D1F7-F9AD-4479-A713-67627EA31863")]
#if WINDOWS_UWP
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
#else
[WindowsRuntimeType]
[WindowsRuntimeHelperType(typeof(Interface))]
#endif
public interface Interface
{
/// <inheritdoc cref="ICanvasImageInterop.GetDevice"/>
#if WINDOWS_UWP
[PreserveSig]
#endif
[return: NativeTypeName("HRESULT")]
int GetDevice(ICanvasDevice** device, WIN2D_GET_DEVICE_ASSOCIATION_TYPE* type);
/// <inheritdoc cref="ICanvasImageInterop.GetD2DImage"/>
#if WINDOWS_UWP
[PreserveSig]
#endif
[return: NativeTypeName("HRESULT")]
int GetD2DImage(
ICanvasDevice* device,
@@ -115,7 +102,6 @@ internal unsafe struct ICanvasImageInterop
float* realizeDpi,
ID2D1Image** ppImage);
#if !WINDOWS_UWP
/// <summary>
/// The vtable type for <see cref="Interface"/>.
/// </summary>
@@ -198,6 +184,5 @@ internal unsafe struct ICanvasImageInterop
}
}
}
#endif
}
}
-4
ファイルの表示
@@ -3,11 +3,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Windows.Graphics.Effects;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Buffers;
#else
namespace ComputeSharp.D2D1.WinUI.Buffers;
#endif
/// <summary>
/// A fixed buffer type containing 16 <see cref="IGraphicsEffectSource"/> fields.
-4
ファイルの表示
@@ -3,11 +3,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using ComputeSharp.D2D1.Interop;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Buffers;
#else
namespace ComputeSharp.D2D1.WinUI.Buffers;
#endif
/// <summary>
/// A fixed buffer type containing 16 <see cref="D2D1ResourceTextureManager"/> fields.
-9
ファイルの表示
@@ -1,22 +1,13 @@
using System;
using System.Runtime.CompilerServices;
using ABI.Microsoft.Graphics.Canvas;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Extensions;
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Extensions;
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
using Windows.Graphics.Effects;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Buffers;
#else
namespace ComputeSharp.D2D1.WinUI.Buffers;
#endif
/// <summary>
/// A wrapper type for an input <see cref="IGraphicsEffectSource"/> and its underlying native D2D images.
-4
ファイルの表示
@@ -2,11 +2,7 @@ using System;
using System.Runtime.CompilerServices;
using Microsoft.Graphics.Canvas;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
partial class CanvasEffect
-8
ファイルの表示
@@ -3,22 +3,14 @@ using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Extensions;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using Microsoft.Graphics.Canvas;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
using Windows.Foundation;
using ICanvasResourceCreator = Microsoft.Graphics.Canvas.ICanvasResourceCreator;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
partial class CanvasEffect
-4
ファイルの表示
@@ -4,11 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using ABI.Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <summary>
/// A base type to implement packaged and easy to use <see cref="ICanvasImage"/>-based effects that can be used with Win2D.
-4
ファイルの表示
@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Collections;
#else
namespace ComputeSharp.D2D1.WinUI.Collections;
#endif
/// <summary>
/// Shared helpers for all types implementing <see cref="IFixedCountList{T}"/>.
-4
ファイルの表示
@@ -1,11 +1,7 @@
using System.Collections.Generic;
using System.Collections.Immutable;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Collections;
#else
namespace ComputeSharp.D2D1.WinUI.Collections;
#endif
/// <summary>
/// An interface for a list with a fixed collection.
-4
ファイルの表示
@@ -4,11 +4,7 @@ using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
using Win32 = TerraFX.Interop.Windows.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Extensions;
#else
namespace ComputeSharp.D2D1.WinUI.Extensions;
#endif
/// <summary>
/// A <see langword="class"/> with extensions for the <see cref="ICanvasDevice"/> type.
-4
ファイルの表示
@@ -2,11 +2,7 @@ using ComputeSharp.D2D1.Extensions;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Extensions;
#else
namespace ComputeSharp.D2D1.WinUI.Extensions;
#endif
/// <summary>
/// A <see langword="class"/> with extensions for the <see cref="ID2D1DeviceContext"/> type.
-4
ファイルの表示
@@ -10,11 +10,7 @@ using ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Extensions;
#else
namespace ComputeSharp.D2D1.WinUI.Extensions;
#endif
/// <summary>
/// A <see langword="class"/> with extensions for the <see cref="ID2D1Effect"/> type.
-4
ファイルの表示
@@ -3,11 +3,7 @@ using ComputeSharp.D2D1.Extensions;
using TerraFX.Interop.Windows;
using Win32 = TerraFX.Interop.Windows.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Extensions;
#else
namespace ComputeSharp.D2D1.WinUI.Extensions;
#endif
/// <summary>
/// Helper methods for working with the <see cref="IUnknown"/> type.
-32
ファイルの表示
@@ -1,20 +1,10 @@
using System;
using System.Diagnostics.CodeAnalysis;
#if WINDOWS_UWP
using System.Runtime.InteropServices;
using ComputeSharp.D2D1.Extensions;
#endif
using TerraFX.Interop.Windows;
#if !WINDOWS_UWP
using WinRT;
#endif
using IInspectable = TerraFX.Interop.WinRT.IInspectable;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Helpers;
#else
namespace ComputeSharp.D2D1.WinUI.Helpers;
#endif
/// <summary>
/// A helper type to handle marshalling of RCW instances.
@@ -31,12 +21,7 @@ internal static unsafe class RcwMarshaller
public static T GetOrCreateManagedInterface<T>(IUnknown* nativeObject)
where T : class
{
#if WINDOWS_UWP
// On UWP, Marshal.GetObjectForIUnknown handles all the marshalling/wrapping logic
return (T)Marshal.GetObjectForIUnknown((IntPtr)nativeObject);
#else
return MarshalInterface<T>.FromAbi((IntPtr)nativeObject);
#endif
}
/// <summary>
@@ -49,18 +34,7 @@ internal static unsafe class RcwMarshaller
public static void GetNativeObject<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.Interfaces)] T>(T managedObject, IInspectable** nativeObject)
where T : class
{
#if WINDOWS_UWP
using ComPtr<IUnknown> unknownObject = default;
// On UWP, due to built-in COM/WinRT support, Marshal.GetIUnknownForObject can handle all the logic.
// We get back an IUnknown* pointer, so we need to QueryInterface for IInspectable* ourselves.
unknownObject.Attach((IUnknown*)Marshal.GetIUnknownForObject(managedObject));
unknownObject.CopyTo(nativeObject).Assert();
#else
// On WinUI 3, delegate the RCW unwrapping or CCW creation logic to CsWinRT's APIs
*nativeObject = (IInspectable*)MarshalInspectable<T>.FromManaged(managedObject);
#endif
}
/// <summary>
@@ -78,15 +52,9 @@ internal static unsafe class RcwMarshaller
{
using ComPtr<IUnknown> unknownObject = default;
#if WINDOWS_UWP
unknownObject.Attach((IUnknown*)Marshal.GetIUnknownForObject(managedObject));
unknownObject.CopyTo(nativeObject).Assert();
#else
// Here we only want to get an IUnknown* pointer for a given interface, and then we'll do
// QueryInterface ourselves to get the target COM type. So MarshalInterface<TFrom> is fine.
unknownObject.Attach((IUnknown*)MarshalInterface<TFrom>.FromManaged(managedObject));
#endif
return unknownObject.CopyTo(nativeObject);
}
-36
ファイルの表示
@@ -3,22 +3,13 @@ using System.Diagnostics.CodeAnalysis;
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Extensions;
using TerraFX.Interop.Windows;
#if WINDOWS_UWP
using TerraFX.Interop.WinRT;
#endif
using Windows.Graphics.Effects;
#if !WINDOWS_UWP
using WinRT;
#endif
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp.Helpers;
#else
namespace ComputeSharp.D2D1.WinUI.Helpers;
using CanvasDevice = Microsoft.Graphics.Canvas.CanvasDevice;
using IInspectable = TerraFX.Interop.WinRT.IInspectable;
#endif
/// <summary>
/// A helper type to replicate Win2D's <c>ResourceManager</c> type.
@@ -115,32 +106,6 @@ internal static unsafe class ResourceManager
/// <param name="factoryNative">A pointer to the resulting activation factory.</param>
private static void GetActivationFactory(ICanvasFactoryNative** factoryNative)
{
#if WINDOWS_UWP
const string activatableClassId = "Microsoft.Graphics.Canvas.CanvasDevice";
// On UWP, the WinRT types from Win2D are automatically registered for activation.
// This means we can simply use RoGetActivationFactory to retrieve the factory.
fixed (char* pActivatableClassId = activatableClassId)
{
HSTRING_HEADER hStringHeaderActivatableClassId;
HSTRING hStringActivatableClass;
// Create a fast-pass HSTRING for "Microsoft.Graphics.Canvas.CanvasDevice"
WinRT.WindowsCreateStringReference(
sourceString: (ushort*)pActivatableClassId,
length: (uint)activatableClassId.Length,
hstringHeader: &hStringHeaderActivatableClassId,
@string: &hStringActivatableClass).Assert();
Guid canvasFactoryNativeId = typeof(ICanvasFactoryNative).GUID;
// Get the activation factory for CanvasDevice
WinRT.RoGetActivationFactory(
activatableClassId: hStringActivatableClass,
iid: &canvasFactoryNativeId,
factory: (void**)factoryNative).Assert();
}
#else
// On WinUI 3, the types are not guaranteed to be registered for activation. Additionally,
// for concistency with other types, we just use the built-in T.As<I>() method, which will
// automatically handle fallback logic to resolve types to activate if they're not registered.
@@ -148,6 +113,5 @@ internal static unsafe class ResourceManager
ICanvasFactoryNative.Interface canvasDeviceActivationFactory = CanvasDevice.As<ICanvasFactoryNative.Interface>();
*factoryNative = (ICanvasFactoryNative*)MarshalInterface<ICanvasFactoryNative.Interface>.FromManaged(canvasDeviceActivationFactory);
#endif
}
}
-8
ファイルの表示
@@ -3,22 +3,14 @@ using System.Buffers;
using System.Runtime.InteropServices;
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Extensions;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using ComputeSharp.Interop;
using TerraFX.Interop.Windows;
using Windows.Foundation;
using ICanvasEffect = Microsoft.Graphics.Canvas.Effects.ICanvasEffect;
using ICanvasResourceCreatorWithDpi = Microsoft.Graphics.Canvas.ICanvasResourceCreatorWithDpi;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
unsafe partial class PixelShaderEffect<T>
-9
ファイルの表示
@@ -3,22 +3,13 @@ using System.Runtime.CompilerServices;
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Extensions;
using ComputeSharp.D2D1.Interop;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Extensions;
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Extensions;
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
using TerraFX.Interop.WinRT;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
unsafe partial class PixelShaderEffect<T>
-8
ファイルの表示
@@ -1,21 +1,13 @@
using System.Numerics;
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Extensions;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using ComputeSharp.Interop;
using TerraFX.Interop.Windows;
using Windows.Foundation;
using ICanvasResourceCreator = Microsoft.Graphics.Canvas.ICanvasResourceCreator;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
unsafe partial class PixelShaderEffect<T>
-9
ファイルの表示
@@ -4,13 +4,8 @@ using System.Threading;
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Extensions;
using ComputeSharp.D2D1.Interop;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Extensions;
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Extensions;
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using ComputeSharp.Interop;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -19,11 +14,7 @@ using static ABI.Microsoft.Graphics.Canvas.WIN2D_GET_D2D_IMAGE_FLAGS;
using static ABI.Microsoft.Graphics.Canvas.WIN2D_GET_DEVICE_ASSOCIATION_TYPE;
using Win32 = TerraFX.Interop.Windows.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
unsafe partial class PixelShaderEffect<T>
-10
ファイルの表示
@@ -3,15 +3,9 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Extensions;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Buffers;
using ComputeSharp.D2D1.Uwp.Extensions;
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Buffers;
using ComputeSharp.D2D1.WinUI.Extensions;
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using ComputeSharp.Interop;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
@@ -24,11 +18,7 @@ using static TerraFX.Interop.DirectX.D2D1_DPICOMPENSATION_PROP;
using static TerraFX.Interop.DirectX.D2D1_PROPERTY_TYPE;
using Win32 = TerraFX.Interop.Windows.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
unsafe partial class PixelShaderEffect<T>
-8
ファイルの表示
@@ -1,19 +1,11 @@
using System;
using ComputeSharp.D2D1.Interop;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Extensions;
#else
using ComputeSharp.D2D1.WinUI.Extensions;
#endif
using ComputeSharp.Interop;
using Microsoft.Graphics.Canvas;
using TerraFX.Interop.DirectX;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
unsafe partial class PixelShaderEffect<T>
@@ -5,21 +5,12 @@ using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using ComputeSharp.D2D1.Interop;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Buffers;
using ComputeSharp.D2D1.Uwp.Collections;
#else
using ComputeSharp.D2D1.WinUI.Buffers;
using ComputeSharp.D2D1.WinUI.Collections;
#endif
#pragma warning disable CS8767
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
partial class PixelShaderEffect<T>
-9
ファイルの表示
@@ -4,20 +4,11 @@ using System.Collections.Generic;
using System.Collections.Immutable;
using System.Runtime.CompilerServices;
using ComputeSharp.D2D1.Interop;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Buffers;
using ComputeSharp.D2D1.Uwp.Collections;
#else
using ComputeSharp.D2D1.WinUI.Buffers;
using ComputeSharp.D2D1.WinUI.Collections;
#endif
using Windows.Graphics.Effects;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
partial class PixelShaderEffect<T>
-4
ファイルの表示
@@ -3,11 +3,7 @@ using System.Diagnostics.CodeAnalysis;
using ComputeSharp.D2D1.Interop;
using Microsoft.Graphics.Canvas;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
partial class PixelShaderEffect<T>
-8
ファイルの表示
@@ -1,18 +1,10 @@
using System;
using ComputeSharp.Interop;
using System.Runtime.CompilerServices;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp.Helpers;
#else
using ComputeSharp.D2D1.WinUI.Helpers;
#endif
using TerraFX.Interop.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <inheritdoc/>
partial class PixelShaderEffect<T>
-8
ファイルの表示
@@ -1,6 +1,4 @@
#if !WINDOWS_UWP
using System.Diagnostics.CodeAnalysis;
#endif
using ABI.Microsoft.Graphics.Canvas;
using ComputeSharp.D2D1.Descriptors;
using ComputeSharp.D2D1.Interop;
@@ -10,11 +8,7 @@ using Microsoft.Graphics.Canvas.Effects;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
#if WINDOWS_UWP
namespace ComputeSharp.D2D1.Uwp;
#else
namespace ComputeSharp.D2D1.WinUI;
#endif
/// <summary>
/// A custom <see cref="ICanvasEffect"/> implementation powered by a supplied shader type.
@@ -76,7 +70,6 @@ public sealed partial class PixelShaderEffect<T> : IReferenceTrackedObject, ICan
/// <summary>
/// Creates a new <see cref="PixelShaderEffect{T}"/> instance.
/// </summary>
#if !WINDOWS_UWP
// Workaround for trimming bug in custom COM/WinRT components with CsWinRT. Without manually preserving metadata for
// these types, using them will throw an InvalidCastException (see https://github.com/microsoft/CsWinRT/issues/1319).
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ICanvasImageInterop.Interface))]
@@ -85,7 +78,6 @@ public sealed partial class PixelShaderEffect<T> : IReferenceTrackedObject, ICan
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ICanvasFactoryNative.Interface.Vftbl))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ICanvasEffectFactoryNative.Interface))]
[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(ICanvasEffectFactoryNative.Interface.Vftbl))]
#endif
public PixelShaderEffect()
{
using ReferenceTracker.Lease _0 = ReferenceTracker.Create(this, out this.referenceTracker);
-2
ファイルの表示
@@ -75,7 +75,5 @@
<Compile Include="$(MSBuildThisFileDirectory)Windows\shared\winerror\RO.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Windows\shared\winerror\Windows.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WinRT\winrt\hstring\HSTRING_HEADER.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WinRT\winrt\roapi\WinRT.cs" />
<Compile Include="$(MSBuildThisFileDirectory)WinRT\winrt\winstring\WinRT.cs" />
</ItemGroup>
</Project>
-16
ファイルの表示
@@ -1,16 +0,0 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from winrt/roapi.h in the Windows SDK for Windows 10.0.22621.0
// Original source is Copyright © Microsoft. All rights reserved.
using System;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
namespace TerraFX.Interop.WinRT;
internal static unsafe partial class WinRT
{
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT RoGetActivationFactory(HSTRING activatableClassId, [NativeTypeName("const IID &")] Guid* iid, void** factory);
}
-15
ファイルの表示
@@ -1,15 +0,0 @@
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
// Ported from winrt/winstring.h in the Windows SDK for Windows 10.0.22621.0
// Original source is Copyright © Microsoft. All rights reserved.
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
namespace TerraFX.Interop.WinRT;
internal static unsafe partial class WinRT
{
[DllImport("combase", ExactSpelling = true)]
public static extern HRESULT WindowsCreateStringReference([NativeTypeName("PCWSTR")] ushort* sourceString, [NativeTypeName("UINT32")] uint length, HSTRING_HEADER* hstringHeader, HSTRING* @string);
}
-29
ファイルの表示
@@ -1,15 +1,10 @@
using System;
using System.Runtime.InteropServices;
#if WINDOWS_UWP
using System.Runtime.InteropServices.WindowsRuntime;
#endif
using Microsoft.Graphics.Canvas;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
#if !WINDOWS_UWP
using WinRT;
using WinRT.Interop;
#endif
#nullable enable
@@ -30,15 +25,9 @@ internal static class Win2DHelper
{
using ComPtr<IUnknown> activationFactoryUnknown = default;
#if WINDOWS_UWP
IActivationFactory activationFactory = WindowsRuntimeMarshal.GetActivationFactory(typeof(CanvasDevice));
activationFactoryUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(activationFactory));
#else
ICanvasFactoryNative activationFactory = CanvasDevice.As<ICanvasFactoryNative>();
activationFactoryUnknown.Attach((IUnknown*)MarshalInterface<ICanvasFactoryNative>.FromManaged(activationFactory));
#endif
using ComPtr<IUnknown> canvasFactoryNativeUnknown = default;
@@ -53,11 +42,7 @@ internal static class Win2DHelper
if (canvasDevice is not null)
{
#if WINDOWS_UWP
canvasDeviceUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasDevice));
#else
canvasDeviceUnknown.Attach((IUnknown*)MarshalInspectable<CanvasDevice>.FromManaged(canvasDevice));
#endif
}
using ComPtr<IUnknown> canvasDeviceInterfaceUnknown = default;
@@ -83,11 +68,7 @@ internal static class Win2DHelper
Marshal.ThrowExceptionForHR(hresult);
// Get or create a managed object for the native object
#if WINDOWS_UWP
return Marshal.GetObjectForIUnknown((IntPtr)wrapperUnknown.Get());
#else
return MarshalInspectable<object>.FromAbi((IntPtr)wrapperUnknown.Get());
#endif
}
/// <summary>
@@ -100,11 +81,7 @@ internal static class Win2DHelper
{
using ComPtr<IUnknown> effectUnknown = default;
#if WINDOWS_UWP
effectUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasImage));
#else
effectUnknown.Attach((IUnknown*)MarshalInterface<ICanvasImage>.FromManaged(canvasImage));
#endif
using ComPtr<IUnknown> canvasImageInteropUnknown = default;
@@ -117,11 +94,7 @@ internal static class Win2DHelper
using ComPtr<IUnknown> canvasDeviceUnknown = default;
#if WINDOWS_UWP
canvasDeviceUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasDevice));
#else
canvasDeviceUnknown.Attach((IUnknown*)MarshalInspectable<CanvasDevice>.FromManaged(canvasDevice));
#endif
using ComPtr<IUnknown> canvasDeviceInterfaceUnknown = default;
@@ -145,7 +118,6 @@ internal static class Win2DHelper
Marshal.ThrowExceptionForHR(hresult);
}
#if !WINDOWS_UWP
/// <summary>
/// The managed interface for <see cref="ICanvasFactoryNative"/>.
/// </summary>
@@ -166,5 +138,4 @@ internal static class Win2DHelper
public static readonly IntPtr AbiToProjectionVftablePtr = IUnknownVftbl.AbiToProjectionVftblPtr;
}
}
#endif
}
-4
ファイルの表示
@@ -4,10 +4,6 @@ using System.IO;
using System.Numerics;
using System.Threading.Tasks;
using ComputeSharp.D2D1.WinUI.Tests.Helpers;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp;
#else
#endif
using ComputeSharp.SwapChain.Shaders.D2D1;
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
-4
ファイルの表示
@@ -3,10 +3,6 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.D2D1.Interop;
using ComputeSharp.D2D1.WinUI.Tests.Helpers;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp;
#else
#endif
using Microsoft.Graphics.Canvas;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TerraFX.Interop.DirectX;
-4
ファイルの表示
@@ -4,10 +4,6 @@ using System.IO;
using System.Threading.Tasks;
using ComputeSharp.D2D1.Descriptors;
using ComputeSharp.D2D1.WinUI.Tests.Helpers;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp;
#else
#endif
using ComputeSharp.SwapChain.Shaders.D2D1;
using Microsoft.Graphics.Canvas;
using Microsoft.VisualStudio.TestTools.UnitTesting;