[Webkit-unassigned] [Bug 48094] Setting globalAlpha on canvas and drawing a video does not honor alpha value

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Oct 29 13:18:49 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=48094





--- Comment #16 from Aaron Colwell <acolwell at chromium.org>  2010-10-29 13:18:48 PST ---
(In reply to comment #15)
> (In reply to comment #14)
> > (From update of attachment 72203 [details] [details])
> > Looks good!  Can you please patch PlatformContextSkia::State::applyAlpha() to use getNormalizeAlpha() as well so there's only one copy of that logic?
> 
> Thanks. I'm a little wary of updating applyAlpha() because this case is slightly different. It isn't doing a simple clip. This code appears to have special behavior if m_alpha is outside of [0-1.0]. I don't really understand why someone did this but the code looks deliberate.

Ok. I have a better answer for why applyAlpha() shouldn't be updated to use getNormalizedAlpha(). 

The rounding in the 2 functions are used for different purposes. In getNormalizedAlpha() the code simply translates the [0-1] range to [0-255]. In applyAlpha() the rounding is used to determine how many 256ths to multiply the color's alpha by. In applyAlpha() you need to be able to differentiate between 255 & 256. 256 indicates that you don't need to multiply and 255 means that you need to multiply the color's alpha by 255/256. I don't think it would make the code clearer if I changed it to use getNormalizedAlpha() and then added an extra check to differentiate the 255 vs 256 cases.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list