From: Jeff Muizelaar Date: Thu, 17 Jul 2008 17:32:08 +0000 (-0400) Subject: Comment FbByteMulAdd X-Git-Tag: 1.0_branch~1288 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4855cd9d028c49c2a12f61c6227579fcb8af5b6;p=profile%2Fivi%2Fpixman.git Comment FbByteMulAdd --- diff --git a/pixman/combine.h.inc b/pixman/combine.h.inc index 7dd97ae..8c70cb7 100644 --- a/pixman/combine.h.inc +++ b/pixman/combine.h.inc @@ -57,19 +57,31 @@ x_c = (x_c * a) / 255 + y */ #define FbByteMulAdd(x, a, y) do { \ + /* multiply and divide: trunc((i + 128)*257/65536) */ \ comp4_t t = ((x & RB_MASK) * a) + RB_ONE_HALF; \ t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \ t &= RB_MASK; \ + \ + /* add */ \ t += y & RB_MASK; \ + \ + /* saturate */ \ t |= RB_MASK_PLUS_ONE - ((t >> COMPONENT_SIZE) & RB_MASK); \ t &= RB_MASK; \ \ + /* multiply and divide */ \ x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF; \ x = (x + ((x >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \ x &= RB_MASK; \ + \ + /* add */ \ x += (y >> COMPONENT_SIZE) & RB_MASK; \ + \ + /* saturate */ \ x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK); \ x &= RB_MASK; \ + \ + /* recombine */ \ x <<= COMPONENT_SIZE; \ x += t; \ } while (0)