michael@0: /* WARNING: This file is generated by combine.pl from combine.inc. michael@0: Please edit one of those files rather than this one. */ michael@0: michael@0: #line 1 "pixman-combine.c.template" michael@0: #ifdef HAVE_CONFIG_H michael@0: #include michael@0: #endif michael@0: michael@0: #include michael@0: #include michael@0: michael@0: #include "pixman-private.h" michael@0: michael@0: #include "pixman-combine64.h" michael@0: michael@0: /*** per channel helper functions ***/ michael@0: michael@0: static void michael@0: combine_mask_ca (uint64_t *src, uint64_t *mask) michael@0: { michael@0: uint64_t a = *mask; michael@0: michael@0: uint64_t x; michael@0: uint32_t xa; michael@0: michael@0: if (!a) michael@0: { michael@0: *(src) = 0; michael@0: return; michael@0: } michael@0: michael@0: x = *(src); michael@0: if (a == ~0) michael@0: { michael@0: x = x >> A_SHIFT; michael@0: x |= x << G_SHIFT; michael@0: x |= x << R_SHIFT; michael@0: *(mask) = x; michael@0: return; michael@0: } michael@0: michael@0: xa = x >> A_SHIFT; michael@0: UN16x4_MUL_UN16x4 (x, a); michael@0: *(src) = x; michael@0: michael@0: UN16x4_MUL_UN16 (a, xa); michael@0: *(mask) = a; michael@0: } michael@0: michael@0: static void michael@0: combine_mask_value_ca (uint64_t *src, const uint64_t *mask) michael@0: { michael@0: uint64_t a = *mask; michael@0: uint64_t x; michael@0: michael@0: if (!a) michael@0: { michael@0: *(src) = 0; michael@0: return; michael@0: } michael@0: michael@0: if (a == ~0) michael@0: return; michael@0: michael@0: x = *(src); michael@0: UN16x4_MUL_UN16x4 (x, a); michael@0: *(src) = x; michael@0: } michael@0: michael@0: static void michael@0: combine_mask_alpha_ca (const uint64_t *src, uint64_t *mask) michael@0: { michael@0: uint64_t a = *(mask); michael@0: uint64_t x; michael@0: michael@0: if (!a) michael@0: return; michael@0: michael@0: x = *(src) >> A_SHIFT; michael@0: if (x == MASK) michael@0: return; michael@0: michael@0: if (a == ~0) michael@0: { michael@0: x |= x << G_SHIFT; michael@0: x |= x << R_SHIFT; michael@0: *(mask) = x; michael@0: return; michael@0: } michael@0: michael@0: UN16x4_MUL_UN16 (a, x); michael@0: *(mask) = a; michael@0: } michael@0: michael@0: /* michael@0: * There are two ways of handling alpha -- either as a single unified value or michael@0: * a separate value for each component, hence each macro must have two michael@0: * versions. The unified alpha version has a 'U' at the end of the name, michael@0: * the component version has a 'C'. Similarly, functions which deal with michael@0: * this difference will have two versions using the same convention. michael@0: */ michael@0: michael@0: /* michael@0: * All of the composing functions michael@0: */ michael@0: michael@0: static force_inline uint64_t michael@0: combine_mask (const uint64_t *src, const uint64_t *mask, int i) michael@0: { michael@0: uint64_t s, m; michael@0: michael@0: if (mask) michael@0: { michael@0: m = *(mask + i) >> A_SHIFT; michael@0: michael@0: if (!m) michael@0: return 0; michael@0: } michael@0: michael@0: s = *(src + i); michael@0: michael@0: if (mask) michael@0: UN16x4_MUL_UN16 (s, m); michael@0: michael@0: return s; michael@0: } michael@0: michael@0: static void michael@0: combine_clear (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: memset (dest, 0, width * sizeof(uint64_t)); michael@0: } michael@0: michael@0: static void michael@0: combine_dst (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: return; michael@0: } michael@0: michael@0: static void michael@0: combine_src_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: if (!mask) michael@0: memcpy (dest, src, width * sizeof (uint64_t)); michael@0: else michael@0: { michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: } michael@0: michael@0: /* if the Src is opaque, call combine_src_u */ michael@0: static void michael@0: combine_over_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t ia = ALPHA_16 (~s); michael@0: michael@0: UN16x4_MUL_UN16_ADD_UN16x4 (d, ia, s); michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: /* if the Dst is opaque, this is a noop */ michael@0: static void michael@0: combine_over_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t ia = ALPHA_16 (~*(dest + i)); michael@0: UN16x4_MUL_UN16_ADD_UN16x4 (s, ia, d); michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: /* if the Dst is opaque, call combine_src_u */ michael@0: static void michael@0: combine_in_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t a = ALPHA_16 (*(dest + i)); michael@0: UN16x4_MUL_UN16 (s, a); michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: /* if the Src is opaque, this is a noop */ michael@0: static void michael@0: combine_in_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t a = ALPHA_16 (s); michael@0: UN16x4_MUL_UN16 (d, a); michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: /* if the Dst is opaque, call combine_clear */ michael@0: static void michael@0: combine_out_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t a = ALPHA_16 (~*(dest + i)); michael@0: UN16x4_MUL_UN16 (s, a); michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: /* if the Src is opaque, call combine_clear */ michael@0: static void michael@0: combine_out_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t a = ALPHA_16 (~s); michael@0: UN16x4_MUL_UN16 (d, a); michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: /* if the Src is opaque, call combine_in_u */ michael@0: /* if the Dst is opaque, call combine_over_u */ michael@0: /* if both the Src and Dst are opaque, call combine_src_u */ michael@0: static void michael@0: combine_atop_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t dest_a = ALPHA_16 (d); michael@0: uint64_t src_ia = ALPHA_16 (~s); michael@0: michael@0: UN16x4_MUL_UN16_ADD_UN16x4_MUL_UN16 (s, dest_a, d, src_ia); michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: /* if the Src is opaque, call combine_over_reverse_u */ michael@0: /* if the Dst is opaque, call combine_in_reverse_u */ michael@0: /* if both the Src and Dst are opaque, call combine_dst_u */ michael@0: static void michael@0: combine_atop_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t src_a = ALPHA_16 (s); michael@0: uint64_t dest_ia = ALPHA_16 (~d); michael@0: michael@0: UN16x4_MUL_UN16_ADD_UN16x4_MUL_UN16 (s, dest_ia, d, src_a); michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: /* if the Src is opaque, call combine_over_u */ michael@0: /* if the Dst is opaque, call combine_over_reverse_u */ michael@0: /* if both the Src and Dst are opaque, call combine_clear */ michael@0: static void michael@0: combine_xor_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t src_ia = ALPHA_16 (~s); michael@0: uint64_t dest_ia = ALPHA_16 (~d); michael@0: michael@0: UN16x4_MUL_UN16_ADD_UN16x4_MUL_UN16 (s, dest_ia, d, src_ia); michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_add_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: UN16x4_ADD_UN16x4 (d, s); michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: /* if the Src is opaque, call combine_add_u */ michael@0: /* if the Dst is opaque, call combine_add_u */ michael@0: /* if both the Src and Dst are opaque, call combine_add_u */ michael@0: static void michael@0: combine_saturate_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint32_t sa, da; michael@0: michael@0: sa = s >> A_SHIFT; michael@0: da = ~d >> A_SHIFT; michael@0: if (sa > da) michael@0: { michael@0: sa = DIV_UN16 (da, sa); michael@0: UN16x4_MUL_UN16 (s, sa); michael@0: } michael@0: ; michael@0: UN16x4_ADD_UN16x4 (d, s); michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: /* michael@0: * PDF blend modes: michael@0: * The following blend modes have been taken from the PDF ISO 32000 michael@0: * specification, which at this point in time is available from michael@0: * http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf michael@0: * The relevant chapters are 11.3.5 and 11.3.6. michael@0: * The formula for computing the final pixel color given in 11.3.6 is: michael@0: * αr × Cr = (1 – αs) × αb × Cb + (1 – αb) × αs × Cs + αb × αs × B(Cb, Cs) michael@0: * with B() being the blend function. michael@0: * Note that OVER is a special case of this operation, using B(Cb, Cs) = Cs michael@0: * michael@0: * These blend modes should match the SVG filter draft specification, as michael@0: * it has been designed to mirror ISO 32000. Note that at the current point michael@0: * no released draft exists that shows this, as the formulas have not been michael@0: * updated yet after the release of ISO 32000. michael@0: * michael@0: * The default implementation here uses the PDF_SEPARABLE_BLEND_MODE and michael@0: * PDF_NON_SEPARABLE_BLEND_MODE macros, which take the blend function as an michael@0: * argument. Note that this implementation operates on premultiplied colors, michael@0: * while the PDF specification does not. Therefore the code uses the formula michael@0: * Cra = (1 – as) . Dca + (1 – ad) . Sca + B(Dca, ad, Sca, as) michael@0: */ michael@0: michael@0: /* michael@0: * Multiply michael@0: * B(Dca, ad, Sca, as) = Dca.Sca michael@0: */ michael@0: michael@0: static void michael@0: combine_multiply_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t ss = s; michael@0: uint64_t src_ia = ALPHA_16 (~s); michael@0: uint64_t dest_ia = ALPHA_16 (~d); michael@0: michael@0: UN16x4_MUL_UN16_ADD_UN16x4_MUL_UN16 (ss, dest_ia, d, src_ia); michael@0: UN16x4_MUL_UN16x4 (d, s); michael@0: UN16x4_ADD_UN16x4 (d, ss); michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_multiply_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t m = *(mask + i); michael@0: uint64_t s = *(src + i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t r = d; michael@0: uint64_t dest_ia = ALPHA_16 (~d); michael@0: michael@0: combine_mask_value_ca (&s, &m); michael@0: michael@0: UN16x4_MUL_UN16x4_ADD_UN16x4_MUL_UN16 (r, ~m, s, dest_ia); michael@0: UN16x4_MUL_UN16x4 (d, s); michael@0: UN16x4_ADD_UN16x4 (r, d); michael@0: michael@0: *(dest + i) = r; michael@0: } michael@0: } michael@0: michael@0: #define PDF_SEPARABLE_BLEND_MODE(name) \ michael@0: static void \ michael@0: combine_ ## name ## _u (pixman_implementation_t *imp, \ michael@0: pixman_op_t op, \ michael@0: uint64_t * dest, \ michael@0: const uint64_t * src, \ michael@0: const uint64_t * mask, \ michael@0: int width) \ michael@0: { \ michael@0: int i; \ michael@0: for (i = 0; i < width; ++i) { \ michael@0: uint64_t s = combine_mask (src, mask, i); \ michael@0: uint64_t d = *(dest + i); \ michael@0: uint16_t sa = ALPHA_16 (s); \ michael@0: uint16_t isa = ~sa; \ michael@0: uint16_t da = ALPHA_16 (d); \ michael@0: uint16_t ida = ~da; \ michael@0: uint64_t result; \ michael@0: \ michael@0: result = d; \ michael@0: UN16x4_MUL_UN16_ADD_UN16x4_MUL_UN16 (result, isa, s, ida); \ michael@0: \ michael@0: *(dest + i) = result + \ michael@0: (DIV_ONE_UN16 (sa * (uint64_t)da) << A_SHIFT) + \ michael@0: (blend_ ## name (RED_16 (d), da, RED_16 (s), sa) << R_SHIFT) + \ michael@0: (blend_ ## name (GREEN_16 (d), da, GREEN_16 (s), sa) << G_SHIFT) + \ michael@0: (blend_ ## name (BLUE_16 (d), da, BLUE_16 (s), sa)); \ michael@0: } \ michael@0: } \ michael@0: \ michael@0: static void \ michael@0: combine_ ## name ## _ca (pixman_implementation_t *imp, \ michael@0: pixman_op_t op, \ michael@0: uint64_t * dest, \ michael@0: const uint64_t * src, \ michael@0: const uint64_t * mask, \ michael@0: int width) \ michael@0: { \ michael@0: int i; \ michael@0: for (i = 0; i < width; ++i) { \ michael@0: uint64_t m = *(mask + i); \ michael@0: uint64_t s = *(src + i); \ michael@0: uint64_t d = *(dest + i); \ michael@0: uint16_t da = ALPHA_16 (d); \ michael@0: uint16_t ida = ~da; \ michael@0: uint64_t result; \ michael@0: \ michael@0: combine_mask_value_ca (&s, &m); \ michael@0: \ michael@0: result = d; \ michael@0: UN16x4_MUL_UN16x4_ADD_UN16x4_MUL_UN16 (result, ~m, s, ida); \ michael@0: \ michael@0: result += \ michael@0: (DIV_ONE_UN16 (ALPHA_16 (m) * (uint64_t)da) << A_SHIFT) + \ michael@0: (blend_ ## name (RED_16 (d), da, RED_16 (s), RED_16 (m)) << R_SHIFT) + \ michael@0: (blend_ ## name (GREEN_16 (d), da, GREEN_16 (s), GREEN_16 (m)) << G_SHIFT) + \ michael@0: (blend_ ## name (BLUE_16 (d), da, BLUE_16 (s), BLUE_16 (m))); \ michael@0: \ michael@0: *(dest + i) = result; \ michael@0: } \ michael@0: } michael@0: michael@0: /* michael@0: * Screen michael@0: * B(Dca, ad, Sca, as) = Dca.sa + Sca.da - Dca.Sca michael@0: */ michael@0: static inline uint64_t michael@0: blend_screen (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: return DIV_ONE_UN16 (sca * da + dca * sa - sca * dca); michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (screen) michael@0: michael@0: /* michael@0: * Overlay michael@0: * B(Dca, Da, Sca, Sa) = michael@0: * if 2.Dca < Da michael@0: * 2.Sca.Dca michael@0: * otherwise michael@0: * Sa.Da - 2.(Da - Dca).(Sa - Sca) michael@0: */ michael@0: static inline uint64_t michael@0: blend_overlay (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: uint64_t rca; michael@0: michael@0: if (2 * dca < da) michael@0: rca = 2 * sca * dca; michael@0: else michael@0: rca = sa * da - 2 * (da - dca) * (sa - sca); michael@0: return DIV_ONE_UN16 (rca); michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (overlay) michael@0: michael@0: /* michael@0: * Darken michael@0: * B(Dca, Da, Sca, Sa) = min (Sca.Da, Dca.Sa) michael@0: */ michael@0: static inline uint64_t michael@0: blend_darken (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: uint64_t s, d; michael@0: michael@0: s = sca * da; michael@0: d = dca * sa; michael@0: return DIV_ONE_UN16 (s > d ? d : s); michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (darken) michael@0: michael@0: /* michael@0: * Lighten michael@0: * B(Dca, Da, Sca, Sa) = max (Sca.Da, Dca.Sa) michael@0: */ michael@0: static inline uint64_t michael@0: blend_lighten (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: uint64_t s, d; michael@0: michael@0: s = sca * da; michael@0: d = dca * sa; michael@0: return DIV_ONE_UN16 (s > d ? s : d); michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (lighten) michael@0: michael@0: /* michael@0: * Color dodge michael@0: * B(Dca, Da, Sca, Sa) = michael@0: * if Dca == 0 michael@0: * 0 michael@0: * if Sca == Sa michael@0: * Sa.Da michael@0: * otherwise michael@0: * Sa.Da. min (1, Dca / Da / (1 - Sca/Sa)) michael@0: */ michael@0: static inline uint64_t michael@0: blend_color_dodge (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: if (sca >= sa) michael@0: { michael@0: return dca == 0 ? 0 : DIV_ONE_UN16 (sa * da); michael@0: } michael@0: else michael@0: { michael@0: uint64_t rca = dca * sa / (sa - sca); michael@0: return DIV_ONE_UN16 (sa * MIN (rca, da)); michael@0: } michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (color_dodge) michael@0: michael@0: /* michael@0: * Color burn michael@0: * B(Dca, Da, Sca, Sa) = michael@0: * if Dca == Da michael@0: * Sa.Da michael@0: * if Sca == 0 michael@0: * 0 michael@0: * otherwise michael@0: * Sa.Da.(1 - min (1, (1 - Dca/Da).Sa / Sca)) michael@0: */ michael@0: static inline uint64_t michael@0: blend_color_burn (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: if (sca == 0) michael@0: { michael@0: return dca < da ? 0 : DIV_ONE_UN16 (sa * da); michael@0: } michael@0: else michael@0: { michael@0: uint64_t rca = (da - dca) * sa / sca; michael@0: return DIV_ONE_UN16 (sa * (MAX (rca, da) - rca)); michael@0: } michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (color_burn) michael@0: michael@0: /* michael@0: * Hard light michael@0: * B(Dca, Da, Sca, Sa) = michael@0: * if 2.Sca < Sa michael@0: * 2.Sca.Dca michael@0: * otherwise michael@0: * Sa.Da - 2.(Da - Dca).(Sa - Sca) michael@0: */ michael@0: static inline uint64_t michael@0: blend_hard_light (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: if (2 * sca < sa) michael@0: return DIV_ONE_UN16 (2 * sca * dca); michael@0: else michael@0: return DIV_ONE_UN16 (sa * da - 2 * (da - dca) * (sa - sca)); michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (hard_light) michael@0: michael@0: /* michael@0: * Soft light michael@0: * B(Dca, Da, Sca, Sa) = michael@0: * if (2.Sca <= Sa) michael@0: * Dca.(Sa - (1 - Dca/Da).(2.Sca - Sa)) michael@0: * otherwise if Dca.4 <= Da michael@0: * Dca.(Sa + (2.Sca - Sa).((16.Dca/Da - 12).Dca/Da + 3) michael@0: * otherwise michael@0: * (Dca.Sa + (SQRT (Dca/Da).Da - Dca).(2.Sca - Sa)) michael@0: */ michael@0: static inline uint64_t michael@0: blend_soft_light (uint64_t dca_org, michael@0: uint64_t da_org, michael@0: uint64_t sca_org, michael@0: uint64_t sa_org) michael@0: { michael@0: double dca = dca_org * (1.0 / MASK); michael@0: double da = da_org * (1.0 / MASK); michael@0: double sca = sca_org * (1.0 / MASK); michael@0: double sa = sa_org * (1.0 / MASK); michael@0: double rca; michael@0: michael@0: if (2 * sca < sa) michael@0: { michael@0: if (da == 0) michael@0: rca = dca * sa; michael@0: else michael@0: rca = dca * sa - dca * (da - dca) * (sa - 2 * sca) / da; michael@0: } michael@0: else if (da == 0) michael@0: { michael@0: rca = 0; michael@0: } michael@0: else if (4 * dca <= da) michael@0: { michael@0: rca = dca * sa + michael@0: (2 * sca - sa) * dca * ((16 * dca / da - 12) * dca / da + 3); michael@0: } michael@0: else michael@0: { michael@0: rca = dca * sa + (sqrt (dca * da) - dca) * (2 * sca - sa); michael@0: } michael@0: return rca * MASK + 0.5; michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (soft_light) michael@0: michael@0: /* michael@0: * Difference michael@0: * B(Dca, Da, Sca, Sa) = abs (Dca.Sa - Sca.Da) michael@0: */ michael@0: static inline uint64_t michael@0: blend_difference (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: uint64_t dcasa = dca * sa; michael@0: uint64_t scada = sca * da; michael@0: michael@0: if (scada < dcasa) michael@0: return DIV_ONE_UN16 (dcasa - scada); michael@0: else michael@0: return DIV_ONE_UN16 (scada - dcasa); michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (difference) michael@0: michael@0: /* michael@0: * Exclusion michael@0: * B(Dca, Da, Sca, Sa) = (Sca.Da + Dca.Sa - 2.Sca.Dca) michael@0: */ michael@0: michael@0: /* This can be made faster by writing it directly and not using michael@0: * PDF_SEPARABLE_BLEND_MODE, but that's a performance optimization */ michael@0: michael@0: static inline uint64_t michael@0: blend_exclusion (uint64_t dca, uint64_t da, uint64_t sca, uint64_t sa) michael@0: { michael@0: return DIV_ONE_UN16 (sca * da + dca * sa - 2 * dca * sca); michael@0: } michael@0: michael@0: PDF_SEPARABLE_BLEND_MODE (exclusion) michael@0: michael@0: #undef PDF_SEPARABLE_BLEND_MODE michael@0: michael@0: /* michael@0: * PDF nonseperable blend modes are implemented using the following functions michael@0: * to operate in Hsl space, with Cmax, Cmid, Cmin referring to the max, mid michael@0: * and min value of the red, green and blue components. michael@0: * michael@0: * LUM (C) = 0.3 × Cred + 0.59 × Cgreen + 0.11 × Cblue michael@0: * michael@0: * clip_color (C): michael@0: * l = LUM (C) michael@0: * min = Cmin michael@0: * max = Cmax michael@0: * if n < 0.0 michael@0: * C = l + ( ( ( C – l ) × l ) ⁄ ( l – min ) ) michael@0: * if x > 1.0 michael@0: * C = l + ( ( ( C – l ) × ( 1 – l ) ) ⁄ ( max – l ) ) michael@0: * return C michael@0: * michael@0: * set_lum (C, l): michael@0: * d = l – LUM (C) michael@0: * C += d michael@0: * return clip_color (C) michael@0: * michael@0: * SAT (C) = CH_MAX (C) - CH_MIN (C) michael@0: * michael@0: * set_sat (C, s): michael@0: * if Cmax > Cmin michael@0: * Cmid = ( ( ( Cmid – Cmin ) × s ) ⁄ ( Cmax – Cmin ) ) michael@0: * Cmax = s michael@0: * else michael@0: * Cmid = Cmax = 0.0 michael@0: * Cmin = 0.0 michael@0: * return C michael@0: */ michael@0: michael@0: /* For premultiplied colors, we need to know what happens when C is michael@0: * multiplied by a real number. LUM and SAT are linear: michael@0: * michael@0: * LUM (r × C) = r × LUM (C) SAT (r * C) = r * SAT (C) michael@0: * michael@0: * If we extend clip_color with an extra argument a and change michael@0: * michael@0: * if x >= 1.0 michael@0: * michael@0: * into michael@0: * michael@0: * if x >= a michael@0: * michael@0: * then clip_color is also linear: michael@0: * michael@0: * r * clip_color (C, a) = clip_color (r_c, ra); michael@0: * michael@0: * for positive r. michael@0: * michael@0: * Similarly, we can extend set_lum with an extra argument that is just passed michael@0: * on to clip_color: michael@0: * michael@0: * r * set_lum ( C, l, a) michael@0: * michael@0: * = r × clip_color ( C + l - LUM (C), a) michael@0: * michael@0: * = clip_color ( r * C + r × l - r * LUM (C), r * a) michael@0: * michael@0: * = set_lum ( r * C, r * l, r * a) michael@0: * michael@0: * Finally, set_sat: michael@0: * michael@0: * r * set_sat (C, s) = set_sat (x * C, r * s) michael@0: * michael@0: * The above holds for all non-zero x, because the x'es in the fraction for michael@0: * C_mid cancel out. Specifically, it holds for x = r: michael@0: * michael@0: * r * set_sat (C, s) = set_sat (r_c, rs) michael@0: * michael@0: */ michael@0: michael@0: /* So, for the non-separable PDF blend modes, we have (using s, d for michael@0: * non-premultiplied colors, and S, D for premultiplied: michael@0: * michael@0: * Color: michael@0: * michael@0: * a_s * a_d * B(s, d) michael@0: * = a_s * a_d * set_lum (S/a_s, LUM (D/a_d), 1) michael@0: * = set_lum (S * a_d, a_s * LUM (D), a_s * a_d) michael@0: * michael@0: * michael@0: * Luminosity: michael@0: * michael@0: * a_s * a_d * B(s, d) michael@0: * = a_s * a_d * set_lum (D/a_d, LUM(S/a_s), 1) michael@0: * = set_lum (a_s * D, a_d * LUM(S), a_s * a_d) michael@0: * michael@0: * michael@0: * Saturation: michael@0: * michael@0: * a_s * a_d * B(s, d) michael@0: * = a_s * a_d * set_lum (set_sat (D/a_d, SAT (S/a_s)), LUM (D/a_d), 1) michael@0: * = set_lum (a_s * a_d * set_sat (D/a_d, SAT (S/a_s)), michael@0: * a_s * LUM (D), a_s * a_d) michael@0: * = set_lum (set_sat (a_s * D, a_d * SAT (S), a_s * LUM (D), a_s * a_d)) michael@0: * michael@0: * Hue: michael@0: * michael@0: * a_s * a_d * B(s, d) michael@0: * = a_s * a_d * set_lum (set_sat (S/a_s, SAT (D/a_d)), LUM (D/a_d), 1) michael@0: * = set_lum (set_sat (a_d * S, a_s * SAT (D)), a_s * LUM (D), a_s * a_d) michael@0: * michael@0: */ michael@0: michael@0: #define CH_MIN(c) (c[0] < c[1] ? (c[0] < c[2] ? c[0] : c[2]) : (c[1] < c[2] ? c[1] : c[2])) michael@0: #define CH_MAX(c) (c[0] > c[1] ? (c[0] > c[2] ? c[0] : c[2]) : (c[1] > c[2] ? c[1] : c[2])) michael@0: #define LUM(c) ((c[0] * 30 + c[1] * 59 + c[2] * 11) / 100) michael@0: #define SAT(c) (CH_MAX (c) - CH_MIN (c)) michael@0: michael@0: #define PDF_NON_SEPARABLE_BLEND_MODE(name) \ michael@0: static void \ michael@0: combine_ ## name ## _u (pixman_implementation_t *imp, \ michael@0: pixman_op_t op, \ michael@0: uint64_t *dest, \ michael@0: const uint64_t *src, \ michael@0: const uint64_t *mask, \ michael@0: int width) \ michael@0: { \ michael@0: int i; \ michael@0: for (i = 0; i < width; ++i) \ michael@0: { \ michael@0: uint64_t s = combine_mask (src, mask, i); \ michael@0: uint64_t d = *(dest + i); \ michael@0: uint16_t sa = ALPHA_16 (s); \ michael@0: uint16_t isa = ~sa; \ michael@0: uint16_t da = ALPHA_16 (d); \ michael@0: uint16_t ida = ~da; \ michael@0: uint64_t result; \ michael@0: uint64_t sc[3], dc[3], c[3]; \ michael@0: \ michael@0: result = d; \ michael@0: UN16x4_MUL_UN16_ADD_UN16x4_MUL_UN16 (result, isa, s, ida); \ michael@0: dc[0] = RED_16 (d); \ michael@0: sc[0] = RED_16 (s); \ michael@0: dc[1] = GREEN_16 (d); \ michael@0: sc[1] = GREEN_16 (s); \ michael@0: dc[2] = BLUE_16 (d); \ michael@0: sc[2] = BLUE_16 (s); \ michael@0: blend_ ## name (c, dc, da, sc, sa); \ michael@0: \ michael@0: *(dest + i) = result + \ michael@0: (DIV_ONE_UN16 (sa * (uint64_t)da) << A_SHIFT) + \ michael@0: (DIV_ONE_UN16 (c[0]) << R_SHIFT) + \ michael@0: (DIV_ONE_UN16 (c[1]) << G_SHIFT) + \ michael@0: (DIV_ONE_UN16 (c[2])); \ michael@0: } \ michael@0: } michael@0: michael@0: static void michael@0: set_lum (uint64_t dest[3], uint64_t src[3], uint64_t sa, uint64_t lum) michael@0: { michael@0: double a, l, min, max; michael@0: double tmp[3]; michael@0: michael@0: a = sa * (1.0 / MASK); michael@0: michael@0: l = lum * (1.0 / MASK); michael@0: tmp[0] = src[0] * (1.0 / MASK); michael@0: tmp[1] = src[1] * (1.0 / MASK); michael@0: tmp[2] = src[2] * (1.0 / MASK); michael@0: michael@0: l = l - LUM (tmp); michael@0: tmp[0] += l; michael@0: tmp[1] += l; michael@0: tmp[2] += l; michael@0: michael@0: /* clip_color */ michael@0: l = LUM (tmp); michael@0: min = CH_MIN (tmp); michael@0: max = CH_MAX (tmp); michael@0: michael@0: if (min < 0) michael@0: { michael@0: if (l - min == 0.0) michael@0: { michael@0: tmp[0] = 0; michael@0: tmp[1] = 0; michael@0: tmp[2] = 0; michael@0: } michael@0: else michael@0: { michael@0: tmp[0] = l + (tmp[0] - l) * l / (l - min); michael@0: tmp[1] = l + (tmp[1] - l) * l / (l - min); michael@0: tmp[2] = l + (tmp[2] - l) * l / (l - min); michael@0: } michael@0: } michael@0: if (max > a) michael@0: { michael@0: if (max - l == 0.0) michael@0: { michael@0: tmp[0] = a; michael@0: tmp[1] = a; michael@0: tmp[2] = a; michael@0: } michael@0: else michael@0: { michael@0: tmp[0] = l + (tmp[0] - l) * (a - l) / (max - l); michael@0: tmp[1] = l + (tmp[1] - l) * (a - l) / (max - l); michael@0: tmp[2] = l + (tmp[2] - l) * (a - l) / (max - l); michael@0: } michael@0: } michael@0: michael@0: dest[0] = tmp[0] * MASK + 0.5; michael@0: dest[1] = tmp[1] * MASK + 0.5; michael@0: dest[2] = tmp[2] * MASK + 0.5; michael@0: } michael@0: michael@0: static void michael@0: set_sat (uint64_t dest[3], uint64_t src[3], uint64_t sat) michael@0: { michael@0: int id[3]; michael@0: uint64_t min, max; michael@0: michael@0: if (src[0] > src[1]) michael@0: { michael@0: if (src[0] > src[2]) michael@0: { michael@0: id[0] = 0; michael@0: if (src[1] > src[2]) michael@0: { michael@0: id[1] = 1; michael@0: id[2] = 2; michael@0: } michael@0: else michael@0: { michael@0: id[1] = 2; michael@0: id[2] = 1; michael@0: } michael@0: } michael@0: else michael@0: { michael@0: id[0] = 2; michael@0: id[1] = 0; michael@0: id[2] = 1; michael@0: } michael@0: } michael@0: else michael@0: { michael@0: if (src[0] > src[2]) michael@0: { michael@0: id[0] = 1; michael@0: id[1] = 0; michael@0: id[2] = 2; michael@0: } michael@0: else michael@0: { michael@0: id[2] = 0; michael@0: if (src[1] > src[2]) michael@0: { michael@0: id[0] = 1; michael@0: id[1] = 2; michael@0: } michael@0: else michael@0: { michael@0: id[0] = 2; michael@0: id[1] = 1; michael@0: } michael@0: } michael@0: } michael@0: michael@0: max = dest[id[0]]; michael@0: min = dest[id[2]]; michael@0: if (max > min) michael@0: { michael@0: dest[id[1]] = (dest[id[1]] - min) * sat / (max - min); michael@0: dest[id[0]] = sat; michael@0: dest[id[2]] = 0; michael@0: } michael@0: else michael@0: { michael@0: dest[0] = dest[1] = dest[2] = 0; michael@0: } michael@0: } michael@0: michael@0: /* michael@0: * Hue: michael@0: * B(Cb, Cs) = set_lum (set_sat (Cs, SAT (Cb)), LUM (Cb)) michael@0: */ michael@0: static inline void michael@0: blend_hsl_hue (uint64_t c[3], michael@0: uint64_t dc[3], michael@0: uint64_t da, michael@0: uint64_t sc[3], michael@0: uint64_t sa) michael@0: { michael@0: c[0] = sc[0] * da; michael@0: c[1] = sc[1] * da; michael@0: c[2] = sc[2] * da; michael@0: set_sat (c, c, SAT (dc) * sa); michael@0: set_lum (c, c, sa * da, LUM (dc) * sa); michael@0: } michael@0: michael@0: PDF_NON_SEPARABLE_BLEND_MODE (hsl_hue) michael@0: michael@0: /* michael@0: * Saturation: michael@0: * B(Cb, Cs) = set_lum (set_sat (Cb, SAT (Cs)), LUM (Cb)) michael@0: */ michael@0: static inline void michael@0: blend_hsl_saturation (uint64_t c[3], michael@0: uint64_t dc[3], michael@0: uint64_t da, michael@0: uint64_t sc[3], michael@0: uint64_t sa) michael@0: { michael@0: c[0] = dc[0] * sa; michael@0: c[1] = dc[1] * sa; michael@0: c[2] = dc[2] * sa; michael@0: set_sat (c, c, SAT (sc) * da); michael@0: set_lum (c, c, sa * da, LUM (dc) * sa); michael@0: } michael@0: michael@0: PDF_NON_SEPARABLE_BLEND_MODE (hsl_saturation) michael@0: michael@0: /* michael@0: * Color: michael@0: * B(Cb, Cs) = set_lum (Cs, LUM (Cb)) michael@0: */ michael@0: static inline void michael@0: blend_hsl_color (uint64_t c[3], michael@0: uint64_t dc[3], michael@0: uint64_t da, michael@0: uint64_t sc[3], michael@0: uint64_t sa) michael@0: { michael@0: c[0] = sc[0] * da; michael@0: c[1] = sc[1] * da; michael@0: c[2] = sc[2] * da; michael@0: set_lum (c, c, sa * da, LUM (dc) * sa); michael@0: } michael@0: michael@0: PDF_NON_SEPARABLE_BLEND_MODE (hsl_color) michael@0: michael@0: /* michael@0: * Luminosity: michael@0: * B(Cb, Cs) = set_lum (Cb, LUM (Cs)) michael@0: */ michael@0: static inline void michael@0: blend_hsl_luminosity (uint64_t c[3], michael@0: uint64_t dc[3], michael@0: uint64_t da, michael@0: uint64_t sc[3], michael@0: uint64_t sa) michael@0: { michael@0: c[0] = dc[0] * sa; michael@0: c[1] = dc[1] * sa; michael@0: c[2] = dc[2] * sa; michael@0: set_lum (c, c, sa * da, LUM (sc) * da); michael@0: } michael@0: michael@0: PDF_NON_SEPARABLE_BLEND_MODE (hsl_luminosity) michael@0: michael@0: #undef SAT michael@0: #undef LUM michael@0: #undef CH_MAX michael@0: #undef CH_MIN michael@0: #undef PDF_NON_SEPARABLE_BLEND_MODE michael@0: michael@0: /* All of the disjoint/conjoint composing functions michael@0: * michael@0: * The four entries in the first column indicate what source contributions michael@0: * come from each of the four areas of the picture -- areas covered by neither michael@0: * A nor B, areas covered only by A, areas covered only by B and finally michael@0: * areas covered by both A and B. michael@0: * michael@0: * Disjoint Conjoint michael@0: * Fa Fb Fa Fb michael@0: * (0,0,0,0) 0 0 0 0 michael@0: * (0,A,0,A) 1 0 1 0 michael@0: * (0,0,B,B) 0 1 0 1 michael@0: * (0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0) michael@0: * (0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1 michael@0: * (0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0 michael@0: * (0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1) michael@0: * (0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0 michael@0: * (0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0) michael@0: * (0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0) michael@0: * (0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b) michael@0: * (0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0) michael@0: * michael@0: * See http://marc.info/?l=xfree-render&m=99792000027857&w=2 for more michael@0: * information about these operators. michael@0: */ michael@0: michael@0: #define COMBINE_A_OUT 1 michael@0: #define COMBINE_A_IN 2 michael@0: #define COMBINE_B_OUT 4 michael@0: #define COMBINE_B_IN 8 michael@0: michael@0: #define COMBINE_CLEAR 0 michael@0: #define COMBINE_A (COMBINE_A_OUT | COMBINE_A_IN) michael@0: #define COMBINE_B (COMBINE_B_OUT | COMBINE_B_IN) michael@0: #define COMBINE_A_OVER (COMBINE_A_OUT | COMBINE_B_OUT | COMBINE_A_IN) michael@0: #define COMBINE_B_OVER (COMBINE_A_OUT | COMBINE_B_OUT | COMBINE_B_IN) michael@0: #define COMBINE_A_ATOP (COMBINE_B_OUT | COMBINE_A_IN) michael@0: #define COMBINE_B_ATOP (COMBINE_A_OUT | COMBINE_B_IN) michael@0: #define COMBINE_XOR (COMBINE_A_OUT | COMBINE_B_OUT) michael@0: michael@0: /* portion covered by a but not b */ michael@0: static uint16_t michael@0: combine_disjoint_out_part (uint16_t a, uint16_t b) michael@0: { michael@0: /* min (1, (1-b) / a) */ michael@0: michael@0: b = ~b; /* 1 - b */ michael@0: if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ michael@0: return MASK; /* 1 */ michael@0: return DIV_UN16 (b, a); /* (1-b) / a */ michael@0: } michael@0: michael@0: /* portion covered by both a and b */ michael@0: static uint16_t michael@0: combine_disjoint_in_part (uint16_t a, uint16_t b) michael@0: { michael@0: /* max (1-(1-b)/a,0) */ michael@0: /* = - min ((1-b)/a - 1, 0) */ michael@0: /* = 1 - min (1, (1-b)/a) */ michael@0: michael@0: b = ~b; /* 1 - b */ michael@0: if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ michael@0: return 0; /* 1 - 1 */ michael@0: return ~DIV_UN16(b, a); /* 1 - (1-b) / a */ michael@0: } michael@0: michael@0: /* portion covered by a but not b */ michael@0: static uint16_t michael@0: combine_conjoint_out_part (uint16_t a, uint16_t b) michael@0: { michael@0: /* max (1-b/a,0) */ michael@0: /* = 1-min(b/a,1) */ michael@0: michael@0: /* min (1, (1-b) / a) */ michael@0: michael@0: if (b >= a) /* b >= a -> b/a >= 1 */ michael@0: return 0x00; /* 0 */ michael@0: return ~DIV_UN16(b, a); /* 1 - b/a */ michael@0: } michael@0: michael@0: /* portion covered by both a and b */ michael@0: static uint16_t michael@0: combine_conjoint_in_part (uint16_t a, uint16_t b) michael@0: { michael@0: /* min (1,b/a) */ michael@0: michael@0: if (b >= a) /* b >= a -> b/a >= 1 */ michael@0: return MASK; /* 1 */ michael@0: return DIV_UN16 (b, a); /* b/a */ michael@0: } michael@0: michael@0: #define GET_COMP(v, i) ((uint32_t) (uint16_t) ((v) >> i)) michael@0: michael@0: #define ADD(x, y, i, t) \ michael@0: ((t) = GET_COMP (x, i) + GET_COMP (y, i), \ michael@0: (uint64_t) ((uint16_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i)) michael@0: michael@0: #define GENERIC(x, y, i, ax, ay, t, u, v) \ michael@0: ((t) = (MUL_UN16 (GET_COMP (y, i), ay, (u)) + \ michael@0: MUL_UN16 (GET_COMP (x, i), ax, (v))), \ michael@0: (uint64_t) ((uint16_t) ((t) | \ michael@0: (0 - ((t) >> G_SHIFT)))) << (i)) michael@0: michael@0: static void michael@0: combine_disjoint_general_u (uint64_t * dest, michael@0: const uint64_t *src, michael@0: const uint64_t *mask, michael@0: int width, michael@0: uint16_t combine) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t m, n, o, p; michael@0: uint32_t Fa, Fb, t, u, v; michael@0: uint16_t sa = s >> A_SHIFT; michael@0: uint16_t da = d >> A_SHIFT; michael@0: michael@0: switch (combine & COMBINE_A) michael@0: { michael@0: default: michael@0: Fa = 0; michael@0: break; michael@0: michael@0: case COMBINE_A_OUT: michael@0: Fa = combine_disjoint_out_part (sa, da); michael@0: break; michael@0: michael@0: case COMBINE_A_IN: michael@0: Fa = combine_disjoint_in_part (sa, da); michael@0: break; michael@0: michael@0: case COMBINE_A: michael@0: Fa = MASK; michael@0: break; michael@0: } michael@0: michael@0: switch (combine & COMBINE_B) michael@0: { michael@0: default: michael@0: Fb = 0; michael@0: break; michael@0: michael@0: case COMBINE_B_OUT: michael@0: Fb = combine_disjoint_out_part (da, sa); michael@0: break; michael@0: michael@0: case COMBINE_B_IN: michael@0: Fb = combine_disjoint_in_part (da, sa); michael@0: break; michael@0: michael@0: case COMBINE_B: michael@0: Fb = MASK; michael@0: break; michael@0: } michael@0: m = GENERIC (s, d, 0, Fa, Fb, t, u, v); michael@0: n = GENERIC (s, d, G_SHIFT, Fa, Fb, t, u, v); michael@0: o = GENERIC (s, d, R_SHIFT, Fa, Fb, t, u, v); michael@0: p = GENERIC (s, d, A_SHIFT, Fa, Fb, t, u, v); michael@0: s = m | n | o | p; michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_over_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint32_t a = s >> A_SHIFT; michael@0: michael@0: if (s != 0x00) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: a = combine_disjoint_out_part (d >> A_SHIFT, a); michael@0: UN16x4_MUL_UN16_ADD_UN16x4 (d, a, s); michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_in_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_in_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_out_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_out_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_atop_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_u (dest, src, mask, width, COMBINE_A_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_atop_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_u (dest, src, mask, width, COMBINE_B_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_xor_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_u (dest, src, mask, width, COMBINE_XOR); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_general_u (uint64_t * dest, michael@0: const uint64_t *src, michael@0: const uint64_t *mask, michael@0: int width, michael@0: uint16_t combine) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = combine_mask (src, mask, i); michael@0: uint64_t d = *(dest + i); michael@0: uint64_t m, n, o, p; michael@0: uint32_t Fa, Fb, t, u, v; michael@0: uint16_t sa = s >> A_SHIFT; michael@0: uint16_t da = d >> A_SHIFT; michael@0: michael@0: switch (combine & COMBINE_A) michael@0: { michael@0: default: michael@0: Fa = 0; michael@0: break; michael@0: michael@0: case COMBINE_A_OUT: michael@0: Fa = combine_conjoint_out_part (sa, da); michael@0: break; michael@0: michael@0: case COMBINE_A_IN: michael@0: Fa = combine_conjoint_in_part (sa, da); michael@0: break; michael@0: michael@0: case COMBINE_A: michael@0: Fa = MASK; michael@0: break; michael@0: } michael@0: michael@0: switch (combine & COMBINE_B) michael@0: { michael@0: default: michael@0: Fb = 0; michael@0: break; michael@0: michael@0: case COMBINE_B_OUT: michael@0: Fb = combine_conjoint_out_part (da, sa); michael@0: break; michael@0: michael@0: case COMBINE_B_IN: michael@0: Fb = combine_conjoint_in_part (da, sa); michael@0: break; michael@0: michael@0: case COMBINE_B: michael@0: Fb = MASK; michael@0: break; michael@0: } michael@0: michael@0: m = GENERIC (s, d, 0, Fa, Fb, t, u, v); michael@0: n = GENERIC (s, d, G_SHIFT, Fa, Fb, t, u, v); michael@0: o = GENERIC (s, d, R_SHIFT, Fa, Fb, t, u, v); michael@0: p = GENERIC (s, d, A_SHIFT, Fa, Fb, t, u, v); michael@0: michael@0: s = m | n | o | p; michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_over_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_OVER); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_over_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_OVER); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_in_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_in_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_out_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_out_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_atop_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_A_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_atop_reverse_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_B_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_xor_u (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_u (dest, src, mask, width, COMBINE_XOR); michael@0: } michael@0: michael@0: /************************************************************************/ michael@0: /*********************** Per Channel functions **************************/ michael@0: /************************************************************************/ michael@0: michael@0: static void michael@0: combine_clear_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: memset (dest, 0, width * sizeof(uint64_t)); michael@0: } michael@0: michael@0: static void michael@0: combine_src_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: michael@0: combine_mask_value_ca (&s, &m); michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_over_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: uint64_t a; michael@0: michael@0: combine_mask_ca (&s, &m); michael@0: michael@0: a = ~m; michael@0: if (a) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: UN16x4_MUL_UN16x4_ADD_UN16x4 (d, a, s); michael@0: s = d; michael@0: } michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_over_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: uint64_t a = ~d >> A_SHIFT; michael@0: michael@0: if (a) michael@0: { michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: michael@0: UN16x4_MUL_UN16x4 (s, m); michael@0: UN16x4_MUL_UN16_ADD_UN16x4 (s, a, d); michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_in_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: uint32_t a = d >> A_SHIFT; michael@0: uint64_t s = 0; michael@0: michael@0: if (a) michael@0: { michael@0: uint64_t m = *(mask + i); michael@0: michael@0: s = *(src + i); michael@0: combine_mask_value_ca (&s, &m); michael@0: michael@0: if (a != MASK) michael@0: UN16x4_MUL_UN16 (s, a); michael@0: } michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_in_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: uint64_t a; michael@0: michael@0: combine_mask_alpha_ca (&s, &m); michael@0: michael@0: a = m; michael@0: if (a != ~0) michael@0: { michael@0: uint64_t d = 0; michael@0: michael@0: if (a) michael@0: { michael@0: d = *(dest + i); michael@0: UN16x4_MUL_UN16x4 (d, a); michael@0: } michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_out_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: uint32_t a = ~d >> A_SHIFT; michael@0: uint64_t s = 0; michael@0: michael@0: if (a) michael@0: { michael@0: uint64_t m = *(mask + i); michael@0: michael@0: s = *(src + i); michael@0: combine_mask_value_ca (&s, &m); michael@0: michael@0: if (a != MASK) michael@0: UN16x4_MUL_UN16 (s, a); michael@0: } michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_out_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: uint64_t a; michael@0: michael@0: combine_mask_alpha_ca (&s, &m); michael@0: michael@0: a = ~m; michael@0: if (a != ~0) michael@0: { michael@0: uint64_t d = 0; michael@0: michael@0: if (a) michael@0: { michael@0: d = *(dest + i); michael@0: UN16x4_MUL_UN16x4 (d, a); michael@0: } michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_atop_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: uint64_t ad; michael@0: uint32_t as = d >> A_SHIFT; michael@0: michael@0: combine_mask_ca (&s, &m); michael@0: michael@0: ad = ~m; michael@0: michael@0: UN16x4_MUL_UN16x4_ADD_UN16x4_MUL_UN16 (d, ad, s, as); michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_atop_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: uint64_t ad; michael@0: uint32_t as = ~d >> A_SHIFT; michael@0: michael@0: combine_mask_ca (&s, &m); michael@0: michael@0: ad = m; michael@0: michael@0: UN16x4_MUL_UN16x4_ADD_UN16x4_MUL_UN16 (d, ad, s, as); michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_xor_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t d = *(dest + i); michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: uint64_t ad; michael@0: uint32_t as = ~d >> A_SHIFT; michael@0: michael@0: combine_mask_ca (&s, &m); michael@0: michael@0: ad = ~m; michael@0: michael@0: UN16x4_MUL_UN16x4_ADD_UN16x4_MUL_UN16 (d, ad, s, as); michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_add_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s = *(src + i); michael@0: uint64_t m = *(mask + i); michael@0: uint64_t d = *(dest + i); michael@0: michael@0: combine_mask_value_ca (&s, &m); michael@0: michael@0: UN16x4_ADD_UN16x4 (d, s); michael@0: michael@0: *(dest + i) = d; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_saturate_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s, d; michael@0: uint32_t sa, sr, sg, sb, da; michael@0: uint32_t t, u, v; michael@0: uint64_t m, n, o, p; michael@0: michael@0: d = *(dest + i); michael@0: s = *(src + i); michael@0: m = *(mask + i); michael@0: michael@0: combine_mask_ca (&s, &m); michael@0: michael@0: sa = (m >> A_SHIFT); michael@0: sr = (m >> R_SHIFT) & MASK; michael@0: sg = (m >> G_SHIFT) & MASK; michael@0: sb = m & MASK; michael@0: da = ~d >> A_SHIFT; michael@0: michael@0: if (sb <= da) michael@0: m = ADD (s, d, 0, t); michael@0: else michael@0: m = GENERIC (s, d, 0, (da << G_SHIFT) / sb, MASK, t, u, v); michael@0: michael@0: if (sg <= da) michael@0: n = ADD (s, d, G_SHIFT, t); michael@0: else michael@0: n = GENERIC (s, d, G_SHIFT, (da << G_SHIFT) / sg, MASK, t, u, v); michael@0: michael@0: if (sr <= da) michael@0: o = ADD (s, d, R_SHIFT, t); michael@0: else michael@0: o = GENERIC (s, d, R_SHIFT, (da << G_SHIFT) / sr, MASK, t, u, v); michael@0: michael@0: if (sa <= da) michael@0: p = ADD (s, d, A_SHIFT, t); michael@0: else michael@0: p = GENERIC (s, d, A_SHIFT, (da << G_SHIFT) / sa, MASK, t, u, v); michael@0: michael@0: *(dest + i) = m | n | o | p; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_general_ca (uint64_t * dest, michael@0: const uint64_t *src, michael@0: const uint64_t *mask, michael@0: int width, michael@0: uint16_t combine) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s, d; michael@0: uint64_t m, n, o, p; michael@0: uint64_t Fa, Fb; michael@0: uint32_t t, u, v; michael@0: uint64_t sa; michael@0: uint16_t da; michael@0: michael@0: s = *(src + i); michael@0: m = *(mask + i); michael@0: d = *(dest + i); michael@0: da = d >> A_SHIFT; michael@0: michael@0: combine_mask_ca (&s, &m); michael@0: michael@0: sa = m; michael@0: michael@0: switch (combine & COMBINE_A) michael@0: { michael@0: default: michael@0: Fa = 0; michael@0: break; michael@0: michael@0: case COMBINE_A_OUT: michael@0: m = (uint64_t)combine_disjoint_out_part ((uint16_t) (sa >> 0), da); michael@0: n = (uint64_t)combine_disjoint_out_part ((uint16_t) (sa >> G_SHIFT), da) << G_SHIFT; michael@0: o = (uint64_t)combine_disjoint_out_part ((uint16_t) (sa >> R_SHIFT), da) << R_SHIFT; michael@0: p = (uint64_t)combine_disjoint_out_part ((uint16_t) (sa >> A_SHIFT), da) << A_SHIFT; michael@0: Fa = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_A_IN: michael@0: m = (uint64_t)combine_disjoint_in_part ((uint16_t) (sa >> 0), da); michael@0: n = (uint64_t)combine_disjoint_in_part ((uint16_t) (sa >> G_SHIFT), da) << G_SHIFT; michael@0: o = (uint64_t)combine_disjoint_in_part ((uint16_t) (sa >> R_SHIFT), da) << R_SHIFT; michael@0: p = (uint64_t)combine_disjoint_in_part ((uint16_t) (sa >> A_SHIFT), da) << A_SHIFT; michael@0: Fa = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_A: michael@0: Fa = ~0; michael@0: break; michael@0: } michael@0: michael@0: switch (combine & COMBINE_B) michael@0: { michael@0: default: michael@0: Fb = 0; michael@0: break; michael@0: michael@0: case COMBINE_B_OUT: michael@0: m = (uint64_t)combine_disjoint_out_part (da, (uint16_t) (sa >> 0)); michael@0: n = (uint64_t)combine_disjoint_out_part (da, (uint16_t) (sa >> G_SHIFT)) << G_SHIFT; michael@0: o = (uint64_t)combine_disjoint_out_part (da, (uint16_t) (sa >> R_SHIFT)) << R_SHIFT; michael@0: p = (uint64_t)combine_disjoint_out_part (da, (uint16_t) (sa >> A_SHIFT)) << A_SHIFT; michael@0: Fb = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_B_IN: michael@0: m = (uint64_t)combine_disjoint_in_part (da, (uint16_t) (sa >> 0)); michael@0: n = (uint64_t)combine_disjoint_in_part (da, (uint16_t) (sa >> G_SHIFT)) << G_SHIFT; michael@0: o = (uint64_t)combine_disjoint_in_part (da, (uint16_t) (sa >> R_SHIFT)) << R_SHIFT; michael@0: p = (uint64_t)combine_disjoint_in_part (da, (uint16_t) (sa >> A_SHIFT)) << A_SHIFT; michael@0: Fb = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_B: michael@0: Fb = ~0; michael@0: break; michael@0: } michael@0: m = GENERIC (s, d, 0, GET_COMP (Fa, 0), GET_COMP (Fb, 0), t, u, v); michael@0: n = GENERIC (s, d, G_SHIFT, GET_COMP (Fa, G_SHIFT), GET_COMP (Fb, G_SHIFT), t, u, v); michael@0: o = GENERIC (s, d, R_SHIFT, GET_COMP (Fa, R_SHIFT), GET_COMP (Fb, R_SHIFT), t, u, v); michael@0: p = GENERIC (s, d, A_SHIFT, GET_COMP (Fa, A_SHIFT), GET_COMP (Fb, A_SHIFT), t, u, v); michael@0: michael@0: s = m | n | o | p; michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_over_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_OVER); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_in_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_in_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_out_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_out_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_atop_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_A_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_atop_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_B_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_disjoint_xor_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_disjoint_general_ca (dest, src, mask, width, COMBINE_XOR); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_general_ca (uint64_t * dest, michael@0: const uint64_t *src, michael@0: const uint64_t *mask, michael@0: int width, michael@0: uint16_t combine) michael@0: { michael@0: int i; michael@0: michael@0: for (i = 0; i < width; ++i) michael@0: { michael@0: uint64_t s, d; michael@0: uint64_t m, n, o, p; michael@0: uint64_t Fa, Fb; michael@0: uint32_t t, u, v; michael@0: uint64_t sa; michael@0: uint16_t da; michael@0: michael@0: s = *(src + i); michael@0: m = *(mask + i); michael@0: d = *(dest + i); michael@0: da = d >> A_SHIFT; michael@0: michael@0: combine_mask_ca (&s, &m); michael@0: michael@0: sa = m; michael@0: michael@0: switch (combine & COMBINE_A) michael@0: { michael@0: default: michael@0: Fa = 0; michael@0: break; michael@0: michael@0: case COMBINE_A_OUT: michael@0: m = (uint64_t)combine_conjoint_out_part ((uint16_t) (sa >> 0), da); michael@0: n = (uint64_t)combine_conjoint_out_part ((uint16_t) (sa >> G_SHIFT), da) << G_SHIFT; michael@0: o = (uint64_t)combine_conjoint_out_part ((uint16_t) (sa >> R_SHIFT), da) << R_SHIFT; michael@0: p = (uint64_t)combine_conjoint_out_part ((uint16_t) (sa >> A_SHIFT), da) << A_SHIFT; michael@0: Fa = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_A_IN: michael@0: m = (uint64_t)combine_conjoint_in_part ((uint16_t) (sa >> 0), da); michael@0: n = (uint64_t)combine_conjoint_in_part ((uint16_t) (sa >> G_SHIFT), da) << G_SHIFT; michael@0: o = (uint64_t)combine_conjoint_in_part ((uint16_t) (sa >> R_SHIFT), da) << R_SHIFT; michael@0: p = (uint64_t)combine_conjoint_in_part ((uint16_t) (sa >> A_SHIFT), da) << A_SHIFT; michael@0: Fa = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_A: michael@0: Fa = ~0; michael@0: break; michael@0: } michael@0: michael@0: switch (combine & COMBINE_B) michael@0: { michael@0: default: michael@0: Fb = 0; michael@0: break; michael@0: michael@0: case COMBINE_B_OUT: michael@0: m = (uint64_t)combine_conjoint_out_part (da, (uint16_t) (sa >> 0)); michael@0: n = (uint64_t)combine_conjoint_out_part (da, (uint16_t) (sa >> G_SHIFT)) << G_SHIFT; michael@0: o = (uint64_t)combine_conjoint_out_part (da, (uint16_t) (sa >> R_SHIFT)) << R_SHIFT; michael@0: p = (uint64_t)combine_conjoint_out_part (da, (uint16_t) (sa >> A_SHIFT)) << A_SHIFT; michael@0: Fb = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_B_IN: michael@0: m = (uint64_t)combine_conjoint_in_part (da, (uint16_t) (sa >> 0)); michael@0: n = (uint64_t)combine_conjoint_in_part (da, (uint16_t) (sa >> G_SHIFT)) << G_SHIFT; michael@0: o = (uint64_t)combine_conjoint_in_part (da, (uint16_t) (sa >> R_SHIFT)) << R_SHIFT; michael@0: p = (uint64_t)combine_conjoint_in_part (da, (uint16_t) (sa >> A_SHIFT)) << A_SHIFT; michael@0: Fb = m | n | o | p; michael@0: break; michael@0: michael@0: case COMBINE_B: michael@0: Fb = ~0; michael@0: break; michael@0: } michael@0: m = GENERIC (s, d, 0, GET_COMP (Fa, 0), GET_COMP (Fb, 0), t, u, v); michael@0: n = GENERIC (s, d, G_SHIFT, GET_COMP (Fa, G_SHIFT), GET_COMP (Fb, G_SHIFT), t, u, v); michael@0: o = GENERIC (s, d, R_SHIFT, GET_COMP (Fa, R_SHIFT), GET_COMP (Fb, R_SHIFT), t, u, v); michael@0: p = GENERIC (s, d, A_SHIFT, GET_COMP (Fa, A_SHIFT), GET_COMP (Fb, A_SHIFT), t, u, v); michael@0: michael@0: s = m | n | o | p; michael@0: michael@0: *(dest + i) = s; michael@0: } michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_over_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_OVER); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_over_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_OVER); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_in_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_in_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_IN); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_out_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_out_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_OUT); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_atop_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_A_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_atop_reverse_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_B_ATOP); michael@0: } michael@0: michael@0: static void michael@0: combine_conjoint_xor_ca (pixman_implementation_t *imp, michael@0: pixman_op_t op, michael@0: uint64_t * dest, michael@0: const uint64_t * src, michael@0: const uint64_t * mask, michael@0: int width) michael@0: { michael@0: combine_conjoint_general_ca (dest, src, mask, width, COMBINE_XOR); michael@0: } michael@0: michael@0: void michael@0: _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp) michael@0: { michael@0: /* Unified alpha */ michael@0: imp->combine_64[PIXMAN_OP_CLEAR] = combine_clear; michael@0: imp->combine_64[PIXMAN_OP_SRC] = combine_src_u; michael@0: imp->combine_64[PIXMAN_OP_DST] = combine_dst; michael@0: imp->combine_64[PIXMAN_OP_OVER] = combine_over_u; michael@0: imp->combine_64[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_IN] = combine_in_u; michael@0: imp->combine_64[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_OUT] = combine_out_u; michael@0: imp->combine_64[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_ATOP] = combine_atop_u; michael@0: imp->combine_64[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_XOR] = combine_xor_u; michael@0: imp->combine_64[PIXMAN_OP_ADD] = combine_add_u; michael@0: imp->combine_64[PIXMAN_OP_SATURATE] = combine_saturate_u; michael@0: michael@0: /* Disjoint, unified */ michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_CLEAR] = combine_clear; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_SRC] = combine_src_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_DST] = combine_dst; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_saturate_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_u; michael@0: michael@0: /* Conjoint, unified */ michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_CLEAR] = combine_clear; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_SRC] = combine_src_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_DST] = combine_dst; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_u; michael@0: imp->combine_64[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_u; michael@0: michael@0: imp->combine_64[PIXMAN_OP_MULTIPLY] = combine_multiply_u; michael@0: imp->combine_64[PIXMAN_OP_SCREEN] = combine_screen_u; michael@0: imp->combine_64[PIXMAN_OP_OVERLAY] = combine_overlay_u; michael@0: imp->combine_64[PIXMAN_OP_DARKEN] = combine_darken_u; michael@0: imp->combine_64[PIXMAN_OP_LIGHTEN] = combine_lighten_u; michael@0: imp->combine_64[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_u; michael@0: imp->combine_64[PIXMAN_OP_COLOR_BURN] = combine_color_burn_u; michael@0: imp->combine_64[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_u; michael@0: imp->combine_64[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_u; michael@0: imp->combine_64[PIXMAN_OP_DIFFERENCE] = combine_difference_u; michael@0: imp->combine_64[PIXMAN_OP_EXCLUSION] = combine_exclusion_u; michael@0: imp->combine_64[PIXMAN_OP_HSL_HUE] = combine_hsl_hue_u; michael@0: imp->combine_64[PIXMAN_OP_HSL_SATURATION] = combine_hsl_saturation_u; michael@0: imp->combine_64[PIXMAN_OP_HSL_COLOR] = combine_hsl_color_u; michael@0: imp->combine_64[PIXMAN_OP_HSL_LUMINOSITY] = combine_hsl_luminosity_u; michael@0: michael@0: /* Component alpha combiners */ michael@0: imp->combine_64_ca[PIXMAN_OP_CLEAR] = combine_clear_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_SRC] = combine_src_ca; michael@0: /* dest */ michael@0: imp->combine_64_ca[PIXMAN_OP_OVER] = combine_over_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_OVER_REVERSE] = combine_over_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_IN] = combine_in_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_IN_REVERSE] = combine_in_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_OUT] = combine_out_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_OUT_REVERSE] = combine_out_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_ATOP] = combine_atop_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_ATOP_REVERSE] = combine_atop_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_XOR] = combine_xor_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_ADD] = combine_add_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_SATURATE] = combine_saturate_ca; michael@0: michael@0: /* Disjoint CA */ michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_CLEAR] = combine_clear_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_SRC] = combine_src_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_DST] = combine_dst; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_OVER] = combine_disjoint_over_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_OVER_REVERSE] = combine_saturate_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_IN] = combine_disjoint_in_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_IN_REVERSE] = combine_disjoint_in_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_OUT] = combine_disjoint_out_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_OUT_REVERSE] = combine_disjoint_out_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_ATOP] = combine_disjoint_atop_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_ATOP_REVERSE] = combine_disjoint_atop_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DISJOINT_XOR] = combine_disjoint_xor_ca; michael@0: michael@0: /* Conjoint CA */ michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_CLEAR] = combine_clear_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_SRC] = combine_src_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_DST] = combine_dst; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_OVER] = combine_conjoint_over_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_OVER_REVERSE] = combine_conjoint_over_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_IN] = combine_conjoint_in_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_IN_REVERSE] = combine_conjoint_in_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_OUT] = combine_conjoint_out_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_OUT_REVERSE] = combine_conjoint_out_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_ATOP] = combine_conjoint_atop_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_ATOP_REVERSE] = combine_conjoint_atop_reverse_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_CONJOINT_XOR] = combine_conjoint_xor_ca; michael@0: michael@0: imp->combine_64_ca[PIXMAN_OP_MULTIPLY] = combine_multiply_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_SCREEN] = combine_screen_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_OVERLAY] = combine_overlay_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DARKEN] = combine_darken_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_LIGHTEN] = combine_lighten_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_COLOR_DODGE] = combine_color_dodge_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_COLOR_BURN] = combine_color_burn_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_HARD_LIGHT] = combine_hard_light_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_SOFT_LIGHT] = combine_soft_light_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_DIFFERENCE] = combine_difference_ca; michael@0: imp->combine_64_ca[PIXMAN_OP_EXCLUSION] = combine_exclusion_ca; michael@0: michael@0: /* It is not clear that these make sense, so make them noops for now */ michael@0: imp->combine_64_ca[PIXMAN_OP_HSL_HUE] = combine_dst; michael@0: imp->combine_64_ca[PIXMAN_OP_HSL_SATURATION] = combine_dst; michael@0: imp->combine_64_ca[PIXMAN_OP_HSL_COLOR] = combine_dst; michael@0: imp->combine_64_ca[PIXMAN_OP_HSL_LUMINOSITY] = combine_dst; michael@0: } michael@0: