Share D2D1 rendering code between UWP/WinUI samples

このコミットが含まれているのは:
Sergio Pedri committed 2023-04-20 20:07:18 +02:00
1 親 63ce21aa06
コミット 7254f1774c
10ファイル変更
+64 -28

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

+9
ファイルの表示
@@ -57,12 +57,21 @@
<ItemGroup>
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.WinUI\ComputeSharp.D2D1.WinUI.csproj" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
<ProjectReference Include="..\..\src\ComputeSharp.WinUI\ComputeSharp.WinUI.csproj" />
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
</ItemGroup>
<!-- Resource dictionary for D2D1AnimatedPixelShaderPanel -->
<ItemGroup>
<None Remove="Controls\D2D1AnimatedPixelShaderPanel.xaml" />
<Page Update="Controls\D2D1AnimatedPixelShaderPanel.xaml">
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<Import Project="..\ComputeSharp.SwapChain.Core.Shared\ComputeSharp.SwapChain.Core.Shared.projitems" Label="Shared" />
<Import Project="..\ComputeSharp.SwapChain.Shaders.Shared\ComputeSharp.SwapChain.Shaders.Shared.projitems" Label="Shared" />
<Import Project="..\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems" Label="Shared" />
+16
ファイルの表示
@@ -0,0 +1,16 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ComputeSharp.SwapChain.WinUI.Views"
xmlns:win2d="using:Microsoft.Graphics.Canvas.UI.Xaml">
<Style TargetType="local:D2D1AnimatedPixelShaderPanel">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:D2D1AnimatedPixelShaderPanel">
<win2d:CanvasAnimatedControl x:Name="PART_CanvasAnimatedControl" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -29,7 +29,7 @@ public sealed class CanvasAnimatedControl : Grid, ICanvasAnimatedControl, IDispo
/// <summary>
/// Indicates whether rendering is paused.
/// </summary>
private bool isPaused;
private bool paused;
/// <summary>
/// Indicates whether a new frame is currently being drawn.
@@ -67,14 +67,14 @@ public sealed class CanvasAnimatedControl : Grid, ICanvasAnimatedControl, IDispo
/// <summary>
/// Gets or sets whether rendering has paused
/// </summary>
public bool IsPaused
public bool Paused
{
get => this.isPaused;
get => this.paused;
set
{
if (this.isPaused != value)
if (this.paused != value)
{
this.isPaused = value;
this.paused = value;
// Start or stop the timers as needed
if (value)