From: Søren Sandmann Pedersen Date: Thu, 30 Apr 2009 21:14:04 +0000 (-0400) Subject: Change type of combineU to take a mask X-Git-Tag: pixman-0.15.4~33 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d6e33d33818b56982f15da1943da499db220bc1;p=platform%2Fupstream%2Fpixman.git Change type of combineU to take a mask --- diff --git a/pixman/combine.inc b/pixman/combine.inc index 0b02f27..5a72ec4 100644 --- a/pixman/combine.inc +++ b/pixman/combine.inc @@ -36,25 +36,47 @@ pixman_fbCombineMaskU (comp4_t *src, const comp4_t *mask, int width) * All of the composing functions */ +static force_inline comp4_t +combineMask (const comp4_t *src, const comp4_t *mask, int i) +{ + comp4_t s = *(src + i); + + if (mask) + { + comp4_t m = *(mask + i) >> A_SHIFT; + + FbByteMul (s, m); + } + + return s; +} + FASTCALL static void -fbCombineClear (comp4_t *dest, const comp4_t *src, int width) +fbCombineClear (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { memset(dest, 0, width*sizeof(comp4_t)); } FASTCALL static void -fbCombineSrcU (comp4_t *dest, const comp4_t *src, int width) +fbCombineSrcU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - memcpy(dest, src, width*sizeof(comp4_t)); + int i; + + for (i = 0; i < width; ++i) + { + comp4_t s = combineMask (src, mask, i); + + *(dest + i) = s; + } } /* if the Src is opaque, call fbCombineSrcU */ FASTCALL static void -fbCombineOverU (comp4_t *dest, const comp4_t *src, int width) +fbCombineOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp4_t ia = Alpha(~s); @@ -65,11 +87,11 @@ fbCombineOverU (comp4_t *dest, const comp4_t *src, int width) /* if the Dst is opaque, this is a noop */ FASTCALL static void -fbCombineOverReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineOverReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp4_t ia = Alpha(~*(dest + i)); FbByteMulAdd(s, ia, d); @@ -79,11 +101,11 @@ fbCombineOverReverseU (comp4_t *dest, const comp4_t *src, int width) /* if the Dst is opaque, call fbCombineSrcU */ FASTCALL static void -fbCombineInU (comp4_t *dest, const comp4_t *src, int width) +fbCombineInU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t a = Alpha(*(dest + i)); FbByteMul(s, a); *(dest + i) = s; @@ -92,12 +114,13 @@ fbCombineInU (comp4_t *dest, const comp4_t *src, int width) /* if the Src is opaque, this is a noop */ FASTCALL static void -fbCombineInReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineInReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t d = *(dest + i); - comp4_t a = Alpha(*(src + i)); + comp4_t s = combineMask (src, mask, i); + comp4_t d = *(dest + i); + comp4_t a = Alpha(s); FbByteMul(d, a); *(dest + i) = d; } @@ -105,11 +128,11 @@ fbCombineInReverseU (comp4_t *dest, const comp4_t *src, int width) /* if the Dst is opaque, call fbCombineClear */ FASTCALL static void -fbCombineOutU (comp4_t *dest, const comp4_t *src, int width) +fbCombineOutU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t a = Alpha(~*(dest + i)); FbByteMul(s, a); *(dest + i) = s; @@ -118,12 +141,13 @@ fbCombineOutU (comp4_t *dest, const comp4_t *src, int width) /* if the Src is opaque, call fbCombineClear */ FASTCALL static void -fbCombineOutReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineOutReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); - comp4_t a = Alpha(~*(src + i)); + comp4_t a = Alpha(~s); FbByteMul(d, a); *(dest + i) = d; } @@ -133,11 +157,11 @@ fbCombineOutReverseU (comp4_t *dest, const comp4_t *src, int width) /* if the Dst is opaque, call fbCombineOverU */ /* if both the Src and Dst are opaque, call fbCombineSrcU */ FASTCALL static void -fbCombineAtopU (comp4_t *dest, const comp4_t *src, int width) +fbCombineAtopU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp4_t dest_a = Alpha(d); comp4_t src_ia = Alpha(~s); @@ -151,11 +175,11 @@ fbCombineAtopU (comp4_t *dest, const comp4_t *src, int width) /* if the Dst is opaque, call fbCombineInReverseU */ /* if both the Src and Dst are opaque, call fbCombineDstU */ FASTCALL static void -fbCombineAtopReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineAtopReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp4_t src_a = Alpha(s); comp4_t dest_ia = Alpha(~d); @@ -169,11 +193,11 @@ fbCombineAtopReverseU (comp4_t *dest, const comp4_t *src, int width) /* if the Dst is opaque, call fbCombineOverReverseU */ /* if both the Src and Dst are opaque, call fbCombineClear */ FASTCALL static void -fbCombineXorU (comp4_t *dest, const comp4_t *src, int width) +fbCombineXorU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp4_t src_ia = Alpha(~s); comp4_t dest_ia = Alpha(~d); @@ -184,11 +208,11 @@ fbCombineXorU (comp4_t *dest, const comp4_t *src, int width) } FASTCALL static void -fbCombineAddU (comp4_t *dest, const comp4_t *src, int width) +fbCombineAddU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); FbByteAdd(d, s); *(dest + i) = d; @@ -199,11 +223,11 @@ fbCombineAddU (comp4_t *dest, const comp4_t *src, int width) /* if the Dst is opaque, call fbCombineAddU */ /* if both the Src and Dst are opaque, call fbCombineAddU */ FASTCALL static void -fbCombineSaturateU (comp4_t *dest, const comp4_t *src, int width) +fbCombineSaturateU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp2_t sa, da; @@ -311,11 +335,11 @@ fbCombineConjointInPart (comp1_t a, comp1_t b) } FASTCALL static void -fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, int width, comp1_t combine) +fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp4_t m,n,o,p; comp2_t Fa, Fb, t, u, v; @@ -361,11 +385,11 @@ fbCombineDisjointGeneralU (comp4_t *dest, const comp4_t *src, int width, comp1_t } FASTCALL static void -fbCombineDisjointOverU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp2_t a = s >> A_SHIFT; if (a != 0x00) @@ -383,53 +407,53 @@ fbCombineDisjointOverU (comp4_t *dest, const comp4_t *src, int width) } FASTCALL static void -fbCombineDisjointInU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointInU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineDisjointGeneralU (dest, src, width, CombineAIn); + fbCombineDisjointGeneralU (dest, src, mask, width, CombineAIn); } FASTCALL static void -fbCombineDisjointInReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointInReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineDisjointGeneralU (dest, src, width, CombineBIn); + fbCombineDisjointGeneralU (dest, src, mask, width, CombineBIn); } FASTCALL static void -fbCombineDisjointOutU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointOutU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineDisjointGeneralU (dest, src, width, CombineAOut); + fbCombineDisjointGeneralU (dest, src, mask, width, CombineAOut); } FASTCALL static void -fbCombineDisjointOutReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointOutReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineDisjointGeneralU (dest, src, width, CombineBOut); + fbCombineDisjointGeneralU (dest, src, mask, width, CombineBOut); } FASTCALL static void -fbCombineDisjointAtopU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointAtopU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineDisjointGeneralU (dest, src, width, CombineAAtop); + fbCombineDisjointGeneralU (dest, src, mask, width, CombineAAtop); } FASTCALL static void -fbCombineDisjointAtopReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointAtopReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineDisjointGeneralU (dest, src, width, CombineBAtop); + fbCombineDisjointGeneralU (dest, src, mask, width, CombineBAtop); } FASTCALL static void -fbCombineDisjointXorU (comp4_t *dest, const comp4_t *src, int width) +fbCombineDisjointXorU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineDisjointGeneralU (dest, src, width, CombineXor); + fbCombineDisjointGeneralU (dest, src, mask, width, CombineXor); } FASTCALL static void -fbCombineConjointGeneralU (comp4_t *dest, const comp4_t *src, int width, comp1_t combine) +fbCombineConjointGeneralU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width, comp1_t combine) { int i; for (i = 0; i < width; ++i) { - comp4_t s = *(src + i); + comp4_t s = combineMask (src, mask, i); comp4_t d = *(dest + i); comp4_t m,n,o,p; comp2_t Fa, Fb, t, u, v; @@ -475,60 +499,60 @@ fbCombineConjointGeneralU (comp4_t *dest, const comp4_t *src, int width, comp1_t } FASTCALL static void -fbCombineConjointOverU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointOverU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineAOver); + fbCombineConjointGeneralU (dest, src, mask, width, CombineAOver); } FASTCALL static void -fbCombineConjointOverReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointOverReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineBOver); + fbCombineConjointGeneralU (dest, src, mask, width, CombineBOver); } FASTCALL static void -fbCombineConjointInU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointInU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineAIn); + fbCombineConjointGeneralU (dest, src, mask, width, CombineAIn); } FASTCALL static void -fbCombineConjointInReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointInReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineBIn); + fbCombineConjointGeneralU (dest, src, mask, width, CombineBIn); } FASTCALL static void -fbCombineConjointOutU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointOutU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineAOut); + fbCombineConjointGeneralU (dest, src, mask, width, CombineAOut); } FASTCALL static void -fbCombineConjointOutReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointOutReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineBOut); + fbCombineConjointGeneralU (dest, src, mask, width, CombineBOut); } FASTCALL static void -fbCombineConjointAtopU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointAtopU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineAAtop); + fbCombineConjointGeneralU (dest, src, mask, width, CombineAAtop); } FASTCALL static void -fbCombineConjointAtopReverseU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointAtopReverseU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineBAtop); + fbCombineConjointGeneralU (dest, src, mask, width, CombineBAtop); } FASTCALL static void -fbCombineConjointXorU (comp4_t *dest, const comp4_t *src, int width) +fbCombineConjointXorU (comp4_t *dest, const comp4_t *src, const comp4_t *mask, int width) { - fbCombineConjointGeneralU (dest, src, width, CombineXor); + fbCombineConjointGeneralU (dest, src, mask, width, CombineXor); } /********************************************************************************/ diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c index 7c6dc64..5f99c3e 100644 --- a/pixman/pixman-compose.c +++ b/pixman/pixman-compose.c @@ -204,9 +204,9 @@ pixman_composite_rect_general_internal (const FbComposeData *data, if (useMask) { if (wide) - pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width); + pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, NULL, data->width); else - pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width); + pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, NULL, data->width); src_mask_buffer = mask_buffer; } @@ -241,9 +241,9 @@ pixman_composite_rect_general_internal (const FbComposeData *data, data->width, mask_buffer, 0, 0); if (wide) - pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width); + pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, NULL, data->width); else - pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width); + pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, NULL, data->width); src_mask_buffer = mask_buffer; } @@ -256,7 +256,7 @@ pixman_composite_rect_general_internal (const FbComposeData *data, data->width, dest_buffer, 0, 0); /* blend */ - compose (dest_buffer, src_mask_buffer, data->width); + compose (dest_buffer, src_mask_buffer, NULL, data->width); /* write back */ store (data->dest, data->xDest, data->yDest + i, data->width, @@ -267,7 +267,7 @@ pixman_composite_rect_general_internal (const FbComposeData *data, /* blend */ compose (bits + (data->yDest + i) * stride + data->xDest, - src_mask_buffer, data->width); + src_mask_buffer, NULL, data->width); } } } diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c index 844006c..8262cb1 100644 --- a/pixman/pixman-mmx.c +++ b/pixman/pixman-mmx.c @@ -891,6 +891,7 @@ fbComposeSetupMMX(void) /* check if we have MMX support and initialize accordingly */ if (pixman_have_mmx()) { +#if 0 pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = mmxCombineOverU; pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = mmxCombineOverReverseU; pixman_composeFunctions.combineU[PIXMAN_OP_IN] = mmxCombineInU; @@ -902,6 +903,7 @@ fbComposeSetupMMX(void) pixman_composeFunctions.combineU[PIXMAN_OP_XOR] = mmxCombineXorU; pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = mmxCombineAddU; pixman_composeFunctions.combineU[PIXMAN_OP_SATURATE] = mmxCombineSaturateU; +#endif pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = mmxCombineSrcC; pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = mmxCombineOverC; diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 7554035..d9b5579 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -153,7 +153,7 @@ typedef struct point point_t; #define FASTCALL typedef FASTCALL void (*CombineMaskU32) (uint32_t *src, const uint32_t *mask, int width); -typedef FASTCALL void (*CombineFuncU32) (uint32_t *dest, const uint32_t *src, int width); +typedef FASTCALL void (*CombineFuncU32) (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width); typedef FASTCALL void (*CombineFuncC32) (uint32_t *dest, const uint32_t *src, const uint32_t *mask, int width); typedef FASTCALL void (*fetchProc32)(bits_image_t *pict, int x, int y, int width, uint32_t *buffer); @@ -163,7 +163,7 @@ typedef FASTCALL void (*storeProc32)(pixman_image_t *, uint32_t *bits, const pixman_indexed_t *); typedef FASTCALL void (*CombineMaskU64) (uint64_t *src, const uint64_t *mask, int width); -typedef FASTCALL void (*CombineFuncU64) (uint64_t *dest, const uint64_t *src, int width); +typedef FASTCALL void (*CombineFuncU64) (uint64_t *dest, const uint64_t *src, const uint64_t *mask, int width); typedef FASTCALL void (*CombineFuncC64) (uint64_t *dest, const uint64_t *src, const uint64_t *mask, int width); typedef FASTCALL void (*fetchProc64)(bits_image_t *pict, int x, int y, int width, uint64_t *buffer); diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c index bbc2324..13509c9 100644 --- a/pixman/pixman-sse2.c +++ b/pixman/pixman-sse2.c @@ -2321,6 +2321,7 @@ fbComposeSetupSSE2(void) xMaskAlpha = createMask_2x32_64 (0x00ff0000, 0x00000000); /* SSE code patch for fbcompose.c */ +#if 0 pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = sse2CombineOverU; pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = sse2CombineOverReverseU; pixman_composeFunctions.combineU[PIXMAN_OP_IN] = sse2CombineInU; @@ -2334,6 +2335,7 @@ fbComposeSetupSSE2(void) pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = sse2CombineAddU; pixman_composeFunctions.combineU[PIXMAN_OP_SATURATE] = sse2CombineSaturateU; +#endif pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = sse2CombineSrcC; pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = sse2CombineOverC; diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c index 6d4df4e..129cab7 100644 --- a/pixman/pixman-vmx.c +++ b/pixman/pixman-vmx.c @@ -1036,6 +1036,7 @@ void fbComposeSetupVMX (void) { /* check if we have VMX support and initialize accordingly */ if (pixman_have_vmx ()) { +#if 0 pixman_composeFunctions.combineU[PIXMAN_OP_OVER] = vmxCombineOverU; pixman_composeFunctions.combineU[PIXMAN_OP_OVER_REVERSE] = vmxCombineOverReverseU; pixman_composeFunctions.combineU[PIXMAN_OP_IN] = vmxCombineInU; @@ -1046,6 +1047,7 @@ void fbComposeSetupVMX (void) pixman_composeFunctions.combineU[PIXMAN_OP_ATOP_REVERSE] = vmxCombineAtopReverseU; pixman_composeFunctions.combineU[PIXMAN_OP_XOR] = vmxCombineXorU; pixman_composeFunctions.combineU[PIXMAN_OP_ADD] = vmxCombineAddU; +#endif pixman_composeFunctions.combineC[PIXMAN_OP_SRC] = vmxCombineSrcC; pixman_composeFunctions.combineC[PIXMAN_OP_OVER] = vmxCombineOverC;