renderer/metal: apply layerContentsPlacement on macOS to fix stretching

Fixes #42
This commit is contained in:
Mitchell Hashimoto
2024-02-02 08:39:08 -08:00
parent a4ca2963a2
commit 7b3deb13d8
7 changed files with 18 additions and 3 deletions

View File

@@ -327,6 +327,10 @@ pub fn init(alloc: Allocator, options: renderer.Options) !Metal {
if (comptime builtin.os.tag == .macos) {
info.view.setProperty("layer", layer.value);
info.view.setProperty("wantsLayer", true);
// The layer gravity is set to top-left so that when we resize
// the view, the contents aren't stretched before a redraw.
layer.setProperty("contentsGravity", macos.animation.kCAGravityTopLeft);
}
// Ensure that our metal layer has a content scale set to match the