[Pixman] [PATCH] Faster C variant of over_n_8_8888 fast path

Soeren Sandmann sandmann at daimi.au.dk
Mon Sep 13 22:53:37 PDT 2010


Siarhei Siamashka <siarhei.siamashka at gmail.com> writes:

> +/* A variant of 'over', which works faster for non-additive blending on the
> + * platforms which do not have special instructions for saturated addition
> + */
> +static force_inline uint32_t
> +over_a (uint32_t src, uint32_t dest, pixman_bool_t additive_blending)
> +{
> +    uint32_t a = ~src >> 24;
> +    if (additive_blending)
> +    {
> +	UN8x4_MUL_UN8_ADD_UN8x4 (dest, a, src);
> +	return dest;
> +    }
> +    else
> +    {
> +	UN8x4_MUL_UN8 (dest, a);
> +	return dest + src;
> +    }
> +}

Is there any reason to not just add a boolean "additive_blending" to
the existing force_inline over() function?

It might also be interesting to add the check as a new
NOT_SUPER_LUMINESCENT flag and then simply require it for the source
for all the over_n_*() functions. That would allow similar
optimizations for the n_8_565 case and probably the n_8888_8888_ca()
case as well.

The flag could be set for all the gradients and any time an image is
opaque.


Soren


More information about the Pixman mailing list