From 620ad1b7ae06d6f053fb2c9b57af96b736c04e57 Mon Sep 17 00:00:00 2001 From: PL Date: Sat, 28 Jan 2023 15:09:07 -0500 Subject: Related: tdf#145988 Reset layer's pixel format to MTLPixelFormatBGRA8Unorm Skia initally sets the layer's pixel format to be BGRA8888 but macOS may change the layer's pixel format when a window has moved to a screen with 30-bit color depth so reset it back to BGRA8888. Change-Id: I1ad47a31e41aaa197e3052146243882e0b4ef673 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146301 Tested-by: Jenkins Reviewed-by: Patrick Luby --- external/skia/tdf147342.patch.0 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'external') diff --git a/external/skia/tdf147342.patch.0 b/external/skia/tdf147342.patch.0 index 72ec8adf9a46..3b50038c07ac 100644 --- a/external/skia/tdf147342.patch.0 +++ b/external/skia/tdf147342.patch.0 @@ -19,16 +19,31 @@ namespace window_context_factory { --- tools/sk_app/mac/MetalWindowContext_mac.mm 2021-11-25 10:39:27.000000000 -0500 -+++ tools/sk_app/mac/MetalWindowContext_mac.mm 2023-01-25 08:20:32.000000000 -0500 -@@ -87,6 +91,12 @@ ++++ tools/sk_app/mac/MetalWindowContext_mac.mm 2023-01-28 14:55:57.000000000 -0500 +@@ -11,6 +11,8 @@ + #import + #import + ++#include ++ + using sk_app::DisplayParams; + using sk_app::window_context_factory::MacWindowInfo; + using sk_app::MetalWindowContext; +@@ -87,6 +89,18 @@ fMetalLayer.drawableSize = backingSize; fMetalLayer.contentsScale = backingScaleFactor; -+ // Related tdf#147342 Copy layer's colorspace to window's colorspace ++ // Related: tdf#147342 Copy layer's colorspace to window's colorspace + // This method is now called when the window's backing properties have + // changed so copy any colorspace changes. + NSColorSpace* cs = fMainView.window.colorSpace; + fMetalLayer.colorspace = cs.CGColorSpace; ++ // Related tdf#145988 Reset layer's pixel format to MTLPixelFormatBGRA8Unorm ++ // Skia initally sets the layer's pixel format to be BGRA8888 but macOS ++ // may change the layer's pixel format when a window has moved to a screen ++ // with 30-bit color depth so reset it back to BGRA8888. ++ SAL_WARN_IF(fMetalLayer.pixelFormat != MTLPixelFormatBGRA8Unorm, "vcl.skia.metal", "CAMetalLayer pixel format is " << fMetalLayer.pixelFormat << " but should be " << MTLPixelFormatBGRA8Unorm << " (MTLPixelFormatBGRA8Unorm)"); ++ fMetalLayer.pixelFormat = MTLPixelFormatBGRA8Unorm; + fWidth = backingSize.width; fHeight = backingSize.height; -- cgit