summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2009-11-23 14:03:57 -0800
committerDavid Schleef <ds@schleef.org>2011-05-17 10:22:05 -0700
commit7407cd9402440ecec6e68afa2e8a2a41b6df58a4 (patch)
tree030fffb51aee1b942d545f97ce0f9adbc558c2b4 /test
parent835582b6dc5087feb7ea58532825bfd5704ca989 (diff)
orc: Add out operator
Diffstat (limited to 'test')
-rw-r--r--test/ds.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/test/ds.c b/test/ds.c
index fb574f0..ef315f7 100644
--- a/test/ds.c
+++ b/test/ds.c
@@ -17,6 +17,7 @@
#define COMPOSITE_OVER(d,s,m) (ORC_MULDIV_255((d),(255-m)) + (s))
#define COMPOSITE_ADD(d,s) ORC_CLAMP((d) + (s), 0, 255)
#define COMPOSITE_IN(s,m) ORC_MULDIV_255((s),(m))
+#define COMPOSITE_OUT(s,m) (ORC_MULDIV_255((s),(255-m)))
#define ORC_DIVIDE_255(x) ((((x)+128) + (((x)+128)>>8))>>8)
#define ORC_MULDIV_255(a,b) ORC_DIVIDE_255((a)*(b))
@@ -31,8 +32,6 @@
(ORC_CLAMP((r),0,255)<<16)| \
(ORC_CLAMP((a),0,255)<<24))
- //((((b)&0xff)<<0)|(((g)&0xff)<<8)|(((r)&0xff)<<16)|(((a)&0xff)<<24))
-
#define randu8() (random()&0xff)
static uint32_t
@@ -57,7 +56,7 @@ combine_mask (const uint32_t *src, const uint32_t *mask, int i)
}
void
-combine_over_u (pixman_implementation_t *imp,
+combine_out_u (pixman_implementation_t *imp,
pixman_op_t op,
uint32_t * dest,
const uint32_t * src,
@@ -69,11 +68,9 @@ combine_over_u (pixman_implementation_t *imp,
for (i = 0; i < width; ++i)
{
uint32_t s = combine_mask (src, mask, i);
- uint32_t d = *(dest + i);
- uint32_t ia = ALPHA_8 (~s);
-
- UN8x4_MUL_UN8_ADD_UN8x4 (d, ia, s);
- *(dest + i) = d;
+ uint32_t a = ALPHA_8 (~*(dest + i));
+ UN8x4_MUL_UN8 (s, a);
+ *(dest + i) = s;
}
}
@@ -122,19 +119,21 @@ int main (int argc, char *argv[])
mask[i]=ORC_ARGB(255,0,0,0);
}
- //combine_over_u (NULL, 0, dest, src, mask, 256);
- combine_over_u (NULL, 0, dest_ref, src, NULL, 256);
- //orc_code_combine_over_u_n (dest, src, 256);
+ //combine_out_u (NULL, 0, dest, src, mask, 256);
+ combine_out_u (NULL, 0, dest_ref, src, NULL, 256);
+ orc_code_combine_out_u_n (dest, src, 256);
+#if 0
for(i=0;i<256;i++){
- int a = ORC_ARGB_A(src[i]);
+ int a = ORC_ARGB_A(dest[i]);
dest[i] = ORC_ARGB(
- COMPOSITE_OVER(ORC_ARGB_A(dest[i]), ORC_ARGB_A(src[i]), a),
- COMPOSITE_OVER(ORC_ARGB_R(dest[i]), ORC_ARGB_R(src[i]), a),
- COMPOSITE_OVER(ORC_ARGB_G(dest[i]), ORC_ARGB_G(src[i]), a),
- COMPOSITE_OVER(ORC_ARGB_B(dest[i]), ORC_ARGB_B(src[i]), a));
+ COMPOSITE_OUT(ORC_ARGB_A(src[i]), a),
+ COMPOSITE_OUT(ORC_ARGB_R(src[i]), a),
+ COMPOSITE_OUT(ORC_ARGB_G(src[i]), a),
+ COMPOSITE_OUT(ORC_ARGB_B(src[i]), a));
}
+#endif
for(i=0;i<256;i++){
printf("%02x %02x %02x %02x %02x %02x %02x %02x -> "