-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Extended colors should be clamped so they look the same in SDR and HDR layers. #47418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…R layers. https://bugs.webkit.org/show_bug.cgi?id=292226 <rdar://150231788> Reviewed by NOBODY (OOPS!). Compute the headroom for extended colors, and tonemap them back into the SDR range during WebCore::Color->CGColor conversion so that they appear identical regardless of layer backing store contents format. * Source/WebCore/platform/graphics/cg/ColorCG.cpp: (WebCore::headroomForColor): (WebCore::createCGColor):
EWS run on current version of this PR (hash d0099fa) |
auto [c1, c2, c3, c4] = cgCompatibleComponents; | ||
std::array<CGFloat, 4> cgFloatComponents { c1, c2, c3, c4 }; | ||
|
||
return adoptCF(CGColorCreate(cgColorSpace, cgFloatComponents.data())); | ||
auto result = adoptCF(CGColorCreate(cgColorSpace, cgFloatComponents.data())); |
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.
auto result = adoptCF(CGColorCreate(cgColorSpace, cgFloatComponents.data())); | |
RetainPtr result = adoptCF(CGColorCreate(cgColorSpace, cgFloatComponents.data())); |
auto result = adoptCF(CGColorCreate(cgColorSpace, cgFloatComponents.data())); | ||
|
||
if (auto headroom = headroomForColor(color, cgColorSpace); headroom > 1) { | ||
auto info = adoptCF(CGColorConversionInfoCreateForToneMapping(cgColorSpace, headroom, cgColorSpace, 1.0f, kCGToneMappingDefault, nullptr, nullptr)); |
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.
auto info = adoptCF(CGColorConversionInfoCreateForToneMapping(cgColorSpace, headroom, cgColorSpace, 1.0f, kCGToneMappingDefault, nullptr, nullptr)); | |
RetainPtr info = adoptCF(CGColorConversionInfoCreateForToneMapping(cgColorSpace, headroom, cgColorSpace, 1.0f, kCGToneMappingDefault, nullptr, nullptr)); |
Hey @mattwoodrow, I would love to talk to you more about this, as I have a few concerns here.
I'd be happy to expand on this, let me know. |
d0099fa
d0099fa