From e175ff21e8cedb659d150bb8c415c238587b67e0 Mon Sep 17 00:00:00 2001 From: Dan Walmsley Date: Mon, 27 Jan 2025 19:41:41 +0000 Subject: [PATCH] Make sure MacOS uses the cached value for render scaling. (#18062) --- src/Avalonia.Native/TopLevelImpl.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Native/TopLevelImpl.cs b/src/Avalonia.Native/TopLevelImpl.cs index efda4bfade..812307d991 100644 --- a/src/Avalonia.Native/TopLevelImpl.cs +++ b/src/Avalonia.Native/TopLevelImpl.cs @@ -95,7 +95,7 @@ internal class TopLevelImpl : ITopLevelImpl, IFramebufferPlatformSurface { _handle = handle; _savedLogicalSize = ClientSize; - _savedScaling = RenderScaling; + _savedScaling = Native?.Scaling ?? 1;; _nativeControlHost = new NativeControlHostImpl(Native!.CreateNativeControlHost()); _platformBehaviorInhibition = new PlatformBehaviorInhibition(Factory.CreatePlatformBehaviorInhibition()); _surfaces = new object[] { new GlPlatformSurface(Native), new MetalPlatformSurface(Native), this }; @@ -121,7 +121,8 @@ internal class TopLevelImpl : ITopLevelImpl, IFramebufferPlatformSurface } } - public double RenderScaling => Native?.Scaling ?? 1; + + public double RenderScaling => _savedScaling; public IEnumerable Surfaces => _surfaces ?? Array.Empty(); public Action? Input { get; set; } public Action? Paint { get; set; }