[Pixman] Pixman library on wince arm

PS block111 at mail.ru
Wed Sep 29 14:29:14 PDT 2010


> int over_n_dst_ps (int alpha, int color, int dst_color)
> {
> int q0 = 255 - alpha;
> int q1 = color * alpha + 0x80;
> return (dst_color * q0 + q1) >> 8;
> }


double over_n_dst_float (int alpha, int color, int dst_color)
{
	return (dst_color * (0xff - alpha) + color * alpha)/255.0;
}

...

try vraddhn instead of vaddhn:
int over_n_dst_ps (int alpha, int color, int dst_color)
{
   int q0 = 0xff - alpha;
   int q1 = color * alpha + 0x80;
   int u = dst_color * q0 + q1;
   return (u + (u >> 8)) >> 8;
}

does not generate any asserts and 
stddev_pixman = 0.405459
stddev_ps = 0.287262

As you can see my math isn't much different from pixman; it only doesn't suffer from that precision loss in premultiply step of the source color.





More information about the Pixman mailing list