[cairo] Seams with CAIRO_ANTIALIAS_FAST
Søren Sandmann
sandmann at cs.au.dk
Sat Jul 28 11:08:40 PDT 2012
The CAIRO_ANTIALIAS_FAST option uses a 2x2 sampling grid where each
sample has a weight of 64 when the depth of the mask is 8 bits.
This is problematic because the four samples then sum to 256, which
causes a seam a pixel is fully covered by a combination of independent
polygons.
The attached program demonstrates this. The blue rectangle is drawn as
four separate rectangles and the cross where they meet has a blue
channel of 0x74 where the rest of the rectangle is 0x73.
There are various fixes possible:
(a) Make ANTIALIAS_FAST use a 3x5 sampling grid. This is tempting
because X Render already supports this antialiasing mode (rendering
trapezoids to a 4 bit mask will use it).
(b) Make the weight of one of the samples 63 instead of 64. I don't know
how difficult this will be in the tor22 rasterizer.
(c) Ignore it and document that cairo can't draw seamless polygons.
Considering that the bug-seams.c test has been failing ever since
the tor rasterizer was added, and that fixing that test will
probably involve a performance hit from turning off analytical
antialiasing, maybe this is the more honest way to go.
Soren
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seams22.c
Type: text/x-csrc
Size: 2468 bytes
Desc: The test case
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120728/36aa6c65/attachment.c>
More information about the cairo
mailing list