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 <halcanary@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2019-10-21 11:45:06 -04:00 committed by Skia Commit-Bot
parent b09131f476
commit 549666c1b5

View File

@ -48,8 +48,8 @@ sk_sp<SkSurface> 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<GrRenderTargetProxy> proxy = proxyProvider->createLazyRenderTargetProxy(