Use the maximum potential headroom if EDR content isn't currently being displayed.

Also document that the HDR properties can change dynamically at runtime.
This commit is contained in:
Sam Lantinga
2024-02-25 15:46:38 -08:00
parent e0dadba6f5
commit be51b7acea
4 changed files with 17 additions and 9 deletions

View File

@@ -299,7 +299,11 @@ static void Cocoa_GetHDRProperties(CGDirectDisplayID displayID, SDL_HDRDisplayPr
if (@available(macOS 10.15, *)) {
NSScreen *screen = GetNSScreenForDisplayID(displayID);
if (screen) {
HDR->HDR_headroom = screen.maximumExtendedDynamicRangeColorComponentValue;
if (screen.maximumExtendedDynamicRangeColorComponentValue > 1.0f) {
HDR->HDR_headroom = screen.maximumExtendedDynamicRangeColorComponentValue;
} else {
HDR->HDR_headroom = screen.maximumPotentialExtendedDynamicRangeColorComponentValue;
}
}
}
#endif

View File

@@ -247,7 +247,11 @@ int UIKit_AddDisplay(UIScreen *uiscreen, SDL_bool send_event)
#ifndef SDL_PLATFORM_TVOS
if (@available(iOS 16.0, *)) {
display.HDR.HDR_headroom = uiscreen.currentEDRHeadroom;
if (uiscreen.currentEDRHeadroom > 1.0f) {
display.HDR.HDR_headroom = uiscreen.currentEDRHeadroom;
} else {
display.HDR.HDR_headroom = uiscreen.potentialEDRHeadroom;
}
}
#endif /* !SDL_PLATFORM_TVOS */