Comment 47 for bug 512615

Revision history for this message
In , Googulator (netrolller-3d) wrote :

Seems that the problem is the fact that we "just copy the green channel" to get the alpha channel. The following testcases clearly point to this:
data:text/html,<div style="background: white;"><div style="color: white; opacity: 0.999; font-size: 36px;">FAIL</div></div>
This one faintly displays the word "FAIL", even though it is white-on-white, and as such, should be invisible. What is visible appears to be a cyan line on the left (cyan=blue+green), and a yellow one on the right of the text (yellow=red+green); both colors contain the color green as a component.
These also show incorrect rendering:
data:text/html,<div style="background: red;"><div style="color: red; opacity: 0.999; font-size: 36px;">FAIL</div></div> (part of the red color is missing on the left side of the letters, black is visible)
data:text/html,<div style="background: blue;"><div style="color: blue; opacity: 0.999; font-size: 36px;">FAIL</div></div> (part of the blue is missing on the right of the letters)
data:text/html,<div style="background: cyan;"><div style="color: cyan; opacity: 0.999; font-size: 36px;">FAIL</div></div> (part of the blue color is missing, green shows through)
data:text/html,<div style="background: magenta;"><div style="color: magenta; opacity: 0.999; font-size: 36px;">FAIL</div></div> (red is missing on the left, while the right lacks blue)
data:text/html,<div style="background: yellow;"><div style="color: yellow; opacity: 0.999; font-size: 36px;">FAIL</div></div> (red is mising, green shows through)

These pass however:
data:text/html,<div style="background: black;"><div style="color: black; opacity: 0.999; font-size: 36px;">FAIL</div></div>
data:text/html,<div style="background: green;"><div style="color: green; opacity: 0.999; font-size: 36px;">FAIL</div></div>
data:text/html,<div style="background: lime;"><div style="color: lime; opacity: 0.999; font-size: 36px;">FAIL</div></div>

What I have noticed is that we only pass if R=0 and B=0, i.e. color=#00xx00, where xx is any hex number. This is because the only channel for which the alpha mask is correct is green, as we use the green channel for our alpha mask.
However, if any other channel is present, the alpha mask will show an off-by-one-subpixel problem, and the rendering of the non-green channels will be corrupted.

So, basically copying the green channel to the alpha channel is wrong, the actual alpha channel should take all color channels into account. This bug, probably coupled with a bug in ClearType in pre-7 Windowses, is the most likely cause of the misrendering.

I'll probably back with a proof-of-concept patch soon.