[cairo] Suggestion of modifications to cairo as of the new trapezoid spec

David Reveman c99drn at cs.umu.se
Mon Aug 9 18:00:55 PDT 2004


The obvious solution would be to just throw away the old composite_traps
backend function and replace it with a new add_traps. However, this
might not be the best solution. The composite_traps function allows the
alpha-mask to be handled by the backends and this makes it possible for
glitz to use the destination surface’s stencil buffer for this purpose
(this is how glitz_composite_trapezoids works). This is efficient and
doesn't require real offscreen drawing (pbuffers) but maybe not
something an X server on top of OpenGL or an application that require
highest quality output would use. But I do think there will be
applications that like to trade quality for performance and for that
purpose I suggest that the ability for backends to handle polygon alpha-
masks should be kept.

There are some cases where stenciling can’t be used and with the latest
hardware add_traps might be better than stenciling. We definitely also
like to support software rasterization of polygons with glitz for high
quality output. For these purposes, the add_traps backend function is
perfect.

So, this is what I think we should do:

Add backend function:

add_traps (cairo_surface_t *dst,
                  int offset_x,
                  int offset_y,
                  cairo_trap_t *traps,
                  int n_traps);

And the compsite_traps function should be replaced with something that
matches the add_traps functionality more closely:

composite_traps (cairo_surface_t *dst,
                             cairo_surface_t *src,
                             int offset_x,
                             int offset_y,
                             int src_x,
                             int src_y,
                             unsigned short opacity,
                             cairo_trap_t *traps,
                             int n_traps);

cairo would use composite_traps when possible and backend support for
composite_traps would be optional.

What do you think?

I'll add a glitz_add_traps operation to glitz and glitz will also switch
to only support the new trapezoids defined by two vertical offsets and
four horizontal offsets instead of the old trapezoids defined by two
vertical offsets and two lines. Cairo will also switch to using this new
trapezoid type, right?

- David




More information about the cairo mailing list