From e52501822ba84a965e758ce1b3b9a8a5f7f07e42 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Mon, 27 Feb 2023 10:19:14 -0800 Subject: [PATCH] Turned off wide gamut color pixel format for the simulator since it (flutter/engine#39825) Turned off wide gamut color pixel format for the simulator --- .../darwin/ios/framework/Source/FlutterView.mm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm index d0377d0033..c441883999 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterView.mm @@ -17,10 +17,16 @@ #include "third_party/skia/include/utils/mac/SkCGUtils.h" static BOOL IsWideGamutSupported() { +#if TARGET_OS_SIMULATOR + // As of Xcode 14.1, the wide gamut surface pixel formats are not supported by + // the simulator. + return NO; +#else // This predicates the decision on the capabilities of the iOS device's // display. This means external displays will not support wide gamut if the // device's display doesn't support it. It practice that should be never. return UIScreen.mainScreen.traitCollection.displayGamut != UIDisplayGamutSRGB; +#endif } @implementation FlutterView { @@ -57,6 +63,10 @@ static BOOL IsWideGamutSupported() { if (self) { _delegate = delegate; _isWideGamutEnabled = isWideGamutEnabled; + if (_isWideGamutEnabled && !IsWideGamutSupported()) { + FML_DLOG(WARNING) << "Rendering wide gamut colors is turned on but isn't " + "supported, downgrading the color gamut to sRGB."; + } self.layer.opaque = opaque; // This line is necessary. CoreAnimation(or UIKit) may take this to do