diff --git a/StarterNG.Tests/WindowSurfacesTests.cs b/StarterNG.Tests/WindowSurfacesTests.cs index 7e28818..df905d0 100644 --- a/StarterNG.Tests/WindowSurfacesTests.cs +++ b/StarterNG.Tests/WindowSurfacesTests.cs @@ -21,11 +21,13 @@ public class WindowSurfacesTests Assert.Contains(Win32RenderingMode.AngleEgl, WindowSurfaces.Win32Options.RenderingMode); } - [Fact] - public void The_options_go_to_the_same_builder() + [Theory] + [InlineData(false)] + [InlineData(true)] + public void The_options_go_to_the_same_builder_with_or_without_the_processor(bool softwareRender) { var builder = AppBuilder.Configure(); - Assert.Same(builder, WindowSurfaces.ApplyTo(builder)); + Assert.Same(builder, WindowSurfaces.ApplyTo(builder, softwareRender)); } } diff --git a/StarterNG/Infrastructure/WindowSurfaces.cs b/StarterNG/Infrastructure/WindowSurfaces.cs index 641e706..7bb668e 100644 --- a/StarterNG/Infrastructure/WindowSurfaces.cs +++ b/StarterNG/Infrastructure/WindowSurfaces.cs @@ -8,7 +8,6 @@ namespace StarterNG.Infrastructure; /// visual was left empty on many starts: the main window, or a dialog opened later, /// stayed black while the others drew, and came back only now and then. Composition is /// there for see-through windows and backdrops, and the starter has none. -/// goes after this and brings its own options. /// public static class WindowSurfaces { @@ -17,5 +16,10 @@ public static class WindowSurfaces CompositionMode = new[] { Win32CompositionMode.RedirectionSurface } }; - public static AppBuilder ApplyTo(AppBuilder builder) => builder.With(Win32Options); + /// + /// The options a platform reads are the last given, so the processor, when asked + /// for, draws with 's own and these are left out. + /// + public static AppBuilder ApplyTo(AppBuilder builder, bool softwareRender) => + softwareRender ? SoftwareRender.ApplyTo(builder) : builder.With(Win32Options); } diff --git a/StarterNG/Program.cs b/StarterNG/Program.cs index 2cbb751..3f5108a 100644 --- a/StarterNG/Program.cs +++ b/StarterNG/Program.cs @@ -73,17 +73,13 @@ static class Program }; } - private static AppBuilder WithWindowSurfaces(this AppBuilder builder) => - WindowSurfaces.ApplyTo(builder); - + // Without the switch the graphics card draws, into the window surfaces. private static AppBuilder WithSoftwareRenderIfAsked(this AppBuilder builder) => - _softwareRender ? SoftwareRender.ApplyTo(builder) : builder; + WindowSurfaces.ApplyTo(builder, _softwareRender); public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UsePlatformDetect() - .WithWindowSurfaces() - // After the surfaces: the later options of a platform are the ones it reads. .WithSoftwareRenderIfAsked() .WithInterFont() .WithDiagnosticsLogging()