[cairo] Fast 1-bit alpha masking when tiling images with broken RENDER

Boris Zbarsky bzbarsky at mit.edu
Thu Nov 30 11:30:03 PST 2006


For a bit of background (so to say), the issue I'm looking into is the 
performance of painting CSS background images in cairo-based Mozilla. 
Unfortunately, I happen to be using a Fedora Core 4 system, which suffers from a 
RENDER bug [1].

As a result, background images that have an alpha channel (PNG or GIF) are 
incredibly slow, to the point where the browser was effectively unusable on many 
sites [2].

It looks like for 8-bit-alpha PNG I may just be out of luck, but for the 
1-bit-alpha GIF/PNG case Carl pointed out that we can use cairo_mask instead of 
cairo_fill [3].  Then the xlib cairo backend could optimize this case better.

That's more or less where things stand now; I've written the code on the Mozilla 
side to treat 1-bit-alpha images as a combination of an RGB24 image and an A1 
mask.  What remains to be done is work on the cairo xlib surface to make this 
case fast; right now it just falls through into composite, which hits the slow 
software fallback code that cairo_fill hits.  Unfortunately, I'm not that 
familiar with cairo and not at all familiar with X programming, so I was 
somewhat wondering whether someone out there is interested in taking on the 
cairo side of things.  <https://bugzilla.mozilla.org/show_bug.cgi?id=362041#c10> 
has some information about how Mozilla used to handle this before we started 
using cairo, in case that would be helpful.

Any help would be much appreciated,

-Boris

[1] https://bugs.freedesktop.org/show_bug.cgi?id=3566
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=359392
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=362041


More information about the cairo mailing list