[cairo] Blend modes take 3
Soeren Sandmann
sandmann at daimi.au.dk
Tue Nov 25 13:10:01 PST 2008
"Benjamin Otte" <otte at gnome.org> writes:
> On Wed, Nov 19, 2008 at 7:00 PM, Soeren Sandmann <sandmann at daimi.au.dk> wrote:
> > Hi Benjamin,
> >
> > Overall, the separable blend mode stuff looks good, except for the
> > component alpha versions.
> >
> New update pushed to my git branches of pixman/cairo.
Comments on separable blend modes:
- In both fbCombineMultiplyC and fbCombine ## name ## C,
- When mask is 0, there is no reason to read the source.
- The continue is incorrect; it needs to write out 0 in that case,
since the intermediate buffer is not zero-filled.
- In fbCombineMultiplyC,
- There is no reason to read the destination if the inverse
combined src/mask is 0
- In FlashSubtractC, the m = ~m is not used. And fbCombineMaskC()
seems like it could just be fbCombineMaskValueC.
I still don't completely understand the non-separable blend modes, and
how they interact with premultiplied alpha and with component
alpha. But here are some questions about the code:
- In SetLum and SetSat you have, respectively:
> if (Max (tmp) > sa) while (1);
> if (Max (dest) > 255 * 255) while (1);
Are these supposed to never happen?
- In SetLum:
> if (min < 0) {
> tmp[0] = l + (tmp[0] - l) / 4 * l / (l - min) * 4;
> tmp[1] = l + (tmp[1] - l) / 4 * l / (l - min) * 4;
> tmp[2] = l + (tmp[2] - l) / 4 * l / (l - min) * 4;
> }
> if (max > a) {
> tmp[0] = l + (tmp[0] - l) / 4 * (a - l) / (max - l) * 4;
> tmp[1] = l + (tmp[1] - l) / 4 * (a - l) / (max - l) * 4;
> tmp[2] = l + (tmp[2] - l) / 4 * (a - l) / (max - l) * 4;
> }
Where do those 4s come from?
Soren
More information about the cairo
mailing list