-
Notifications
You must be signed in to change notification settings - Fork 6k
Made sure not to turn on wide gamut support without impeller. #41460
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,19 +16,6 @@ | |||||||||||||||||||
| #import "flutter/shell/platform/darwin/ios/ios_surface_software.h" | ||||||||||||||||||||
| #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 { | ||||||||||||||||||||
| id<FlutterViewEngineDelegate> _delegate; | ||||||||||||||||||||
| BOOL _isWideGamutEnabled; | ||||||||||||||||||||
|
|
@@ -49,6 +36,23 @@ - (instancetype)initWithCoder:(NSCoder*)aDecoder { | |||||||||||||||||||
| return nil; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| - (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; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // 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; | ||||||||||||||||||||
|
||||||||||||||||||||
| - (UIScreen*)mainScreenIfViewLoaded { | |
| if (@available(iOS 13.0, *)) { | |
| if (self.viewIfLoaded == nil) { | |
| FML_LOG(WARNING) << "Trying to access the view before it is loaded."; | |
| } | |
| return self.viewIfLoaded.window.windowScene.screen; | |
| } | |
| return UIScreen.mainScreen; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is available via the shell, but there's nothing inherently wrong with exposing it on the project either.