[Pixman] [PATCH 1/3] Add CLEAR and SRC linear interpolation operators

Chris Wilson chris at chris-wilson.co.uk
Thu Sep 15 03:35:23 PDT 2011

```On Thu, 15 Sep 2011 11:36:57 +0200, sandmann at cs.au.dk (=?utf-8?Q?S=C3=B8ren?= Sandmann) wrote:
> Chris Wilson <chris at chris-wilson.co.uk> writes:
>
> > Cairo, for instance, has a subtly different interpretation of how to use
> > the mask in combination with the Porter-Duff operators. In particular,
> > it has the notion of a clip mask, for which pixman has no parallel.
> >
> > Quoting Soeren:
> >
> >   Another aspect is that cairo uses a different rendering equation in some
> >   cases. The two equations used are:
> >
> > 	unbounded:   [(src IN shape) OP dest          ] LERP_clip dest
> >
> > 	bounded:     [(src OP dest) LERP_shape dest   ] LERP_clip dest
> >
> >   With shaped clips, the LERP_clip part is taken care of, and the first
> >   equation is already directly supported by pixman. The second one could
> >   be supported by adding new <op>_LERP operators that would use the
> >
> > 	(src OP dest) LERP_shape dest
> >
> >   equation. For cairo's purposes, all we need is CLEAR_LERP and SRC_LERP,
> >   but I think it could be useful to have the full set of LERP operators.
>
> Did you see Taekyun Kim's reply to this? He proposes this API:
>
>      pixman_image_composite_xrender(op, src, shape, clip, dst)
>      pixman_image_composite_bounded(op, src, shape, clip, dst)
>      pixman_image_composite_simple(op, src, shape, clip, dst)
>
> instead, which would add direct one-pass support for all of cairo's
> compositing schemes, including clip masks.

You're encoding operator semantics into the function call and adding
parameters for the rest? Although pixman could benefit from faster
methods of rendering polygons, I do not see this as actually reducing
the amount of code inside Cairo as GL is effectively the lowest common
demoniator. (Though we desparately need a change in the Render protocol
so that we can feed polygons to the server more cheaply and that in turn
merits similar changes in pixman.)

My gut feeling is that interface is too restrictive. You may as well
skip polygon images and go to paths and boolean geometry. In the
meantime providing an interface that matches what Cairo uses today is
also going to be useful for when you replicate Cairo inside pixman.
-Chris

--
Chris Wilson, Intel Open Source Technology Centre
```