[webkit-dev] Proposal for serializing alpha channel values; request for algorithm help

Darin Adler darin at apple.com
Fri Nov 6 07:16:00 PST 2015


> On Nov 5, 2015, at 11:24 PM, L. David Baron <dbaron at dbaron.org> wrote:
> 
> For what it's worth, Gecko does have code to produce a
> minimal-length alpha value.  nsStyleUtil::ColorComponentToFloat just
> tries rounding to 2 decimal places, sees if the resulting float
> round-trips back to the same 0-255 alpha value, and if it doesn't,
> rounds to 3 places.

Got it. Sounds like it does what I have in mind. Except that given what you say it sounds like it doesn’t use a single decimal place even if that round trips, so for 51 it uses 0.20 rather than 0.2.

— Darin


More information about the webkit-dev mailing list