From ff27c6d7a50e2815d8cea30fc5750d2d8306ce7b Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 25 May 2023 17:31:10 -0700 Subject: [PATCH] [Impeller] Disable the wide gamut settings flag on iOS simulators (flutter/engine#42331) Wide gamut is not supported on the iOS simulator, and the iOS platform's FlutterView.isWideGamutSupported checked for this. However, the ImageDecoder decides whether to enable wide gamut based on the engine's settings, so the flag in the settings needs to be modified for the simulator. --- .../darwin/ios/framework/Source/FlutterDartProject.mm | 6 ++++++ .../platform/darwin/ios/framework/Source/FlutterView.mm | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm index 07334dbdd9..4873102e72 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm @@ -157,9 +157,15 @@ flutter::Settings FLTDefaultSettingsForBundle(NSBundle* bundle, NSProcessInfo* p settings.domain_network_policy = ""; // Whether to enable wide gamut colors. +#if TARGET_OS_SIMULATOR + // As of Xcode 14.1, the wide gamut surface pixel formats are not supported by + // the simulator. + settings.enable_wide_gamut = false; +#else NSNumber* nsEnableWideGamut = [mainBundle objectForInfoDictionaryKey:@"FLTEnableWideGamut"]; BOOL enableWideGamut = nsEnableWideGamut ? nsEnableWideGamut.boolValue : YES; settings.enable_wide_gamut = enableWideGamut; +#endif // TODO(dnfield): We should reverse the order for all these settings so that command line options // are preferred to plist settings. https://github.com/flutter/flutter/issues/124049 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 91d4f472a6..32534da9df 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 @@ -44,12 +44,6 @@ } - (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; -#endif - if (![_delegate isUsingImpeller]) { return NO; } @@ -74,7 +68,7 @@ if (self) { _delegate = delegate; _isWideGamutEnabled = isWideGamutEnabled; - if (_isWideGamutEnabled && self.isWideGamutSupported) { + if (_isWideGamutEnabled && !self.isWideGamutSupported) { FML_DLOG(WARNING) << "Rendering wide gamut colors is turned on but isn't " "supported, downgrading the color gamut to sRGB."; }