From 5125784af54805ac7ff8a6ac5b4c4aa409e0c12d Mon Sep 17 00:00:00 2001 From: Nikita Tsukanov Date: Sat, 3 Jun 2017 05:44:04 +0300 Subject: [PATCH] Missing file --- .../Avalonia.Direct2D1/Direct2D1Platform.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs index c2bf019ee6..3176dee7a4 100644 --- a/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs +++ b/src/Windows/Avalonia.Direct2D1/Direct2D1Platform.cs @@ -135,17 +135,17 @@ namespace Avalonia.Direct2D1 public IRenderTarget CreateRenderTarget(IEnumerable surfaces) { - var nativeWindow = surfaces?.OfType().FirstOrDefault(); - if (nativeWindow != null) + foreach (var s in surfaces) { - if(nativeWindow.HandleDescriptor != "HWND") - throw new NotSupportedException("Don't know how to create a Direct2D1 renderer from " + nativeWindow.HandleDescriptor); - return new HwndRenderTarget(nativeWindow); - } - var external = surfaces?.OfType(); - if (external != null) - { - + if (s is IPlatformHandle nativeWindow) + { + if (nativeWindow.HandleDescriptor != "HWND") + throw new NotSupportedException("Don't know how to create a Direct2D1 renderer from " + + nativeWindow.HandleDescriptor); + return new HwndRenderTarget(nativeWindow); + } + if (s is IExternalDirect2DRenderTargetSurface external) + return new ExternalRenderTarget(external, s_dwfactory); } throw new NotSupportedException("Don't know how to create a Direct2D1 renderer from any of provided surfaces"); }