Browse Source
Merge pull request #1974 from AvaloniaUI/features/avalonia-previewer-hi-dpi-support
support high dpi on avalonia remote previewer.
pull/1976/head
Jumar Macato
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
6 additions and
0 deletions
-
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]; |
|
|
|
|