summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pixman/pixman-orc.c17
-rw-r--r--pixman/pixman-orccode.orc17
-rw-r--r--test/ds.c35
3 files changed, 56 insertions, 13 deletions
diff --git a/pixman/pixman-orc.c b/pixman/pixman-orc.c
index c9ccb08..56c2042 100644
--- a/pixman/pixman-orc.c
+++ b/pixman/pixman-orc.c
@@ -112,6 +112,21 @@ orc_combine_atop_u (pixman_implementation_t *imp,
}
}
+static void
+orc_combine_xor_u (pixman_implementation_t *imp,
+ pixman_op_t op,
+ uint32_t * dst,
+ const uint32_t * src,
+ const uint32_t * mask,
+ int width)
+{
+ if (mask) {
+ orc_code_combine_xor_u (dst, src, mask, width);
+ } else {
+ orc_code_combine_xor_u_n (dst, src, width);
+ }
+}
+
pixman_bool_t
pixman_fill_orc (uint32_t *bits,
@@ -499,7 +514,7 @@ _pixman_implementation_create_orc (void)
//imp->combine_32[PIXMAN_OP_OUT_REVERSE] = orc_combine_out_reverse_u;
imp->combine_32[PIXMAN_OP_ATOP] = orc_combine_atop_u;
//imp->combine_32[PIXMAN_OP_ATOP_REVERSE] = orc_combine_atop_reverse_u;
- //imp->combine_32[PIXMAN_OP_XOR] = orc_combine_xor_u;
+ imp->combine_32[PIXMAN_OP_XOR] = orc_combine_xor_u;
imp->combine_32[PIXMAN_OP_ADD] = orc_combine_add_u;
//imp->combine_32[PIXMAN_OP_SATURATE] = orc_combine_saturate_u;
diff --git a/pixman/pixman-orccode.orc b/pixman/pixman-orccode.orc
index f101a11..2592146 100644
--- a/pixman/pixman-orccode.orc
+++ b/pixman/pixman-orccode.orc
@@ -155,3 +155,20 @@ compatop d1, d1, t1
compatop d1, d1, s1
+.function orc_code_combine_xor_u
+.dest 4 d1
+.source 4 s1
+.source 4 s2
+.temp 4 t1
+
+compin t1, s1, s2
+compxor d1, d1, t1
+
+
+.function orc_code_combine_xor_u_n
+.dest 4 d1
+.source 4 s1
+
+compxor d1, d1, s1
+
+
diff --git a/test/ds.c b/test/ds.c
index 936d130..7e41ea0 100644
--- a/test/ds.c
+++ b/test/ds.c
@@ -20,6 +20,8 @@
#define COMPOSITE_OUT(s,m) (ORC_MULDIV_255((s),(255-m)))
#define COMPOSITE_ATOP(s,da,d,sa) \
(ORC_DIVIDE_255((s)*(da))+ORC_DIVIDE_255((d)*(255-(sa))))
+#define COMPOSITE_XOR(s,da,d,sa) \
+ (ORC_DIVIDE_255((s)*(255-da))+ORC_DIVIDE_255((d)*(255-(sa))))
#define ORC_DIVIDE_255(x) ((((x)+128) + (((x)+128)>>8))>>8)
#define ORC_MULDIV_255(a,b) ORC_DIVIDE_255((a)*(b))
@@ -58,7 +60,7 @@ combine_mask (const uint32_t *src, const uint32_t *mask, int i)
}
void
-combine_atop_u (pixman_implementation_t *imp,
+combine_xor_u (pixman_implementation_t *imp,
pixman_op_t op,
uint32_t * dest,
const uint32_t * src,
@@ -71,10 +73,10 @@ combine_atop_u (pixman_implementation_t *imp,
{
uint32_t s = combine_mask (src, mask, i);
uint32_t d = *(dest + i);
- uint32_t dest_a = ALPHA_8 (d);
uint32_t src_ia = ALPHA_8 (~s);
+ uint32_t dest_ia = ALPHA_8 (~d);
- UN8x4_MUL_UN8_ADD_UN8x4_MUL_UN8 (s, dest_a, d, src_ia);
+ UN8x4_MUL_UN8_ADD_UN8x4_MUL_UN8 (s, dest_ia, d, src_ia);
*(dest + i) = s;
}
}
@@ -124,25 +126,34 @@ int main (int argc, char *argv[])
mask[i]=ORC_ARGB(255,0,0,0);
}
- //combine_atop_u (NULL, 0, dest, src, mask, 256);
- combine_atop_u (NULL, 0, dest_ref, src, NULL, 256);
- orc_code_combine_atop_u_n (dest, src, 256);
+ //combine_xor_u (NULL, 0, dest, src, mask, 256);
+ combine_xor_u (NULL, 0, dest_ref, src, NULL, 256);
+ //orc_code_combine_xor_u_n (dest, src, 256);
-#if 0
+#if 1
for(i=0;i<256;i++){
- //int a = ORC_ARGB_A(dest[i]);
dest[i] = ORC_ARGB(
- COMPOSITE_ATOP(ORC_ARGB_A(src[i]), ORC_ARGB_A(dest[i]),
+ COMPOSITE_XOR(ORC_ARGB_A(src[i]), ORC_ARGB_A(dest[i]),
ORC_ARGB_A(dest[i]), ORC_ARGB_A(src[i])),
- COMPOSITE_ATOP(ORC_ARGB_R(src[i]), ORC_ARGB_A(dest[i]),
+ COMPOSITE_XOR(ORC_ARGB_R(src[i]), ORC_ARGB_A(dest[i]),
ORC_ARGB_R(dest[i]), ORC_ARGB_A(src[i])),
- COMPOSITE_ATOP(ORC_ARGB_G(src[i]), ORC_ARGB_A(dest[i]),
+ COMPOSITE_XOR(ORC_ARGB_G(src[i]), ORC_ARGB_A(dest[i]),
ORC_ARGB_G(dest[i]), ORC_ARGB_A(src[i])),
- COMPOSITE_ATOP(ORC_ARGB_B(src[i]), ORC_ARGB_A(dest[i]),
+ COMPOSITE_XOR(ORC_ARGB_B(src[i]), ORC_ARGB_A(dest[i]),
ORC_ARGB_B(dest[i]), ORC_ARGB_A(src[i])));
}
#endif
+#if 0
+ COMPOSITE_XOR(ORC_ARGB_A(src[i]), ORC_ARGB_A(dest[i]),
+ ORC_ARGB_A(dest[i]), ORC_ARGB_A(src[i])),
+ COMPOSITE_XOR(ORC_ARGB_R(src[i]), ORC_ARGB_A(dest[i]),
+ ORC_ARGB_R(dest[i]), ORC_ARGB_A(src[i])),
+ COMPOSITE_XOR(ORC_ARGB_G(src[i]), ORC_ARGB_A(dest[i]),
+ ORC_ARGB_G(dest[i]), ORC_ARGB_A(src[i])),
+ COMPOSITE_XOR(ORC_ARGB_B(src[i]), ORC_ARGB_A(dest[i]),
+ ORC_ARGB_B(dest[i]), ORC_ARGB_A(src[i])));
+#endif
for(i=0;i<256;i++){
printf("%02x %02x %02x %02x %02x %02x %02x %02x -> "