[cairo] cairo-gl glyph rendering performance

Bill Spitzak spitzak at gmail.com
Mon May 2 17:56:34 PDT 2011

Behdad Esfahbod wrote:
> On 05/02/11 15:57, Bill Spitzak wrote:
>> If instead we composite a and b first we get a+b-ab.
> Except that we ADD the glyphs together, not OVER them.  That's the root of the
> difference.
> I admit, in practice, there's little to be noticed.
> behdad

Well then that is actually worse. You do not want to add alpha masks 
together. Setting the coverage to a+b indicates that you think the 
coverage of all partially covered pixels is such that the filled section 
of one does not intersect the filled section of another. If they 
intersect at all then the resulting coverage will be less than the sum.

The opposite is to assume the larger completely obscures the smaller, 
resulting in max(a,b).

The usual way to merge masks is a+b-ab, which assumes that the 
intersection is a*b. This is correct if the two edges of solid shapes 
are at right angles to each other, but is a reasonable guess if there is 
no other information. Also this is correct if the alpha really 
represents partial opacity of the pixel, rather than partial coverage. I 
really recommend fixing it to do this.

More information about the cairo mailing list