why wekinspector converts alpha from [0.0, 1.0] to [0, 256) instead of [0, 255]

7 views
Skip to first unread message

Hong Li

unread,
Jul 12, 2016, 2:57:33 AM7/12/16
to Google Chrome Developer Tools
https://chromium.googlesource.com/chromium/src/+/f94944ad723e8a0cbee71258960394d17f32adef/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp#587


// Convert the floating pointer number of alpha to an integer in the range [0, 256),
// with an equal distribution across all 256 values.
int alphaComponent = static_cast<int>(clampTo<double>(alpha, 0.0, 1.0) * nextafter(256.0, 0.0));


Thanks!
Reply all
Reply to author
Forward
0 new messages