[Webkit-unassigned] [Bug 30333] [Color] (Un)premultiplication code is not optimal and broken in alpha==0 case

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 13 06:50:58 PDT 2009


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


Sebastian Dröge <slomo at circular-chaos.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #41101|                            |review?
               Flag|                            |




--- Comment #1 from Sebastian Dröge <slomo at circular-chaos.org>  2009-10-13 06:50:58 PDT ---
Created an attachment (id=41101)
 --> (https://bugs.webkit.org/attachment.cgi?id=41101)
0002-Fix-Color-alpha-un-premultiplication-code.patch

Now to the explanation. First of all, for consistency and correctness the
resulting value of (un-)premultiplication with a 0-alpha should result in (0,
0, 0, 0) instead of the input value without changes. This is because:
a) unpremultiplication: if input alpha is 0 all other components *must* be 0
too, otherwise the premultiplication was done incorrectly
b) premultiplication: for non-0 alpha we multiply with alpha, if we do the same
for 0 alpha the output will be (0, 0, 0, 0) as it should

For the non-0 alpha cases it makes more sense to round to the nearest integer
instead of always rounding upwards. Rounding upwards results in an uneven
distribution of color values, i.e. a 0 component is much less likely than every
other component value.

-- 
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