Browse Source
Merge pull request #8868 from AvaloniaUI/fixes/composition-enabled-mobile-platforms
Use Composition Renderer on iOS / frame buffer / arm
pull/8799/head
Dan Walmsley
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with
21 additions and
3 deletions
-
src/Linux/Avalonia.LinuxFramebuffer/FramebufferToplevelImpl.cs
-
src/Linux/Avalonia.LinuxFramebuffer/LinuxFramebufferPlatform.cs
-
src/iOS/Avalonia.iOS/AvaloniaView.cs
-
src/iOS/Avalonia.iOS/Platform.cs
|
|
|
@ -7,6 +7,7 @@ using Avalonia.LinuxFramebuffer.Input; |
|
|
|
using Avalonia.LinuxFramebuffer.Output; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using Avalonia.Rendering.Composition; |
|
|
|
|
|
|
|
namespace Avalonia.LinuxFramebuffer |
|
|
|
{ |
|
|
|
@ -32,7 +33,7 @@ namespace Avalonia.LinuxFramebuffer |
|
|
|
{ |
|
|
|
var factory = AvaloniaLocator.Current.GetService<IRendererFactory>(); |
|
|
|
var renderLoop = AvaloniaLocator.Current.GetService<IRenderLoop>(); |
|
|
|
return factory?.Create(root, renderLoop) ?? new DeferredRenderer(root, renderLoop); |
|
|
|
return factory?.Create(root, renderLoop) ?? new CompositingRenderer(root, LinuxFramebufferPlatform.Compositor); |
|
|
|
} |
|
|
|
|
|
|
|
public void Dispose() |
|
|
|
|
|
|
|
@ -15,6 +15,7 @@ using Avalonia.LinuxFramebuffer.Output; |
|
|
|
using Avalonia.OpenGL; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using Avalonia.Rendering.Composition; |
|
|
|
using Avalonia.Threading; |
|
|
|
using JetBrains.Annotations; |
|
|
|
|
|
|
|
@ -26,6 +27,10 @@ namespace Avalonia.LinuxFramebuffer |
|
|
|
private static readonly Stopwatch St = Stopwatch.StartNew(); |
|
|
|
internal static uint Timestamp => (uint)St.ElapsedTicks; |
|
|
|
public static InternalPlatformThreadingInterface Threading; |
|
|
|
|
|
|
|
internal static Compositor Compositor { get; private set; } |
|
|
|
|
|
|
|
|
|
|
|
LinuxFramebufferPlatform(IOutputBackend backend) |
|
|
|
{ |
|
|
|
_fb = backend; |
|
|
|
@ -48,6 +53,10 @@ namespace Avalonia.LinuxFramebuffer |
|
|
|
.Bind<IKeyboardDevice>().ToConstant(new KeyboardDevice()) |
|
|
|
.Bind<IPlatformSettings>().ToSingleton<PlatformSettings>() |
|
|
|
.Bind<PlatformHotkeyConfiguration>().ToSingleton<PlatformHotkeyConfiguration>(); |
|
|
|
|
|
|
|
Compositor = new Compositor( |
|
|
|
AvaloniaLocator.Current.GetRequiredService<IRenderLoop>(), |
|
|
|
AvaloniaLocator.Current.GetService<IPlatformOpenGlInterface>()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -10,6 +10,7 @@ using Avalonia.iOS.Storage; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Platform.Storage; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using Avalonia.Rendering.Composition; |
|
|
|
using CoreAnimation; |
|
|
|
using Foundation; |
|
|
|
using ObjCRuntime; |
|
|
|
@ -63,8 +64,8 @@ namespace Avalonia.iOS |
|
|
|
// No-op
|
|
|
|
} |
|
|
|
|
|
|
|
public IRenderer CreateRenderer(IRenderRoot root) => new DeferredRenderer(root, |
|
|
|
AvaloniaLocator.Current.GetService<IRenderLoop>()); |
|
|
|
public IRenderer CreateRenderer(IRenderRoot root) => new CompositingRenderer(root, Platform.Compositor); |
|
|
|
|
|
|
|
|
|
|
|
public void Invalidate(Rect rect) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -6,6 +6,7 @@ using Avalonia.Input.Platform; |
|
|
|
using Avalonia.OpenGL; |
|
|
|
using Avalonia.Platform; |
|
|
|
using Avalonia.Rendering; |
|
|
|
using Avalonia.Rendering.Composition; |
|
|
|
|
|
|
|
namespace Avalonia |
|
|
|
{ |
|
|
|
@ -26,6 +27,8 @@ namespace Avalonia.iOS |
|
|
|
{ |
|
|
|
public static EaglFeature GlFeature; |
|
|
|
public static DisplayLinkTimer Timer; |
|
|
|
internal static Compositor Compositor { get; private set; } |
|
|
|
|
|
|
|
class PlatformSettings : IPlatformSettings |
|
|
|
{ |
|
|
|
/// <inheritdoc cref="IPlatformSettings.TouchDoubleClickSize"/>
|
|
|
|
@ -57,6 +60,10 @@ namespace Avalonia.iOS |
|
|
|
.Bind<IRenderTimer>().ToConstant(Timer) |
|
|
|
.Bind<IPlatformThreadingInterface>().ToConstant(new PlatformThreadingInterface()) |
|
|
|
.Bind<IKeyboardDevice>().ToConstant(keyboard); |
|
|
|
|
|
|
|
Compositor = new Compositor( |
|
|
|
AvaloniaLocator.Current.GetRequiredService<IRenderLoop>(), |
|
|
|
AvaloniaLocator.Current.GetService<IPlatformOpenGlInterface>()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|