8 #include "pixman-private.h"
10 #include "pixman-combine.h"
12 #define Red(x) (((x) >> R_SHIFT) & MASK)
13 #define Green(x) (((x) >> G_SHIFT) & MASK)
14 #define Blue(x) ((x) & MASK)
16 /*** per channel helper functions ***/
19 fbCombineMaskC (comp4_t *src, comp4_t *mask)
50 fbCombineMaskValueC (comp4_t *src, const comp4_t *mask)
70 fbCombineMaskAlphaC (const comp4_t *src, comp4_t *mask)
78 x = *(src) >> A_SHIFT;
97 * There are two ways of handling alpha -- either as a single unified value or
98 * a separate value for each component, hence each macro must have two
99 * versions. The unified alpha version has a 'U' at the end of the name,
100 * the component version has a 'C'. Similarly, functions which deal with
101 * this difference will have two versions using the same convention.
105 * All of the composing functions
108 static force_inline comp4_t
109 combineMask (const comp4_t *src, const comp4_t *mask, int i)
115 m = *(mask + i) >> A_SHIFT;
130 fbCombineClear (pixman_implementation_t *imp, pixman_op_t op,
131 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
133 memset(dest, 0, width*sizeof(comp4_t));
137 fbCombineSrcU (pixman_implementation_t *imp, pixman_op_t op,
138 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
143 memcpy (dest, src, width * sizeof (comp4_t));
146 for (i = 0; i < width; ++i)
148 comp4_t s = combineMask (src, mask, i);
155 /* if the Src is opaque, call fbCombineSrcU */
157 fbCombineOverU (pixman_implementation_t *imp, pixman_op_t op,
158 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
161 for (i = 0; i < width; ++i) {
162 comp4_t s = combineMask (src, mask, i);
163 comp4_t d = *(dest + i);
164 comp4_t ia = Alpha(~s);
166 FbByteMulAdd(d, ia, s);
171 /* if the Dst is opaque, this is a noop */
173 fbCombineOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
174 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
177 for (i = 0; i < width; ++i) {
178 comp4_t s = combineMask (src, mask, i);
179 comp4_t d = *(dest + i);
180 comp4_t ia = Alpha(~*(dest + i));
181 FbByteMulAdd(s, ia, d);
186 /* if the Dst is opaque, call fbCombineSrcU */
188 fbCombineInU (pixman_implementation_t *imp, pixman_op_t op,
189 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
192 for (i = 0; i < width; ++i) {
193 comp4_t s = combineMask (src, mask, i);
194 comp4_t a = Alpha(*(dest + i));
200 /* if the Src is opaque, this is a noop */
202 fbCombineInReverseU (pixman_implementation_t *imp, pixman_op_t op,
203 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
206 for (i = 0; i < width; ++i) {
207 comp4_t s = combineMask (src, mask, i);
208 comp4_t d = *(dest + i);
209 comp4_t a = Alpha(s);
215 /* if the Dst is opaque, call fbCombineClear */
217 fbCombineOutU (pixman_implementation_t *imp, pixman_op_t op,
218 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
221 for (i = 0; i < width; ++i) {
222 comp4_t s = combineMask (src, mask, i);
223 comp4_t a = Alpha(~*(dest + i));
229 /* if the Src is opaque, call fbCombineClear */
231 fbCombineOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
232 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
235 for (i = 0; i < width; ++i) {
236 comp4_t s = combineMask (src, mask, i);
237 comp4_t d = *(dest + i);
238 comp4_t a = Alpha(~s);
244 /* if the Src is opaque, call fbCombineInU */
245 /* if the Dst is opaque, call fbCombineOverU */
246 /* if both the Src and Dst are opaque, call fbCombineSrcU */
248 fbCombineAtopU (pixman_implementation_t *imp, pixman_op_t op,
249 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
252 for (i = 0; i < width; ++i) {
253 comp4_t s = combineMask (src, mask, i);
254 comp4_t d = *(dest + i);
255 comp4_t dest_a = Alpha(d);
256 comp4_t src_ia = Alpha(~s);
258 FbByteAddMul(s, dest_a, d, src_ia);
263 /* if the Src is opaque, call fbCombineOverReverseU */
264 /* if the Dst is opaque, call fbCombineInReverseU */
265 /* if both the Src and Dst are opaque, call fbCombineDstU */
267 fbCombineAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
268 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
271 for (i = 0; i < width; ++i) {
272 comp4_t s = combineMask (src, mask, i);
273 comp4_t d = *(dest + i);
274 comp4_t src_a = Alpha(s);
275 comp4_t dest_ia = Alpha(~d);
277 FbByteAddMul(s, dest_ia, d, src_a);
282 /* if the Src is opaque, call fbCombineOverU */
283 /* if the Dst is opaque, call fbCombineOverReverseU */
284 /* if both the Src and Dst are opaque, call fbCombineClear */
286 fbCombineXorU (pixman_implementation_t *imp, pixman_op_t op,
287 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
290 for (i = 0; i < width; ++i) {
291 comp4_t s = combineMask (src, mask, i);
292 comp4_t d = *(dest + i);
293 comp4_t src_ia = Alpha(~s);
294 comp4_t dest_ia = Alpha(~d);
296 FbByteAddMul(s, dest_ia, d, src_ia);
302 fbCombineAddU (pixman_implementation_t *imp, pixman_op_t op,
303 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
306 for (i = 0; i < width; ++i) {
307 comp4_t s = combineMask (src, mask, i);
308 comp4_t d = *(dest + i);
314 /* if the Src is opaque, call fbCombineAddU */
315 /* if the Dst is opaque, call fbCombineAddU */
316 /* if both the Src and Dst are opaque, call fbCombineAddU */
318 fbCombineSaturateU (pixman_implementation_t *imp, pixman_op_t op,
319 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
322 for (i = 0; i < width; ++i) {
323 comp4_t s = combineMask (src, mask, i);
324 comp4_t d = *(dest + i);
341 * The following blend modes have been taken from the PDF ISO 32000
342 * specification, which at this point in time is available from
343 * http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf
344 * The relevant chapters are 11.3.5 and 11.3.6.
345 * The formula for computing the final pixel color given in 11.3.6 is:
346 * αr × Cr = (1 – αs) × αb × Cb + (1 – αb) × αs × Cs + αb × αs × B(Cb, Cs)
347 * with B() being the blend function.
348 * Note that OVER is a special case of this operation, using B(Cb, Cs) = Cs
350 * These blend modes should match the SVG filter draft specification, as
351 * it has been designed to mirror ISO 32000. Note that at the current point
352 * no released draft exists that shows this, as the formulas have not been
353 * updated yet after the release of ISO 32000.
355 * The default implementation here uses the PdfSeparableBlendMode and
356 * PdfNonSeparableBlendMode macros, which take the blend function as an
357 * argument. Note that this implementation operates on premultiplied colors,
358 * while the PDF specification does not. Therefore the code uses the formula
359 * ar.Cra = (1 – as) . Dca + (1 – ad) . Sca + B(Dca, ad, Sca, as)
364 * B(Dca, ad, Sca, as) = Dca.Sca
368 fbCombineMultiplyU (pixman_implementation_t *imp, pixman_op_t op,
369 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
372 for (i = 0; i < width; ++i) {
373 comp4_t s = combineMask (src, mask, i);
374 comp4_t d = *(dest + i);
376 comp4_t src_ia = Alpha (~s);
377 comp4_t dest_ia = Alpha (~d);
379 FbByteAddMul (ss, dest_ia, d, src_ia);
387 fbCombineMultiplyC (pixman_implementation_t *imp, pixman_op_t op,
388 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
391 for (i = 0; i < width; ++i) {
392 comp4_t m = *(mask + i);
393 comp4_t s = *(src + i);
394 comp4_t d = *(dest + i);
396 comp4_t dest_ia = Alpha (~d);
398 fbCombineMaskValueC (&s, &m);
400 FbByteAddMulC (r, ~m, s, dest_ia);
408 #define PdfSeparableBlendMode(name) \
410 fbCombine ## name ## U (pixman_implementation_t *imp, pixman_op_t op, \
411 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \
414 for (i = 0; i < width; ++i) { \
415 comp4_t s = combineMask (src, mask, i); \
416 comp4_t d = *(dest + i); \
417 comp1_t sa = Alpha(s); \
419 comp1_t da = Alpha(d); \
424 FbByteAddMul(result, isa, s, ida); \
426 *(dest + i) = result + \
427 (DivOne (sa * da) << A_SHIFT) + \
428 (Blend ## name (Red (d), da, Red (s), sa) << R_SHIFT) + \
429 (Blend ## name (Green (d), da, Green (s), sa) << G_SHIFT) + \
430 (Blend ## name (Blue (d), da, Blue (s), sa)); \
435 fbCombine ## name ## C (pixman_implementation_t *imp, pixman_op_t op, \
436 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \
439 for (i = 0; i < width; ++i) { \
440 comp4_t m = *(mask + i); \
441 comp4_t s = *(src + i); \
442 comp4_t d = *(dest + i); \
443 comp1_t da = Alpha(d); \
447 fbCombineMaskValueC (&s, &m); \
450 FbByteAddMulC (result, ~m, s, ida); \
453 (DivOne (Alpha (m) * da) << A_SHIFT) + \
454 (Blend ## name (Red (d), da, Red (s), Red (m)) << R_SHIFT) + \
455 (Blend ## name (Green (d), da, Green (s), Green (m)) << G_SHIFT) + \
456 (Blend ## name (Blue (d), da, Blue (s), Blue (m))); \
458 *(dest + i) = result; \
464 * B(Dca, ad, Sca, as) = Dca.sa + Sca.da - Dca.Sca
467 static inline comp4_t
468 BlendScreen (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
470 return DivOne (sca * da + dca * sa - sca * dca);
473 PdfSeparableBlendMode (Screen)
477 * B(Dca, ab, Sca, as) =
481 * Sa.Da - 2.(Da - Dca).(Sa - Sca)
484 static inline comp4_t
485 BlendOverlay (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
492 rca = sa * da - 2 * (da - dca) * (sa - sca);
496 PdfSeparableBlendMode (Overlay)
500 * B(Dca, ab, Sca, as) = min (Sca.Da, Dca.Sa)
503 static inline comp4_t
504 BlendDarken (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
510 return DivOne (s > d ? d : s);
513 PdfSeparableBlendMode (Darken)
517 * B(Dca, ab, Sca, as) = max (Sca.Da, Dca.Sa)
520 static inline comp4_t
521 BlendLighten (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
527 return DivOne (s > d ? s : d);
530 PdfSeparableBlendMode (Lighten)
534 * B(Dca, ab, Sca, as) =
538 * Da.Sa. min (Dca / Da / (1 - Sca/Sa))
541 static inline comp4_t
542 BlendColorDodge (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
545 return DivOne (sa * da);
547 comp4_t rca = dca * sa * sa / (sa - sca);
548 return DivOne (rca > sa * da ? sa * da : rca);
552 PdfSeparableBlendMode (ColorDodge)
556 * B(Dca, ab, Sca, as) =
560 * Sa.Da.(1 - min (1, (1 - Dca/Da).Sa / Sca))
563 static inline comp4_t
564 BlendColorBurn (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
569 comp4_t sada = sa * da;
570 comp4_t rca = (da - dca) * sa * sa / sca;
571 return DivOne (rca > sada ? 0 : sada - rca);
575 PdfSeparableBlendMode (ColorBurn)
579 * B(Dca, ab, Sca, as) =
583 * Sa.Da - 2.(Da - Dca).(Sa - Sca)
585 static inline comp4_t
586 BlendHardLight (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
589 return DivOne (2 * sca * dca);
591 return DivOne (sa * da - 2 * (da - dca) * (sa - sca));
594 PdfSeparableBlendMode (HardLight)
598 * B(Dca, ab, Sca, as) =
600 * Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa))
601 * otherwise if Dca.4 <= Da
602 * Dca.(Sa + (2.Sca - Sa).((16.Dca/Da - 12).Dca/Da + 3)
604 * (Dca.Sa + (SQRT (Dca/Da).Da - Dca).(2.Sca - Sa))
607 static inline comp4_t
608 BlendSoftLight (comp4_t dca_org, comp4_t da_org, comp4_t sca_org, comp4_t sa_org)
610 double dca = dca_org * (1.0 / MASK);
611 double da = da_org * (1.0 / MASK);
612 double sca = sca_org * (1.0 / MASK);
613 double sa = sa_org * (1.0 / MASK);
620 rca = dca * sa - dca * (da - dca) * (sa - 2 * sca) / da;
621 } else if (da == 0) {
623 } else if (4 * dca <= da) {
624 rca = dca * sa + (2 * sca - sa) * dca * ((16 * dca / da - 12) * dca / da + 3);
626 rca = dca * sa + (sqrt (dca * da) - dca) * (2 * sca - sa);
628 return rca * MASK + 0.5;
631 PdfSeparableBlendMode (SoftLight)
635 * B(Dca, ab, Sca, as) = abs (Dca.Sa - Sca.Da)
638 static inline comp4_t
639 BlendDifference (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
641 comp4_t dcasa = dca * sa;
642 comp4_t scada = sca * da;
645 return DivOne (dcasa - scada);
647 return DivOne (scada - dcasa);
650 PdfSeparableBlendMode (Difference)
654 * B(Dca, ab, Sca, as) = (Sca.Da + Dca.Sa - 2.Sca.Dca)
657 /* This can be made faster by writing it directly and not using
658 * PdfSeparableBlendMode, but that's a performance optimization */
660 static inline comp4_t
661 BlendExclusion (comp4_t dca, comp4_t da, comp4_t sca, comp4_t sa)
663 return DivOne (sca * da + dca * sa - 2 * dca * sca);
666 PdfSeparableBlendMode (Exclusion)
668 #undef PdfSeparableBlendMode
671 * PDF nonseperable blend modes are implemented using the following functions
672 * to operate in HSL space, with Cmax, Cmid, Cmin referring to the max, mid
673 * and min value of the red, green and blue components.
675 * Lum (C) = 0.3 × Cred + 0.59 × Cgreen + 0.11 × Cblue
682 * C = l + ( ( ( C – l ) × l ) ⁄ ( l – min ) )
684 * C = l + ( ( ( C – l ) × ( 1 – l ) ) ⁄ ( max – l ) )
690 * return ClipColor (C)
692 * Sat (C) = Max (C) - Min (C)
696 * Cmid = ( ( ( Cmid – Cmin ) × s ) ⁄ ( Cmax – Cmin ) )
704 /* For premultiplied colors, we need to know what happens when C is
705 * multiplied by a real number. Lum and Sat are linear:
707 * Lum (r × C) = r × Lum (C) Sat (r * C) = r * Sat (C)
709 * If we extend ClipColor with an extra argument a and change
717 * then ClipColor is also linear:
719 * r * ClipColor (C, a) = ClipColor (rC, ra);
723 * Similarly, we can extend SetLum with an extra argument that is just passed
726 * r * SetLum ( C, l, a)
728 * = r × ClipColor ( C + l - Lum (C), a)
730 * = ClipColor ( r * C + r × l - r * Lum (C), r * a)
732 * = SetLum ( r * C, r * l, r * a)
736 * r * SetSat (C, s) = SetSat (x * C, r * s)
738 * The above holds for all non-zero x, because they x'es in the fraction for
739 * C_mid cancel out. Specifically, it holds for x = r:
741 * r * SetSat (C, s) = SetSat (rC, rs)
745 /* So, for the non-separable PDF blend modes, we have (using s, d for non-premultiplied
746 * colors, and S, D for premultiplied:
750 * a_s * a_d * B(s, d)
751 * = a_s * a_d * SetLum (S/a_s, Lum (D/a_d), 1)
752 * = SetLum (S * a_d, a_s * Lum (D), a_s * a_d)
757 * a_s * a_d * B(s, d)
758 * = a_s * a_d * SetLum (D/a_d, Lum(S/a_s), 1)
759 * = SetLum (a_s * D, a_d * Lum(S), a_s * a_d)
764 * a_s * a_d * B(s, d)
765 * = a_s * a_d * SetLum (SetSat (D/a_d, Sat (S/a_s)), Lum (D/a_d), 1)
766 * = SetLum (a_s * a_d * SetSat (D/a_d, Sat (S/a_s)), a_s * Lum (D), a_s * a_d)
767 * = SetLum (SetSat (a_s * D, a_d * Sat (S), a_s * Lum (D), a_s * a_d))
771 * a_s * a_d * B(s, d)
772 * = a_s * a_d * SetLum (SetSat (S/a_s, Sat (D/a_d)), Lum (D/a_d), 1)
773 * = a_s * a_d * SetLum (SetSat (a_d * S, a_s * Sat (D)), a_s * Lum (D), a_s * a_d)
777 #define Min(c) (c[0] < c[1] ? (c[0] < c[2] ? c[0] : c[2]) : (c[1] < c[2] ? c[1] : c[2]))
778 #define Max(c) (c[0] > c[1] ? (c[0] > c[2] ? c[0] : c[2]) : (c[1] > c[2] ? c[1] : c[2]))
779 #define Lum(c) ((c[0] * 30 + c[1] * 59 + c[2] * 11) / 100)
780 #define Sat(c) (Max (c) - Min (c))
782 #define PdfNonSeparableBlendMode(name) \
784 fbCombine ## name ## U (pixman_implementation_t *imp, pixman_op_t op, \
785 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) \
788 for (i = 0; i < width; ++i) { \
789 comp4_t s = combineMask (src, mask, i); \
790 comp4_t d = *(dest + i); \
791 comp1_t sa = Alpha(s); \
793 comp1_t da = Alpha(d); \
796 comp4_t sc[3], dc[3], c[3]; \
799 FbByteAddMul(result, isa, s, ida); \
806 Blend ## name (c, dc, da, sc, sa); \
808 *(dest + i) = result + \
809 (DivOne (sa * da) << A_SHIFT) + \
810 (DivOne (c[0]) << R_SHIFT) + \
811 (DivOne (c[1]) << G_SHIFT) + \
817 SetLum (comp4_t dest[3], comp4_t src[3], comp4_t sa, comp4_t lum)
819 double a, l, min, max;
822 a = sa * (1.0 / MASK);
823 l = lum * (1.0 / MASK);
824 tmp[0] = src[0] * (1.0 / MASK);
825 tmp[1] = src[1] * (1.0 / MASK);
826 tmp[2] = src[2] * (1.0 / MASK);
838 tmp[0] = l + (tmp[0] - l) * l / (l - min);
839 tmp[1] = l + (tmp[1] - l) * l / (l - min);
840 tmp[2] = l + (tmp[2] - l) * l / (l - min);
843 tmp[0] = l + (tmp[0] - l) * (a - l) / (max - l);
844 tmp[1] = l + (tmp[1] - l) * (a - l) / (max - l);
845 tmp[2] = l + (tmp[2] - l) * (a - l) / (max - l);
847 dest[0] = tmp[0] * MASK + 0.5;
848 dest[1] = tmp[1] * MASK + 0.5;
849 dest[2] = tmp[2] * MASK + 0.5;
853 SetSat (comp4_t dest[3], comp4_t src[3], comp4_t sat)
858 if (src[0] > src[1]) {
859 if (src[0] > src[2]) {
861 if (src[1] > src[2]) {
874 if (src[0] > src[2]) {
880 if (src[1] > src[2]) {
892 dest[id[1]] = (dest[id[1]] - min) * sat / (max - min);
896 dest[0] = dest[1] = dest[2] = 0;
902 * B(Cb, Cs) = SetLum (SetSat (Cs, Sat (Cb)), Lum (Cb))
905 BlendHSLHue (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
910 SetSat (c, c, Sat (dc) * sa);
911 SetLum (c, c, sa * da, Lum (dc) * sa);
914 PdfNonSeparableBlendMode (HSLHue)
918 * B(Cb, Cs) = SetLum (SetSat (Cb, Sat (Cs)), Lum (Cb))
921 BlendHSLSaturation (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
926 SetSat (c, c, Sat (sc) * da);
927 SetLum (c, c, sa * da, Lum (dc) * sa);
930 PdfNonSeparableBlendMode (HSLSaturation)
934 * B(Cb, Cs) = SetLum (Cs, Lum (Cb))
937 BlendHSLColor (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
942 SetLum (c, c, sa * da, Lum (dc) * sa);
945 PdfNonSeparableBlendMode (HSLColor)
949 * B(Cb, Cs) = SetLum (Cb, Lum (Cs))
952 BlendHSLLuminosity (comp4_t c[3], comp4_t dc[3], comp4_t da, comp4_t sc[3], comp4_t sa)
957 SetLum (c, c, sa * da, Lum (sc) * da);
960 PdfNonSeparableBlendMode (HSLLuminosity)
966 #undef PdfNonSeparableBlendMode
970 * All of the disjoint composing functions
972 The four entries in the first column indicate what source contributions
973 come from each of the four areas of the picture -- areas covered by neither
974 A nor B, areas covered only by A, areas covered only by B and finally
975 areas covered by both A and B.
982 (0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0)
983 (0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1
984 (0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0
985 (0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1)
986 (0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0
987 (0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0)
988 (0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0)
989 (0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b)
990 (0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0)
994 #define CombineAOut 1
996 #define CombineBOut 4
999 #define CombineClear 0
1000 #define CombineA (CombineAOut|CombineAIn)
1001 #define CombineB (CombineBOut|CombineBIn)
1002 #define CombineAOver (CombineAOut|CombineBOut|CombineAIn)
1003 #define CombineBOver (CombineAOut|CombineBOut|CombineBIn)
1004 #define CombineAAtop (CombineBOut|CombineAIn)
1005 #define CombineBAtop (CombineAOut|CombineBIn)
1006 #define CombineXor (CombineAOut|CombineBOut)
1008 /* portion covered by a but not b */
1010 fbCombineDisjointOutPart (comp1_t a, comp1_t b)
1012 /* min (1, (1-b) / a) */
1015 if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */
1016 return MASK; /* 1 */
1017 return IntDiv(b,a); /* (1-b) / a */
1020 /* portion covered by both a and b */
1022 fbCombineDisjointInPart (comp1_t a, comp1_t b)
1024 /* max (1-(1-b)/a,0) */
1025 /* = - min ((1-b)/a - 1, 0) */
1026 /* = 1 - min (1, (1-b)/a) */
1029 if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */
1030 return 0; /* 1 - 1 */
1031 return ~IntDiv(b,a); /* 1 - (1-b) / a */
1034 /* portion covered by a but not b */
1036 fbCombineConjointOutPart (comp1_t a, comp1_t b)
1039 /* = 1-min(b/a,1) */
1041 /* min (1, (1-b) / a) */
1043 if (b >= a) /* b >= a -> b/a >= 1 */
1044 return 0x00; /* 0 */
1045 return ~IntDiv(b,a); /* 1 - b/a */
1048 /* portion covered by both a and b */
1050 fbCombineConjointInPart (comp1_t a, comp1_t b)
1054 if (b >= a) /* b >= a -> b/a >= 1 */
1055 return MASK; /* 1 */
1056 return IntDiv(b,a); /* b/a */
1059 #define GetComp(v,i) ((comp2_t) (comp1_t) ((v) >> i))
1061 #define Add(x,y,i,t) ((t) = GetComp(x,i) + GetComp(y,i), \
1062 (comp4_t) ((comp1_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
1064 #define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
1065 IntMult(GetComp(x,i),ax,(v))), \
1066 (comp4_t) ((comp1_t) ((t) | \
1067 (0 - ((t) >> G_SHIFT)))) << (i))
1070 fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
1073 for (i = 0; i < width; ++i) {
1074 comp4_t s = combineMask (src, mask, i);
1075 comp4_t d = *(dest + i);
1077 comp2_t Fa, Fb, t, u, v;
1078 comp1_t sa = s >> A_SHIFT;
1079 comp1_t da = d >> A_SHIFT;
1081 switch (combine & CombineA) {
1086 Fa = fbCombineDisjointOutPart (sa, da);
1089 Fa = fbCombineDisjointInPart (sa, da);
1096 switch (combine & CombineB) {
1101 Fb = fbCombineDisjointOutPart (da, sa);
1104 Fb = fbCombineDisjointInPart (da, sa);
1110 m = FbGen (s,d,0,Fa,Fb,t, u, v);
1111 n = FbGen (s,d,G_SHIFT,Fa,Fb,t, u, v);
1112 o = FbGen (s,d,R_SHIFT,Fa,Fb,t, u, v);
1113 p = FbGen (s,d,A_SHIFT,Fa,Fb,t, u, v);
1120 fbCombineDisjointOverU (pixman_implementation_t *imp, pixman_op_t op,
1121 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1124 for (i = 0; i < width; ++i) {
1125 comp4_t s = combineMask (src, mask, i);
1126 comp2_t a = s >> A_SHIFT;
1132 comp4_t d = *(dest + i);
1133 a = fbCombineDisjointOutPart (d >> A_SHIFT, a);
1134 FbByteMulAdd(d, a, s);
1143 fbCombineDisjointInU (pixman_implementation_t *imp, pixman_op_t op,
1144 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1146 fbCombineDisjointGeneralU (dest, src, mask, width, CombineAIn);
1150 fbCombineDisjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
1151 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1153 fbCombineDisjointGeneralU (dest, src, mask, width, CombineBIn);
1157 fbCombineDisjointOutU (pixman_implementation_t *imp, pixman_op_t op,
1158 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1160 fbCombineDisjointGeneralU (dest, src, mask, width, CombineAOut);
1164 fbCombineDisjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
1165 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1167 fbCombineDisjointGeneralU (dest, src, mask, width, CombineBOut);
1171 fbCombineDisjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
1172 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1174 fbCombineDisjointGeneralU (dest, src, mask, width, CombineAAtop);
1178 fbCombineDisjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
1179 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1181 fbCombineDisjointGeneralU (dest, src, mask, width, CombineBAtop);
1185 fbCombineDisjointXorU (pixman_implementation_t *imp, pixman_op_t op,
1186 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1188 fbCombineDisjointGeneralU (dest, src, mask, width, CombineXor);
1192 fbCombineConjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
1195 for (i = 0; i < width; ++i) {
1196 comp4_t s = combineMask (src, mask, i);
1197 comp4_t d = *(dest + i);
1199 comp2_t Fa, Fb, t, u, v;
1200 comp1_t sa = s >> A_SHIFT;
1201 comp1_t da = d >> A_SHIFT;
1203 switch (combine & CombineA) {
1208 Fa = fbCombineConjointOutPart (sa, da);
1211 Fa = fbCombineConjointInPart (sa, da);
1218 switch (combine & CombineB) {
1223 Fb = fbCombineConjointOutPart (da, sa);
1226 Fb = fbCombineConjointInPart (da, sa);
1232 m = FbGen (s,d,0,Fa,Fb,t, u, v);
1233 n = FbGen (s,d,G_SHIFT,Fa,Fb,t, u, v);
1234 o = FbGen (s,d,R_SHIFT,Fa,Fb,t, u, v);
1235 p = FbGen (s,d,A_SHIFT,Fa,Fb,t, u, v);
1242 fbCombineConjointOverU (pixman_implementation_t *imp, pixman_op_t op,
1243 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1245 fbCombineConjointGeneralU (dest, src, mask, width, CombineAOver);
1250 fbCombineConjointOverReverseU (pixman_implementation_t *imp, pixman_op_t op,
1251 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1253 fbCombineConjointGeneralU (dest, src, mask, width, CombineBOver);
1258 fbCombineConjointInU (pixman_implementation_t *imp, pixman_op_t op,
1259 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1261 fbCombineConjointGeneralU (dest, src, mask, width, CombineAIn);
1266 fbCombineConjointInReverseU (pixman_implementation_t *imp, pixman_op_t op,
1267 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1269 fbCombineConjointGeneralU (dest, src, mask, width, CombineBIn);
1273 fbCombineConjointOutU (pixman_implementation_t *imp, pixman_op_t op,
1274 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1276 fbCombineConjointGeneralU (dest, src, mask, width, CombineAOut);
1280 fbCombineConjointOutReverseU (pixman_implementation_t *imp, pixman_op_t op,
1281 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1283 fbCombineConjointGeneralU (dest, src, mask, width, CombineBOut);
1287 fbCombineConjointAtopU (pixman_implementation_t *imp, pixman_op_t op,
1288 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1290 fbCombineConjointGeneralU (dest, src, mask, width, CombineAAtop);
1294 fbCombineConjointAtopReverseU (pixman_implementation_t *imp, pixman_op_t op,
1295 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1297 fbCombineConjointGeneralU (dest, src, mask, width, CombineBAtop);
1301 fbCombineConjointXorU (pixman_implementation_t *imp, pixman_op_t op,
1302 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1304 fbCombineConjointGeneralU (dest, src, mask, width, CombineXor);
1307 /********************************************************************************/
1308 /*************************** Per Channel functions ******************************/
1309 /********************************************************************************/
1312 fbCombineClearC (pixman_implementation_t *imp, pixman_op_t op,
1313 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1315 memset(dest, 0, width*sizeof(comp4_t));
1319 fbCombineSrcC (pixman_implementation_t *imp, pixman_op_t op,
1320 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1324 for (i = 0; i < width; ++i) {
1325 comp4_t s = *(src + i);
1326 comp4_t m = *(mask + i);
1328 fbCombineMaskValueC (&s, &m);
1335 fbCombineOverC (pixman_implementation_t *imp, pixman_op_t op,
1336 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1340 for (i = 0; i < width; ++i) {
1341 comp4_t s = *(src + i);
1342 comp4_t m = *(mask + i);
1345 fbCombineMaskC (&s, &m);
1352 comp4_t d = *(dest + i);
1353 FbByteMulAddC(d, a, s);
1362 fbCombineOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
1363 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1367 for (i = 0; i < width; ++i) {
1368 comp4_t d = *(dest + i);
1369 comp4_t a = ~d >> A_SHIFT;
1373 comp4_t s = *(src + i);
1374 comp4_t m = *(mask + i);
1376 fbCombineMaskValueC (&s, &m);
1380 FbByteMulAdd(s, a, d);
1388 fbCombineInC (pixman_implementation_t *imp, pixman_op_t op,
1389 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1393 for (i = 0; i < width; ++i) {
1394 comp4_t d = *(dest + i);
1395 comp2_t a = d >> A_SHIFT;
1399 comp4_t m = *(mask + i);
1402 fbCombineMaskValueC (&s, &m);
1413 fbCombineInReverseC (pixman_implementation_t *imp, pixman_op_t op,
1414 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1418 for (i = 0; i < width; ++i) {
1419 comp4_t s = *(src + i);
1420 comp4_t m = *(mask + i);
1423 fbCombineMaskAlphaC (&s, &m);
1440 fbCombineOutC (pixman_implementation_t *imp, pixman_op_t op,
1441 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1445 for (i = 0; i < width; ++i) {
1446 comp4_t d = *(dest + i);
1447 comp2_t a = ~d >> A_SHIFT;
1451 comp4_t m = *(mask + i);
1454 fbCombineMaskValueC (&s, &m);
1466 fbCombineOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
1467 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1471 for (i = 0; i < width; ++i) {
1472 comp4_t s = *(src + i);
1473 comp4_t m = *(mask + i);
1476 fbCombineMaskAlphaC (&s, &m);
1493 fbCombineAtopC (pixman_implementation_t *imp, pixman_op_t op,
1494 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1498 for (i = 0; i < width; ++i) {
1499 comp4_t d = *(dest + i);
1500 comp4_t s = *(src + i);
1501 comp4_t m = *(mask + i);
1503 comp2_t as = d >> A_SHIFT;
1505 fbCombineMaskC (&s, &m);
1509 FbByteAddMulC(d, ad, s, as);
1515 fbCombineAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
1516 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1520 for (i = 0; i < width; ++i) {
1522 comp4_t d = *(dest + i);
1523 comp4_t s = *(src + i);
1524 comp4_t m = *(mask + i);
1526 comp2_t as = ~d >> A_SHIFT;
1528 fbCombineMaskC (&s, &m);
1532 FbByteAddMulC(d, ad, s, as);
1538 fbCombineXorC (pixman_implementation_t *imp, pixman_op_t op,
1539 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1543 for (i = 0; i < width; ++i) {
1544 comp4_t d = *(dest + i);
1545 comp4_t s = *(src + i);
1546 comp4_t m = *(mask + i);
1548 comp2_t as = ~d >> A_SHIFT;
1550 fbCombineMaskC (&s, &m);
1554 FbByteAddMulC(d, ad, s, as);
1560 fbCombineAddC (pixman_implementation_t *imp, pixman_op_t op,
1561 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1565 for (i = 0; i < width; ++i) {
1566 comp4_t s = *(src + i);
1567 comp4_t m = *(mask + i);
1568 comp4_t d = *(dest + i);
1570 fbCombineMaskValueC (&s, &m);
1578 fbCombineSaturateC (pixman_implementation_t *imp, pixman_op_t op,
1579 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1583 for (i = 0; i < width; ++i) {
1585 comp2_t sa, sr, sg, sb, da;
1593 fbCombineMaskC (&s, &m);
1595 sa = (m >> A_SHIFT);
1596 sr = (m >> R_SHIFT) & MASK;
1597 sg = (m >> G_SHIFT) & MASK;
1604 m = FbGen (s, d, 0, (da << G_SHIFT) / sb, MASK, t, u, v);
1607 n = Add(s,d,G_SHIFT,t);
1609 n = FbGen (s, d, G_SHIFT, (da << G_SHIFT) / sg, MASK, t, u, v);
1612 o = Add(s,d,R_SHIFT,t);
1614 o = FbGen (s, d, R_SHIFT, (da << G_SHIFT) / sr, MASK, t, u, v);
1617 p = Add(s,d,A_SHIFT,t);
1619 p = FbGen (s, d, A_SHIFT, (da << G_SHIFT) / sa, MASK, t, u, v);
1621 *(dest + i) = m|n|o|p;
1626 fbCombineDisjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
1630 for (i = 0; i < width; ++i) {
1643 fbCombineMaskC (&s, &m);
1647 switch (combine & CombineA) {
1652 m = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> 0), da);
1653 n = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
1654 o = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
1655 p = (comp4_t)fbCombineDisjointOutPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
1659 m = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> 0), da);
1660 n = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
1661 o = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
1662 p = (comp4_t)fbCombineDisjointInPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
1670 switch (combine & CombineB) {
1675 m = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> 0));
1676 n = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
1677 o = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
1678 p = (comp4_t)fbCombineDisjointOutPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
1682 m = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> 0));
1683 n = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
1684 o = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
1685 p = (comp4_t)fbCombineDisjointInPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
1692 m = FbGen (s,d,0,GetComp(Fa,0),GetComp(Fb,0),t, u, v);
1693 n = FbGen (s,d,G_SHIFT,GetComp(Fa,G_SHIFT),GetComp(Fb,G_SHIFT),t, u, v);
1694 o = FbGen (s,d,R_SHIFT,GetComp(Fa,R_SHIFT),GetComp(Fb,R_SHIFT),t, u, v);
1695 p = FbGen (s,d,A_SHIFT,GetComp(Fa,A_SHIFT),GetComp(Fb,A_SHIFT),t, u, v);
1702 fbCombineDisjointOverC (pixman_implementation_t *imp, pixman_op_t op,
1703 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1705 fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver);
1709 fbCombineDisjointInC (pixman_implementation_t *imp, pixman_op_t op,
1710 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1712 fbCombineDisjointGeneralC (dest, src, mask, width, CombineAIn);
1716 fbCombineDisjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
1717 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1719 fbCombineDisjointGeneralC (dest, src, mask, width, CombineBIn);
1723 fbCombineDisjointOutC (pixman_implementation_t *imp, pixman_op_t op,
1724 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1726 fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOut);
1730 fbCombineDisjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
1731 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1733 fbCombineDisjointGeneralC (dest, src, mask, width, CombineBOut);
1737 fbCombineDisjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
1738 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1740 fbCombineDisjointGeneralC (dest, src, mask, width, CombineAAtop);
1744 fbCombineDisjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
1745 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1747 fbCombineDisjointGeneralC (dest, src, mask, width, CombineBAtop);
1751 fbCombineDisjointXorC (pixman_implementation_t *imp, pixman_op_t op,
1752 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1754 fbCombineDisjointGeneralC (dest, src, mask, width, CombineXor);
1758 fbCombineConjointGeneralC (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine)
1762 for (i = 0; i < width; ++i) {
1775 fbCombineMaskC (&s, &m);
1779 switch (combine & CombineA) {
1784 m = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> 0), da);
1785 n = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
1786 o = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
1787 p = (comp4_t)fbCombineConjointOutPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
1791 m = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> 0), da);
1792 n = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> G_SHIFT), da) << G_SHIFT;
1793 o = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> R_SHIFT), da) << R_SHIFT;
1794 p = (comp4_t)fbCombineConjointInPart ((comp1_t) (sa >> A_SHIFT), da) << A_SHIFT;
1802 switch (combine & CombineB) {
1807 m = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> 0));
1808 n = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
1809 o = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
1810 p = (comp4_t)fbCombineConjointOutPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
1814 m = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> 0));
1815 n = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> G_SHIFT)) << G_SHIFT;
1816 o = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> R_SHIFT)) << R_SHIFT;
1817 p = (comp4_t)fbCombineConjointInPart (da, (comp1_t) (sa >> A_SHIFT)) << A_SHIFT;
1824 m = FbGen (s,d,0,GetComp(Fa,0),GetComp(Fb,0),t, u, v);
1825 n = FbGen (s,d,G_SHIFT,GetComp(Fa,G_SHIFT),GetComp(Fb,G_SHIFT),t, u, v);
1826 o = FbGen (s,d,R_SHIFT,GetComp(Fa,R_SHIFT),GetComp(Fb,R_SHIFT),t, u, v);
1827 p = FbGen (s,d,A_SHIFT,GetComp(Fa,A_SHIFT),GetComp(Fb,A_SHIFT),t, u, v);
1834 fbCombineConjointOverC (pixman_implementation_t *imp, pixman_op_t op,
1835 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1837 fbCombineConjointGeneralC (dest, src, mask, width, CombineAOver);
1841 fbCombineConjointOverReverseC (pixman_implementation_t *imp, pixman_op_t op,
1842 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1844 fbCombineConjointGeneralC (dest, src, mask, width, CombineBOver);
1848 fbCombineConjointInC (pixman_implementation_t *imp, pixman_op_t op,
1849 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1851 fbCombineConjointGeneralC (dest, src, mask, width, CombineAIn);
1855 fbCombineConjointInReverseC (pixman_implementation_t *imp, pixman_op_t op,
1856 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1858 fbCombineConjointGeneralC (dest, src, mask, width, CombineBIn);
1862 fbCombineConjointOutC (pixman_implementation_t *imp, pixman_op_t op,
1863 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1865 fbCombineConjointGeneralC (dest, src, mask, width, CombineAOut);
1869 fbCombineConjointOutReverseC (pixman_implementation_t *imp, pixman_op_t op,
1870 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1872 fbCombineConjointGeneralC (dest, src, mask, width, CombineBOut);
1876 fbCombineConjointAtopC (pixman_implementation_t *imp, pixman_op_t op,
1877 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1879 fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop);
1883 fbCombineConjointAtopReverseC (pixman_implementation_t *imp, pixman_op_t op,
1884 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1886 fbCombineConjointGeneralC (dest, src, mask, width, CombineBAtop);
1890 fbCombineConjointXorC (pixman_implementation_t *imp, pixman_op_t op,
1891 comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width)
1893 fbCombineConjointGeneralC (dest, src, mask, width, CombineXor);
1897 _pixman_setup_combiner_functions_width (pixman_implementation_t *imp)
1900 imp->combine_width[PIXMAN_OP_CLEAR] = fbCombineClear;
1901 imp->combine_width[PIXMAN_OP_SRC] = fbCombineSrcU;
1903 imp->combine_width[PIXMAN_OP_OVER] = fbCombineOverU;
1904 imp->combine_width[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseU;
1905 imp->combine_width[PIXMAN_OP_IN] = fbCombineInU;
1906 imp->combine_width[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseU;
1907 imp->combine_width[PIXMAN_OP_OUT] = fbCombineOutU;
1908 imp->combine_width[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseU;
1909 imp->combine_width[PIXMAN_OP_ATOP] = fbCombineAtopU;
1910 imp->combine_width[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseU;
1911 imp->combine_width[PIXMAN_OP_XOR] = fbCombineXorU;
1912 imp->combine_width[PIXMAN_OP_ADD] = fbCombineAddU;
1913 imp->combine_width[PIXMAN_OP_SATURATE] = fbCombineSaturateU;
1915 /* Disjoint, unified */
1916 imp->combine_width[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClear;
1917 imp->combine_width[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcU;
1919 imp->combine_width[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverU;
1920 imp->combine_width[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateU;
1921 imp->combine_width[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInU;
1922 imp->combine_width[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseU;
1923 imp->combine_width[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutU;
1924 imp->combine_width[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseU;
1925 imp->combine_width[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopU;
1926 imp->combine_width[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseU;
1927 imp->combine_width[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorU;
1929 /* Conjoint, unified */
1930 imp->combine_width[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClear;
1931 imp->combine_width[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcU;
1933 imp->combine_width[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverU;
1934 imp->combine_width[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseU;
1935 imp->combine_width[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInU;
1936 imp->combine_width[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseU;
1937 imp->combine_width[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutU;
1938 imp->combine_width[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseU;
1939 imp->combine_width[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopU;
1940 imp->combine_width[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseU;
1941 imp->combine_width[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorU;
1943 imp->combine_width[PIXMAN_OP_MULTIPLY] = fbCombineMultiplyU;
1944 imp->combine_width[PIXMAN_OP_SCREEN] = fbCombineScreenU;
1945 imp->combine_width[PIXMAN_OP_OVERLAY] = fbCombineOverlayU;
1946 imp->combine_width[PIXMAN_OP_DARKEN] = fbCombineDarkenU;
1947 imp->combine_width[PIXMAN_OP_LIGHTEN] = fbCombineLightenU;
1948 imp->combine_width[PIXMAN_OP_COLOR_DODGE] = fbCombineColorDodgeU;
1949 imp->combine_width[PIXMAN_OP_COLOR_BURN] = fbCombineColorBurnU;
1950 imp->combine_width[PIXMAN_OP_HARD_LIGHT] = fbCombineHardLightU;
1951 imp->combine_width[PIXMAN_OP_SOFT_LIGHT] = fbCombineSoftLightU;
1952 imp->combine_width[PIXMAN_OP_DIFFERENCE] = fbCombineDifferenceU;
1953 imp->combine_width[PIXMAN_OP_EXCLUSION] = fbCombineExclusionU;
1954 imp->combine_width[PIXMAN_OP_HSL_HUE] = fbCombineHSLHueU;
1955 imp->combine_width[PIXMAN_OP_HSL_SATURATION] = fbCombineHSLSaturationU;
1956 imp->combine_width[PIXMAN_OP_HSL_COLOR] = fbCombineHSLColorU;
1957 imp->combine_width[PIXMAN_OP_HSL_LUMINOSITY] = fbCombineHSLLuminosityU;
1959 /* Component alpha combiners */
1960 imp->combine_width_ca[PIXMAN_OP_CLEAR] = fbCombineClearC;
1961 imp->combine_width_ca[PIXMAN_OP_SRC] = fbCombineSrcC;
1963 imp->combine_width_ca[PIXMAN_OP_OVER] = fbCombineOverC;
1964 imp->combine_width_ca[PIXMAN_OP_OVER_REVERSE] = fbCombineOverReverseC;
1965 imp->combine_width_ca[PIXMAN_OP_IN] = fbCombineInC;
1966 imp->combine_width_ca[PIXMAN_OP_IN_REVERSE] = fbCombineInReverseC;
1967 imp->combine_width_ca[PIXMAN_OP_OUT] = fbCombineOutC;
1968 imp->combine_width_ca[PIXMAN_OP_OUT_REVERSE] = fbCombineOutReverseC;
1969 imp->combine_width_ca[PIXMAN_OP_ATOP] = fbCombineAtopC;
1970 imp->combine_width_ca[PIXMAN_OP_ATOP_REVERSE] = fbCombineAtopReverseC;
1971 imp->combine_width_ca[PIXMAN_OP_XOR] = fbCombineXorC;
1972 imp->combine_width_ca[PIXMAN_OP_ADD] = fbCombineAddC;
1973 imp->combine_width_ca[PIXMAN_OP_SATURATE] = fbCombineSaturateC;
1976 imp->combine_width_ca[PIXMAN_OP_DISJOINT_CLEAR] = fbCombineClearC;
1977 imp->combine_width_ca[PIXMAN_OP_DISJOINT_SRC] = fbCombineSrcC;
1979 imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER] = fbCombineDisjointOverC;
1980 imp->combine_width_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = fbCombineSaturateC,
1981 imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN] = fbCombineDisjointInC;
1982 imp->combine_width_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = fbCombineDisjointInReverseC;
1983 imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT] = fbCombineDisjointOutC;
1984 imp->combine_width_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = fbCombineDisjointOutReverseC;
1985 imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP] = fbCombineDisjointAtopC;
1986 imp->combine_width_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = fbCombineDisjointAtopReverseC;
1987 imp->combine_width_ca[PIXMAN_OP_DISJOINT_XOR] = fbCombineDisjointXorC;
1990 imp->combine_width_ca[PIXMAN_OP_CONJOINT_CLEAR] = fbCombineClearC;
1991 imp->combine_width_ca[PIXMAN_OP_CONJOINT_SRC] = fbCombineSrcC;
1993 imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER] = fbCombineConjointOverC;
1994 imp->combine_width_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = fbCombineConjointOverReverseC;
1995 imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN] = fbCombineConjointInC;
1996 imp->combine_width_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = fbCombineConjointInReverseC;
1997 imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT] = fbCombineConjointOutC;
1998 imp->combine_width_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = fbCombineConjointOutReverseC;
1999 imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP] = fbCombineConjointAtopC;
2000 imp->combine_width_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = fbCombineConjointAtopReverseC;
2001 imp->combine_width_ca[PIXMAN_OP_CONJOINT_XOR] = fbCombineConjointXorC;
2003 imp->combine_width_ca[PIXMAN_OP_MULTIPLY] = fbCombineMultiplyC;
2004 imp->combine_width_ca[PIXMAN_OP_SCREEN] = fbCombineScreenC;
2005 imp->combine_width_ca[PIXMAN_OP_OVERLAY] = fbCombineOverlayC;
2006 imp->combine_width_ca[PIXMAN_OP_DARKEN] = fbCombineDarkenC;
2007 imp->combine_width_ca[PIXMAN_OP_LIGHTEN] = fbCombineLightenC;
2008 imp->combine_width_ca[PIXMAN_OP_COLOR_DODGE] = fbCombineColorDodgeC;
2009 imp->combine_width_ca[PIXMAN_OP_COLOR_BURN] = fbCombineColorBurnC;
2010 imp->combine_width_ca[PIXMAN_OP_HARD_LIGHT] = fbCombineHardLightC;
2011 imp->combine_width_ca[PIXMAN_OP_SOFT_LIGHT] = fbCombineSoftLightC;
2012 imp->combine_width_ca[PIXMAN_OP_DIFFERENCE] = fbCombineDifferenceC;
2013 imp->combine_width_ca[PIXMAN_OP_EXCLUSION] = fbCombineExclusionC;
2014 /* It is not clear that these make sense, so leave them out for now */
2015 imp->combine_width_ca[PIXMAN_OP_HSL_HUE] = NULL;
2016 imp->combine_width_ca[PIXMAN_OP_HSL_SATURATION] = NULL;
2017 imp->combine_width_ca[PIXMAN_OP_HSL_COLOR] = NULL;
2018 imp->combine_width_ca[PIXMAN_OP_HSL_LUMINOSITY] = NULL;