Cairo 1.6, Quartz, and Gecko

One of the things that I've worked on for the past while is a Quartz backend for Cairo -- mainly for Mozilla, but also to show that Cairo has a great API that maps well to existing 2D APIs.  Cairo is a great 2D portability layer, ensuring that rich 2D graphics can be portable.  I'm excited about the upcoming Cairo 1.6 in particular, because the Quartz backend will be marked as stable and supported.  This will mean that Cairo is usable and supported on the three main platforms in use today -- Windows, Linux, and MacOS X.  I've filed a bug with Apple (bug #5802204) about making public the APIs that I've had to use to implement the full suite of Cairo capabilities using Quartz.  (For anyone interested, the cairo-quartz implementation file has a handful of quite useful methods.)

One interesting bit of fallout from this is that Quartz/CoreGraphics also happens to be the native graphics layer for the iPhone: so, Cairo is trivially portable to the iPhone.  The major issue is that Cairo currently uses ATSUI for font access, whereas it needs to be using CGFont -- which is the native font API suppored under MacOS X 10.5 and the iPhone.  (However, the CGFont API is missing many public methods to make it entirely general, but I hope that will be remedied in time.)  I've made some last-minute changes to Cairo to allow us to switch to a CGFont-based text backend with no change to Cairo-using apps, and I have such a backend in progress for landing shortly after Cairo 1.6 is released.

There is also some exciting work going on with improving the pixman library that cairo uses for its software-only rendering -- I've often maligned it for being slow and hard to work with, but the newer cleaned-up version is much easier to deal with, and Soeren has great plans for its future.  A number of people are working on adding highly optimized MMX and SSE2 compositing routines to augment the little bit of MMX code that's present currently.  Initial benchmarks are pretty encouraging, and I'm hoping that we can do some optimization work targetted at ARM as well.  There is also some work in progress to implement accelerated backends using OpenGL (and ultimately Direct3D).

Gecko 1.9 (and thus Firefox 3) will be shipping with Cairo 1.6 (or, as close as possible, if the schedules don't quite line up): everything that Firefox 3 renders on the screen is going through Cairo, and is ultimately translated by Cairo into the native platform API.  Future work to expand Gecko's graphical capabilities will intimately involve Cairo.  It's safe to say that Cairo is ready for prime time.


9 Comments to “Cairo 1.6, Quartz, and Gecko”  

  1. 1 asdf

    hi vlad,
    our news sound really great. but i’ve got a question: what is with glitz? it should boost cairo very much. is it still in devolpment? or has it stopped?
    gretz asdf

  2. 2 Robert Accettura

    Will the remaining work for Cairo before Firefox 3 have any performance impact?

  3. 3 Trevor F. Smith

    Congratulations!

  4. 4 James Justin Harrell

    The recent work on getting Webkit to use Cairo as its backend is really exciting. I believe Epiphany (and maybe also Konqueror?) will be using Webkit with Cairo.

    It somehow feels good for both Webkit and Gecko to be using the same graphics layer. Perhaps in the future Webkit and Gecko will be able to share even more.

  5. 5 Matthias

    Hi Vlad,

    That’s great news.
    Question: will those accelerated backends based on OpenGL and Direct3D make it in time for Moz2/Gecko2/Firefox4? (since the Mozilla wiki pages on Mozilla2 mention hardware accelarated gfx)

    -Matthias

  6. 6 vladimir

    glitz is pretty much unowned at the moment, and I don’t think it’ll be picked up — it seems to do what David originally designed it for (and I believe is still being used in some of the X-on-opengl work), but there’s been no maintainer for the glitz backend for cairo for a while.

    For the accelerated backend work, it’s pretty much orthogonal to Moz 2 work — if it’s done, we’ll take it, if not, we’ll take it when it’s done. That is, it’s a nice to have, but we wouldn’t block a Moz 2 release on it.

  1. 1 Vladimir Vuki?evi?: Cairo 1.6, Quartz, and Gecko | 325i.org
  2. 2 Christopher Blizzard » Blog Archive » huge list of random firefox links
  3. 3 A Little More Cairo, Just For You at Vladimir Vukićević


Leave a Reply