[cairo] Bug with paint_with_alpha and perf issues when compositing with SOURCE

Owen Taylor otaylor at redhat.com
Tue May 27 09:28:13 PDT 2008

On Tue, 2008-05-27 at 11:52 -0400, Antoine Azar wrote:
> > Maybe the phrasing of "the effect is similar to" 
> > just needs to be "the effect (with the default OVER operator) 
> > is similar to" in order to be accurate?
> Well that's not really an "accurate" description of what the function does
> either :-)
> If the current result is really what Cairo users want, then the obvious
> optimization is to replace the SOURCE operator by OVER for this function. We
> get an instant 10X speedup in pixman and 5X speedup in Quartz for free. In
> any case, I don't really understand why we're substituting SOURCE and CLEAR
> by a complicated string of operators. 

If you read through my various posts to the cairo-list in August 2005,
you should be able to get a good idea of why the cairo operator
semantics had to be different from the RENDER/pixman semantics and why
those "strings of complicated operators" are used.

> If the goal is to use
> backend-accelerated functions instead of going the pixman route, we should
> maybe revisit that decision as I'm pretty sure Pixman can do it faster
> natively (which was maybe not the case at the time this decision was
> taken?).

Extending pixman to handle SOURCE the cairo way is certainly possible,
but the pain of adding stuff in pixman that:

 A) Does not match RENDER (as used by the xlib/xcb backends)
 B) Does not match what can easily be done with 3D hardware (glitz
    backend, future Direct3D backend)

Is considerable... right now, the cairo-surface-fallback.c code is used
for all raster backends in basically the same way.

You'd have to have some pretty convincing examples where:

 A) You need to use masks with SOURCE
 B) The current code is too slow and can't be made faster in obvious
    ways without extending pixman.

- Owen

More information about the cairo mailing list