diff options
-rw-r--r-- | pixman/pixman-orc.c | 17 | ||||
-rw-r--r-- | pixman/pixman-orccode.orc | 17 | ||||
-rw-r--r-- | test/ds.c | 31 |
3 files changed, 48 insertions, 17 deletions
diff --git a/pixman/pixman-orc.c b/pixman/pixman-orc.c index 741e102..f9dd886 100644 --- a/pixman/pixman-orc.c +++ b/pixman/pixman-orc.c @@ -82,6 +82,21 @@ orc_combine_add_u (pixman_implementation_t *imp, } } +static void +orc_combine_out_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_out_u (dst, src, mask, width); + } else { + orc_code_combine_out_u_n (dst, src, width); + } +} + pixman_bool_t pixman_fill_orc (uint32_t *bits, @@ -465,7 +480,7 @@ _pixman_implementation_create_orc (void) //imp->combine_32[PIXMAN_OP_OVER_REVERSE] = orc_combine_over_reverse_u; imp->combine_32[PIXMAN_OP_IN] = orc_combine_in_u; //imp->combine_32[PIXMAN_OP_IN_REVERSE] = orc_combine_in_reverse_u; - //imp->combine_32[PIXMAN_OP_OUT] = orc_combine_out_u; + imp->combine_32[PIXMAN_OP_OUT] = orc_combine_out_u; //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; diff --git a/pixman/pixman-orccode.orc b/pixman/pixman-orccode.orc index edb2ab7..88d7291 100644 --- a/pixman/pixman-orccode.orc +++ b/pixman/pixman-orccode.orc @@ -121,3 +121,20 @@ compin d1, t1, d1 compin d1, s1, d1 +.function orc_code_combine_out_u +.dest 4 d1 +.source 4 s1 +.source 4 s2 +.temp 4 t1 + +compin t1, s1, s2 +compout d1, d1, t1 + + +.function orc_code_combine_out_u_n +.dest 4 d1 +.source 4 s1 + +compout d1, d1, s1 + + @@ -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 -> " |