From 8230df39a500e1db62fdd68d2b1e767120747c39 Mon Sep 17 00:00:00 2001 From: Le Hoang Quyen Date: Sat, 17 Oct 2020 13:51:01 +0800 Subject: [PATCH] #34: Auto detect CALayer's contentsScale change. --- src/libANGLE/renderer/metal/SurfaceMtl.mm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libANGLE/renderer/metal/SurfaceMtl.mm b/src/libANGLE/renderer/metal/SurfaceMtl.mm index 7d25537f6d..6a850359ad 100644 --- a/src/libANGLE/renderer/metal/SurfaceMtl.mm +++ b/src/libANGLE/renderer/metal/SurfaceMtl.mm @@ -579,6 +579,12 @@ void StopFrameCapture() bool SurfaceMtl::checkIfLayerResized(const gl::Context *context) { + if (mMetalLayer.get() != mLayer && mMetalLayer.get().contentsScale != mLayer.contentsScale) + { + // Parent layer's content scale has changed, update Metal layer's scale factor. + mMetalLayer.get().contentsScale = mLayer.contentsScale; + } + CGSize currentLayerDrawableSize = mMetalLayer.get().drawableSize; CGSize expectedDrawableSize = calcExpectedDrawableSize();