From 549666c1b5e30927c0bc1bcf9d97d6b9af0cd4e9 Mon Sep 17 00:00:00 2001 From: Jim Van Verth Date: Mon, 21 Oct 2019 11:45:06 -0400 Subject: [PATCH] Metal: adjust framebuffer size by contentsScale. If the layer has a scale factor we need to allocate a larger framebuffer. Otherwise we'll end up drawing to a fraction of the window. Bug: skia:9554 Change-Id: I93d1e0dc7172ed10bb99ce45524561ad841f0101 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249803 Reviewed-by: Hal Canary Commit-Queue: Jim Van Verth --- src/image/SkSurface_GpuMtl.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/image/SkSurface_GpuMtl.mm b/src/image/SkSurface_GpuMtl.mm index 5140a7c004..a089e173d6 100644 --- a/src/image/SkSurface_GpuMtl.mm +++ b/src/image/SkSurface_GpuMtl.mm @@ -48,8 +48,8 @@ sk_sp SkSurface::MakeFromCAMetalLayer(GrContext* context, } GrSurfaceDesc desc; - desc.fWidth = metalLayer.frame.size.width; - desc.fHeight = metalLayer.frame.size.height; + desc.fWidth = metalLayer.drawableSize.width * metalLayer.contentsScale; + desc.fHeight = metalLayer.drawableSize.height * metalLayer.contentsScale; desc.fConfig = config; sk_sp proxy = proxyProvider->createLazyRenderTargetProxy(