Freitag, 4. September 2009

Using cairo for antialiasing

I've written some glue code to use Cairo's tesselator to generate trapezoids for antialiased rendering, which can be directly fed to the X-Server. With a little more work, pixman could be used to generate AA tiles which could also be fed to the software loops (e.g. BufferedImage rendering) - replacing the slow pisces rasterizer currently used by OpenJDK.

For now I've only implemented the (simple) fill operation, stroking/drawing is still missing - however the results look already quite fine:

Boring background:
Currently both OpenJDK as well as Sun's proprietary JDK builds implement antialiased rendering by computing coverage values using C/Java code on the CPU, uploading those coverage values to the GPU and finally do blending on the GPU.

D3D/OpenGL drivers are usually highly optimized, so this works quite well there. For XRender however, especially with the Intel drivers (*cought*), this results in quite low performance, because every operation involves a syscall + a full GPU flush.
Furthermore when using OpenJDK, the rasterizer generating those coverage values is horribly slow, so AA rendering to any surface suffers.

Keine Kommentare: