From b6f5bdb73fcdf4b1dee3145eac545199be0f4615 Mon Sep 17 00:00:00 2001 From: Brendan Shanks Date: Fri, 12 May 2023 10:26:44 -0700 Subject: [PATCH] winemac: Work around poor-quality downscaling in high-res/retina mode on macOS 10.13 and earlier. --- dlls/winemac.drv/cocoa_window.m | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dlls/winemac.drv/cocoa_window.m b/dlls/winemac.drv/cocoa_window.m index 23ac8ca21e4..ac4cc214239 100644 --- a/dlls/winemac.drv/cocoa_window.m +++ b/dlls/winemac.drv/cocoa_window.m @@ -680,6 +680,22 @@ static CVReturn WineDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTi [self layer].contentsScale = mode ? 2.0 : 1.0; [self layer].minificationFilter = mode ? kCAFilterLinear : kCAFilterNearest; [self layer].magnificationFilter = mode ? kCAFilterLinear : kCAFilterNearest; + + /* On macOS 10.13 and earlier, the desired minificationFilter seems to be + * ignored and "nearest" filtering is used, which looks terrible. + * Enabling rasterization seems to work around this, only enable + * it when there may be down-scaling (retina mode enabled). + */ + if (floor(NSAppKitVersionNumber) < 1671 /*NSAppKitVersionNumber10_14*/) + { + if (mode) + { + [self layer].shouldRasterize = YES; + [self layer].rasterizationScale = 2.0; + } + else + [self layer].shouldRasterize = NO; + } } - (void) setRetinaMode:(int)mode -- 2.11.4.GIT