projects
/
profile
/
ivi
/
pixman.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dcbe4b3
)
Comment FbByteMulAdd
author
Jeff Muizelaar
<jmuizelaar@mozilla.com>
Thu, 17 Jul 2008 17:32:08 +0000
(13:32 -0400)
committer
Søren Sandmann Pedersen
<sandmann@daimi.au.dk>
Thu, 17 Jul 2008 17:32:08 +0000
(13:32 -0400)
pixman/combine.h.inc
patch
|
blob
|
history
diff --git
a/pixman/combine.h.inc
b/pixman/combine.h.inc
index
7dd97ae
..
8c70cb7
100644
(file)
--- 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 { \
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; \
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; \
t += y & RB_MASK; \
+ \
+ /* saturate */ \
t |= RB_MASK_PLUS_ONE - ((t >> COMPONENT_SIZE) & RB_MASK); \
t &= RB_MASK; \
\
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; \
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; \
x += (y >> COMPONENT_SIZE) & RB_MASK; \
+ \
+ /* saturate */ \
x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK); \
x &= RB_MASK; \
x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK); \
x &= RB_MASK; \
+ \
+ /* recombine */ \
x <<= COMPONENT_SIZE; \
x += t; \
} while (0)
x <<= COMPONENT_SIZE; \
x += t; \
} while (0)