| Summary: | Extended Color: Unify rounding / clamping conversions between 0-1 float components and 0-255 byte components | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Sam Weinig <sam> | ||||||||||||||||||||||
| Component: | New Bugs | Assignee: | Sam Weinig <sam> | ||||||||||||||||||||||
| Status: | RESOLVED FIXED | ||||||||||||||||||||||||
| Severity: | Normal | CC: | cdumez, changseok, darin, dino, esprehn+autocc, ews-watchlist, fmalita, glenn, gyuyoung.kim, hi, joepeck, kondapallykalyan, macpherson, menard, mifenton, pdr, sabouhallawa, schenney, sergio, simon.fraser, webkit-bug-importer | ||||||||||||||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||||||||||||||
| Version: | WebKit Nightly Build | ||||||||||||||||||||||||
| Hardware: | Unspecified | ||||||||||||||||||||||||
| OS: | Unspecified | ||||||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||||||
|
Description
Sam Weinig
2020-06-06 11:24:02 PDT
Created attachment 401269 [details]
WIP
Created attachment 401271 [details]
WIP
Created attachment 401272 [details]
Patch
Created attachment 401274 [details]
Patch
Created attachment 401275 [details]
Patch
Created attachment 401276 [details]
Patch
Created attachment 401277 [details]
Patch
Created attachment 401279 [details]
Patch
Created attachment 401280 [details]
Patch
Created attachment 401281 [details]
Patch
Comment on attachment 401281 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=401281&action=review > Source/WebCore/platform/graphics/ColorUtilities.h:54 > +inline uint8_t convertPrescaledToComponentByte(float f) Not really a fan of "prescaled". Does it mean "in the range 0-1"? Can't think of a better word though. Probably obvious to both of you but: We do need terminology for 0-1 and 0-255 for floating point components. Sadly it seems we need code that deals with both. And when overloading a function so it can take either integers or floating point, it seems really bad to have a floating point overload that takes 0-1 and an integer ones that takes 0-255, so we’ll want to avoid that. Committed r262733: <https://trac.webkit.org/changeset/262733> All reviewed patches have been landed. Closing bug and clearing flags on attachment 401281 [details]. (In reply to Darin Adler from comment #12) > Probably obvious to both of you but: We do need terminology for 0-1 and > 0-255 for floating point components. Sadly it seems we need code that deals > with both. And when overloading a function so it can take either integers or > floating point, it seems really bad to have a floating point overload that > takes 0-1 and an integer ones that takes 0-255, so we’ll want to avoid that. Yes! We need the one taking 0-255 float values in exactly one place right now, in the CSS parser. Everywhere else is 0-1 float or 0-255 int. (In reply to Simon Fraser (smfr) from comment #15) > (In reply to Darin Adler from comment #12) > > Probably obvious to both of you but: We do need terminology for 0-1 and > > 0-255 for floating point components. Sadly it seems we need code that deals > > with both. And when overloading a function so it can take either integers or > > floating point, it seems really bad to have a floating point overload that > > takes 0-1 and an integer ones that takes 0-255, so we’ll want to avoid that. > > Yes! The naming I was thinking about was: makeSimpleColorFromSRGBABytes makeSimpleColorFromSRGBAFloats (in the patch for https://bugs.webkit.org/show_bug.cgi?id=180620, Darin used makeSimpleColorFromRGBABytes for 0-255 ints and makeSimpleColorFromSRGBA for 0-1 floats). Not wed to this. |