|
|
@@ -7,6 +7,7 @@ using Avalonia.Direct2D1.Media;
|
|
|
using Avalonia.Media;
|
|
|
using Avalonia.Platform;
|
|
|
using Avalonia.Controls;
|
|
|
+using Avalonia.Rendering;
|
|
|
|
|
|
namespace Avalonia
|
|
|
{
|
|
|
@@ -22,7 +23,7 @@ namespace Avalonia
|
|
|
|
|
|
namespace Avalonia.Direct2D1
|
|
|
{
|
|
|
- public class Direct2D1Platform : IPlatformRenderInterface
|
|
|
+ public class Direct2D1Platform : IPlatformRenderInterface, IRendererFactory
|
|
|
{
|
|
|
private static readonly Direct2D1Platform s_instance = new Direct2D1Platform();
|
|
|
|
|
|
@@ -38,6 +39,7 @@ namespace Avalonia.Direct2D1
|
|
|
|
|
|
public static void Initialize() => AvaloniaLocator.CurrentMutable
|
|
|
.Bind<IPlatformRenderInterface>().ToConstant(s_instance)
|
|
|
+ .Bind<IRendererFactory>().ToConstant(s_instance)
|
|
|
.BindToSelf(s_d2D1Factory)
|
|
|
.BindToSelf(s_dwfactory)
|
|
|
.BindToSelf(s_imagingFactory);
|
|
|
@@ -59,6 +61,11 @@ namespace Avalonia.Direct2D1
|
|
|
return new FormattedTextImpl(text, fontFamily, fontSize, fontStyle, textAlignment, fontWeight, wrapping);
|
|
|
}
|
|
|
|
|
|
+ public IRenderer CreateRenderer(IRenderRoot root, IRenderLoop renderLoop)
|
|
|
+ {
|
|
|
+ return new Renderer(root, renderLoop);
|
|
|
+ }
|
|
|
+
|
|
|
public IRenderTarget CreateRenderTarget(IPlatformHandle handle)
|
|
|
{
|
|
|
if (handle.HandleDescriptor == "HWND")
|