forked from mirrors/gecko-dev
Bug 1812647: Make macOS screen HDR detection additionally check color component maximum. r=mac-reviewers,mstange
This is useful to discriminate between different colorspace options, some of which are unable to supprt macOS Extended Dynamic Range values. This is a reliable standin for measuring nits/brightness. Differential Revision: https://phabricator.services.mozilla.com/D206163
This commit is contained in:
parent
748e156587
commit
16567174cf
1 changed files with 15 additions and 2 deletions
|
|
@ -109,10 +109,23 @@ static already_AddRefed<Screen> MakeScreen(NSScreen* aScreen) {
|
|||
if (pixelDepth > MAX_REPORTED_PIXEL_DEPTH) {
|
||||
pixelDepth = MAX_REPORTED_PIXEL_DEPTH;
|
||||
}
|
||||
|
||||
// What's the maximum color component value this screen can display? This
|
||||
// is a reasonable stand-in for measuring peak brightness.
|
||||
CGFloat componentValueMax =
|
||||
aScreen.maximumPotentialExtendedDynamicRangeColorComponentValue;
|
||||
|
||||
// Should we treat this as HDR? Based on spec at
|
||||
// https://drafts.csswg.org/mediaqueries-5/#dynamic-range, we'll consider it
|
||||
// HDR if it has pixel depth greater than 24.
|
||||
bool isHDR = pixelDepth > 24;
|
||||
// HDR if it has pixel depth greater than 24, and if has high peak brightness,
|
||||
// which we measure by checking if it can represent component values greater
|
||||
// than 1.0.
|
||||
//
|
||||
// Also, on HDR screens, users may want to force SDR by setting a different
|
||||
// colorspace, for example by using the "Photography (P3 D65)" preset. In that
|
||||
// case, componentValueMax will be 1.0 and we want to treat the display as
|
||||
// SDR.
|
||||
bool isHDR = pixelDepth > 24 && componentValueMax > 1.0;
|
||||
|
||||
// Double-check HDR against the platform capabilities.
|
||||
isHDR &= nsCocoaFeatures::OnBigSurOrLater();
|
||||
|
|
|
|||
Loading…
Reference in a new issue