Browse Source

support high dpi on avalonia remote previewer.

Dan Walmsley 7 years ago
parent
commit
173ee0037c
1 changed files with 6 additions and 0 deletions
  1. 6 0
      src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs

+ 6 - 0
src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs

@@ -102,6 +102,12 @@ namespace Avalonia.Controls.Remote.Server
         
         FrameMessage RenderFrame(int width, int height, ProtocolPixelFormat? format)
         {
+            var scalingX = _dpi.X / 96.0;
+            var scalingY = _dpi.Y / 96.0;
+
+            width = (int)(width * scalingX);
+            height = (int)(height * scalingY);
+
             var fmt = format ?? ProtocolPixelFormat.Rgba8888;
             var bpp = fmt == ProtocolPixelFormat.Rgb565 ? 2 : 4;
             var data = new byte[width * height * bpp];