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
This commit is contained in:
gaaclarke
2023-02-27 10:19:14 -08:00
committed by GitHub
parent dc786470e6
commit e52501822b

View File

@@ -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