Support other rendering backends
Cairo is showing its age, and maintenance is spotty. Other graphics stacks are moving to more modern renderers.
Servo seems to be removing Skia in favor of webrender/pathfinder for rendering to GPU, and raquote for 2D canvas (CPU, in-memory, give-me-the-pixels API).
One especially interesting thing around Raquote is that Jeff Muizelaar has been experimenting with things like full-scene antialiasing (FSAA) for some time. I'm not sure if Raquote supports that yet, but the rest of the crate is nicely done and reuses things like lyon-geom.
For rendering to GPU, having a pathfinder backend would be nice. This may make it possible to tie into GTK4's snapshot mechanism.
#522 is about moving geometry computations outside the ::draw()
functions.
That may make it easier to make the draw functions produce a render tree, instead of directly mutating a Cairo context. Maybe each draw function can produce an abstract render node like BezierPath(stroke, fill)
that a rendering backend translates into whatever it wants. It would be useful to see what abstractions are used in Servo and Resvg.
Also, Raquote uses the euclid crate to represent transforms. We use cairo::Matrix
all over the place. It may be useful to start moving to cairo-less transforms throughout the code. I think Firefox passes the current affine down to every draw function, while we just pull it out of the globally mutable draw_ctx.cr.
@Eijebong I think I've seen you around Servo's issues for raquote support; is this something you'd be interested in?