|
@@ -1,5 +1,11 @@
|
|
|
+using Drawie.Backend.Core;
|
|
|
using Drawie.Backend.Core.Bridge;
|
|
|
+using Drawie.Interop.Avalonia.Core;
|
|
|
using Drawie.Numerics;
|
|
|
+using Drawie.RenderApi;
|
|
|
+using Drawie.RenderApi.OpenGL;
|
|
|
+using Drawie.RenderApi.Vulkan;
|
|
|
+using Drawie.Silk;
|
|
|
using Drawie.Skia;
|
|
|
using Drawie.Windowing;
|
|
|
using DrawiEngine;
|
|
@@ -28,7 +34,15 @@ public class PixiEditorTest
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- var engine = DesktopDrawingEngine.CreateDefaultDesktop();
|
|
|
+ IRenderApi renderApi = new VulkanRenderApi();
|
|
|
+
|
|
|
+ if (System.OperatingSystem.IsMacOS())
|
|
|
+ {
|
|
|
+ renderApi = new OpenGlRenderApi();
|
|
|
+ }
|
|
|
+
|
|
|
+ var engine = new DrawingEngine(renderApi, new GlfwWindowingPlatform(renderApi), new SkiaDrawingBackend(),
|
|
|
+ new TestsRenderingDispatcher());
|
|
|
var app = new TestingApp();
|
|
|
Console.WriteLine("Running DrawieEngine with configuration:");
|
|
|
Console.WriteLine($"\t- RenderApi: {engine.RenderApi}");
|
|
@@ -47,7 +61,7 @@ public class PixiEditorTest
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
if (!DrawingBackendApi.HasBackend)
|
|
|
- DrawingBackendApi.SetupBackend(new SkiaDrawingBackend(), new DrawieRenderingDispatcher());
|
|
|
+ DrawingBackendApi.SetupBackend(new SkiaDrawingBackend(), new TestsRenderingDispatcher());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -92,7 +106,6 @@ public class FullPixiEditorTest : PixiEditorTest
|
|
|
.AddExtensionServices(loader)
|
|
|
.BuildServiceProvider();
|
|
|
|
|
|
-
|
|
|
var vm = services.GetRequiredService<ViewModelMain>();
|
|
|
vm.Setup(services);
|
|
|
}
|
|
@@ -112,7 +125,7 @@ public class FullPixiEditorTest : PixiEditorTest
|
|
|
}
|
|
|
|
|
|
public IAdditionalContentProvider? AdditionalContentProvider { get; } = new NullAdditionalContentProvider();
|
|
|
- public IIdentityProvider? IdentityProvider { get; }
|
|
|
+ public IIdentityProvider? IdentityProvider { get; }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -130,4 +143,25 @@ public class TestingApp : DrawieApp
|
|
|
{
|
|
|
window.IsVisible = false;
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+class TestsRenderingDispatcher : IRenderingDispatcher
|
|
|
+{
|
|
|
+ public Action<Action> Invoke { get; } = action => action();
|
|
|
+
|
|
|
+ public Task<TResult> InvokeAsync<TResult>(Func<TResult> function)
|
|
|
+ {
|
|
|
+ return Task.FromResult(function());
|
|
|
+ }
|
|
|
+
|
|
|
+ public Task InvokeAsync(Action function)
|
|
|
+ {
|
|
|
+ function();
|
|
|
+ return Task.CompletedTask;
|
|
|
+ }
|
|
|
+
|
|
|
+ public IDisposable EnsureContext()
|
|
|
+ {
|
|
|
+ return new EmptyDisposable();
|
|
|
+ }
|
|
|
}
|