Makefile.am | 13 RELEASING | 67 +- TODO | 20 configure.ac | 61 + pixman-1-uninstalled.pc.in | 11 pixman/Makefile.am | 2 pixman/combine.h.inc | 12 pixman/pixman-access.c | 22 pixman/pixman-combine.c | 1455 -------------------------------------------- pixman/pixman-mmx.c | 38 - pixman/pixman-pict.c | 39 - pixman/pixman-private.h | 3 pixman/pixman-region.c | 129 --- pixman/pixman-region16.c | 8 pixman/pixman-sse.c | 8 pixman/pixman-transformed.c | 2 pixman/pixman.h | 5 17 files changed, 209 insertions(+), 1686 deletions(-)
New commits: commit 2a14ecf1cd07e9a3f367ea66a7b10da929ccc06d Author: Søren Sandmann Pedersen <[EMAIL PROTECTED]> Date: Thu Jul 17 13:38:57 2008 -0400 Pre-release version bump diff --git a/configure.ac b/configure.ac index ea3e46a..1cef2d7 100644 --- a/configure.ac +++ b/configure.ac @@ -54,7 +54,7 @@ AC_PREREQ([2.57]) m4_define([pixman_major], 0) m4_define([pixman_minor], 11) -m4_define([pixman_micro], 7) +m4_define([pixman_micro], 8) m4_define([pixman_version],[pixman_major.pixman_minor.pixman_micro]) commit 411c0e990f7a96d4e15f2cbbe07d3b50b6a20f95 Author: Søren Sandmann Pedersen <[EMAIL PROTECTED]> Date: Thu Jul 17 13:37:56 2008 -0400 Make a couple of functions static diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c index 1a2cc14..513e27a 100644 --- a/pixman/pixman-pict.c +++ b/pixman/pixman-pict.c @@ -52,7 +52,7 @@ typedef void (* CompositeFunc) (pixman_op_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, uint16_t, uint16_t); -inline uint32_t +static inline uint32_t fbOver (uint32_t src, uint32_t dest) { // dest = (dest * (255 - alpha)) / 255 + src @@ -62,7 +62,7 @@ fbOver (uint32_t src, uint32_t dest) return dest; } -uint32_t +static uint32_t fbOver24 (uint32_t x, uint32_t y) { uint16_t a = ~x >> 24; @@ -75,7 +75,7 @@ fbOver24 (uint32_t x, uint32_t y) return m|n|o; } -uint32_t +static uint32_t fbIn (uint32_t x, uint8_t y) { uint16_t a = y; @@ -1108,7 +1108,7 @@ pixman_image_composite_rect (pixman_op_t op, int16_t dest_y, uint16_t width, uint16_t height); -void +static void fbCompositeSolidFill (pixman_op_t op, pixman_image_t * pSrc, pixman_image_t * pMask, commit 96f57c07f24cd6d86c0aad624bd1a16b85f08e04 Author: Jeff Muizelaar <[EMAIL PROTECTED]> Date: Thu Jul 17 13:32:45 2008 -0400 Speed up fbOver Use FbByteMulAdd to operate on two components at a time and force the function to be inlined. diff --git a/pixman/pixman-pict.c b/pixman/pixman-pict.c index 817f13a..1a2cc14 100644 --- a/pixman/pixman-pict.c +++ b/pixman/pixman-pict.c @@ -34,6 +34,11 @@ #include "pixman-mmx.h" #include "pixman-vmx.h" #include "pixman-sse.h" +#include "pixman-combine32.h" + +#ifdef __GNUC__ +# define inline __inline__ __attribute__ ((__always_inline__)) +#endif #define FbFullMask(n) ((n) == 32 ? (uint32_t)-1 : ((((uint32_t) 1) << n) - 1)) @@ -47,18 +52,14 @@ typedef void (* CompositeFunc) (pixman_op_t, int16_t, int16_t, int16_t, int16_t, int16_t, int16_t, uint16_t, uint16_t); -uint32_t -fbOver (uint32_t x, uint32_t y) +inline uint32_t +fbOver (uint32_t src, uint32_t dest) { - uint16_t a = ~x >> 24; - uint16_t t; - uint32_t m,n,o,p; + // dest = (dest * (255 - alpha)) / 255 + src + uint32_t a = ~src >> 24; // 255 - alpha == 255 + (~alpha + 1) == ~alpha + FbByteMulAdd(dest, a, src); - m = FbOverU(x,y,0,a,t); - n = FbOverU(x,y,8,a,t); - o = FbOverU(x,y,16,a,t); - p = FbOverU(x,y,24,a,t); - return m|n|o|p; + return dest; } uint32_t commit d4855cd9d028c49c2a12f61c6227579fcb8af5b6 Author: Jeff Muizelaar <[EMAIL PROTECTED]> Date: Thu Jul 17 13:32:08 2008 -0400 Comment FbByteMulAdd diff --git a/pixman/combine.h.inc b/pixman/combine.h.inc index 7dd97ae..8c70cb7 100644 --- 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 { \ + /* 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; \ + \ + /* add */ \ t += y & RB_MASK; \ + \ + /* saturate */ \ 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; \ + \ + /* add */ \ x += (y >> COMPONENT_SIZE) & RB_MASK; \ + \ + /* saturate */ \ x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK); \ x &= RB_MASK; \ + \ + /* recombine */ \ x <<= COMPONENT_SIZE; \ x += t; \ } while (0) commit dcbe4b3f80fb8dc6a83efa7e66a891f8b102608d Author: Julien Cristau <[EMAIL PROTECTED]> Date: Wed Jul 16 22:03:29 2008 +0200 fix --enable-{mmx,sse2,vmx} If --enable-foo is used, don't treat it as --disable-foo, and error out if the appropriate compiler support isn't detected. diff --git a/configure.ac b/configure.ac index 82632d1..ea3e46a 100644 --- a/configure.ac +++ b/configure.ac @@ -150,9 +150,9 @@ CFLAGS=$xserver_save_CFLAGS AC_ARG_ENABLE(mmx, [AC_HELP_STRING([--disable-mmx], [disable MMX fast paths])], - [disable_mmx=yes], [disable_mmx=no]) + [enable_mmx=$enableval], [enable_mmx=auto]) -if test $disable_mmx = yes ; then +if test $enable_mmx = no ; then have_mmx_intrinsics=disabled fi @@ -163,6 +163,9 @@ else fi AC_MSG_RESULT($have_mmx_intrinsics) +if test $enable_mmx = yes && test $have_mmx_intrinsics = no ; then + AC_MSG_ERROR([MMX intrinsics not detected]) +fi AM_CONDITIONAL(USE_MMX, test $have_mmx_intrinsics = yes) @@ -236,9 +239,9 @@ CFLAGS=$xserver_save_CFLAGS AC_ARG_ENABLE(sse2, [AC_HELP_STRING([--disable-sse2], [disable SSE2 fast paths])], - [disable_sse2=yes], [disable_sse2=no]) + [enable_sse2=$enableval], [enable_sse2=auto]) -if test $disable_sse2 = yes ; then +if test $enable_sse2 = no ; then have_sse2_intrinsics=disabled fi @@ -247,6 +250,9 @@ if test $have_sse2_intrinsics = yes ; then fi AC_MSG_RESULT($have_sse2_intrinsics) +if test $enable_sse2 = yes && test $have_sse_intrinsics = no ; then + AC_MSG_ERROR([SSE2 intrinsics not detected]) +fi AM_CONDITIONAL(USE_SSE2, test $have_sse2_intrinsics = yes) @@ -280,9 +286,9 @@ CFLAGS=$xserver_save_CFLAGS AC_ARG_ENABLE(vmx, [AC_HELP_STRING([--disable-vmx], [disable VMX fast paths])], - [disable_vmx=yes], [disable_vmx=no]) + [enable_vmx=$enableval], [enable_vmx=auto]) -if test $disable_vmx = yes ; then +if test $enable_vmx = no ; then have_vmx_intrinsics=disabled fi @@ -293,6 +299,9 @@ else fi AC_MSG_RESULT($have_vmx_intrinsics) +if test $enable_vmx = yes && test $have_vmx_intrinsics = no ; then + AC_MSG_ERROR([VMX intrinsics not detected]) +fi AC_SUBST(VMX_CFLAGS) commit e21f00db50c30e80c8969fbf63982aeb7434dc1d Author: Damien Carbery <[EMAIL PROTECTED]> Date: Wed Jul 16 15:47:38 2008 -0400 Add pixman-1-uninstalled.pc file Signed-off-by: Søren Sandmann <[EMAIL PROTECTED]> diff --git a/configure.ac b/configure.ac index 39add05..82632d1 100644 --- a/configure.ac +++ b/configure.ac @@ -319,6 +319,7 @@ AC_SUBST(DEP_CFLAGS) AC_SUBST(DEP_LIBS) AC_OUTPUT([pixman-1.pc + pixman-1-uninstalled.pc Makefile pixman/Makefile pixman/pixman-version.h diff --git a/pixman-1-uninstalled.pc.in b/pixman-1-uninstalled.pc.in new file mode 100644 index 0000000..9a2afa1 --- /dev/null +++ b/pixman-1-uninstalled.pc.in @@ -0,0 +1,11 @@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ + +Name: Pixman +Description: The pixman library (version 1) +Version: @PACKAGE_VERSION@ +Cflags: -I${pc_top_builddir}/${pcfiledir}/pixman +Libs: ${pc_top_builddir}/${pcfiledir}/libpixman-1-so.a + commit 1570746350baf82d36aeb7ea1702350700b795d7 Author: Søren Sandmann <[EMAIL PROTECTED]> Date: Wed Jul 16 15:19:17 2008 -0400 Use -no-undefined -- fixes bug 15927 diff --git a/pixman/Makefile.am b/pixman/Makefile.am index 68ba6d9..4f046f1 100644 --- a/pixman/Makefile.am +++ b/pixman/Makefile.am @@ -1,5 +1,5 @@ lib_LTLIBRARIES = libpixman-1.la -libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) +libpixman_1_la_LDFLAGS = -version-info $(LT_VERSION_INFO) -no-undefined libpixman_1_la_LIBADD = @DEP_LIBS@ -lm libpixman_1_la_CFLAGS = -DPIXMAN_DISABLE_DEPRECATED libpixman_1_la_SOURCES = \ commit 99fead412e7602daf193035831b952e252dac0e1 Author: Søren Sandmann Pedersen <[EMAIL PROTECTED]> Date: Wed Jul 16 15:07:30 2008 -0400 Use <inttypes.h> on most types of Unix. Fix for bug 15560. diff --git a/pixman/pixman.h b/pixman/pixman.h index f60534b..c3b3184 100644 --- a/pixman/pixman.h +++ b/pixman/pixman.h @@ -74,10 +74,7 @@ SOFTWARE. /* * Standard integers */ -#if defined (__SVR4) && defined (__sun) -# include <sys/int_types.h> -# include <stdint.h> -#elif defined (__OpenBSD__) || defined (__sgi) +#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) # include <inttypes.h> #elif defined (_MSC_VER) typedef __int8 int8_t; commit c5bb4ab8fcb784d479c71996f2ff081374741d43 Author: Søren Sandmann <[EMAIL PROTECTED]> Date: Wed Jul 16 14:56:48 2008 -0400 Update TODO diff --git a/TODO b/TODO index c165082..c16c274 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,5 @@ - - Altivec signal issue (Company has fix, there is also a patch by - dwmw2 in rawhide). - - Rename "SSE" to "MMX_EXTENSIONS" - - Behdad's MMX issue - see list - - SSE 2 issues: - Commented-out uses of fbCompositeCopyAreasse2() @@ -36,7 +31,7 @@ (They only exist because they are theoretically available to drivers). - - Regions should become 32 bit + - 16 bit regions should be deleted - There should only be one trap rasterization API. @@ -80,11 +75,6 @@ this, I suggest just using 32-bit datatypes by setting IC_SHIFT to 5 for all machines. - - Consider whether calling regions region16 is really such a great - idea. Vlad wants 32 bit regions for Cairo. This will break X server - ABI, but should otherwise be mostly harmless, though a - pixman_region_get_boxes16() may be useful. - - Consider optimizing the 8/16 bit solid fills in pixman-util.c by storing more than one value at a time. @@ -180,8 +170,19 @@ What about color spaces such a linear vs. srGB etc.? + done: +- Consider whether calling regions region16 is really such a great + idea. Vlad wants 32 bit regions for Cairo. This will break X server + ABI, but should otherwise be mostly harmless, though a + pixman_region_get_boxes16() may be useful. + +- Altivec signal issue (Company has fix, there is also a patch by + dwmw2 in rawhide). + +- Behdad's MMX issue - see list + - SSE2 issues: - Crashes in Mozilla because of unaligned stack. Possible fixes - Make use of gcc 4.2 feature to align the stack commit 2070f10db927a97d7d38024e607093f5a6e00291 Author: Søren Sandmann <[EMAIL PROTECTED]> Date: Wed Jul 16 14:30:46 2008 -0400 Remove unused pixman-combine.c diff --git a/pixman/pixman-combine.c b/pixman/pixman-combine.c deleted file mode 100644 index f6023e6..0000000 --- a/pixman/pixman-combine.c +++ /dev/null @@ -1,1455 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> - -#include "pixman-private.h" - -/* - * Helper macros. - */ - -#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \ - FbIntMult(FbGet8(x,i),ax,(v))), \ - (uint32_t) ((uint8_t) ((t) | \ - (0 - ((t) >> 8)))) << (i)) - - -/* - The methods below use some tricks to be able to do two color - components at the same time. -*/ - -/* - x_c = (x_c * a) / 255 -*/ -#define FbByteMul(x, a) do { \ - uint32_t t = ((x & 0xff00ff) * a) + 0x800080; \ - t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ - t &= 0xff00ff; \ - \ - x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ - x = (x + ((x >> 8) & 0xff00ff)); \ - x &= 0xff00ff00; \ - x += t; \ - } while (0) - -/* - x_c = (x_c * a) / 255 + y -*/ -#define FbByteMulAdd(x, a, y) do { \ - uint32_t t = ((x & 0xff00ff) * a) + 0x800080; \ - t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ - t &= 0xff00ff; \ - t += y & 0xff00ff; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - \ - x = (((x >> 8) & 0xff00ff) * a) + 0x800080; \ - x = (x + ((x >> 8) & 0xff00ff)) >> 8; \ - x &= 0xff00ff; \ - x += (y >> 8) & 0xff00ff; \ - x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ - x &= 0xff00ff; \ - x <<= 8; \ - x += t; \ - } while (0) - -/* - x_c = (x_c * a + y_c * b) / 255 -*/ -#define FbByteAddMul(x, a, y, b) do { \ - uint32_t t; \ - uint32_t r = (x >> 24) * a + (y >> 24) * b + 0x80; \ - r += (r >> 8); \ - r >>= 8; \ - \ - t = (x & 0xff00) * a + (y & 0xff00) * b; \ - t += (t >> 8) + 0x8000; \ - t >>= 16; \ - \ - t |= r << 16; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - t <<= 8; \ - \ - r = ((x >> 16) & 0xff) * a + ((y >> 16) & 0xff) * b + 0x80; \ - r += (r >> 8); \ - r >>= 8; \ - \ - x = (x & 0xff) * a + (y & 0xff) * b + 0x80; \ - x += (x >> 8); \ - x >>= 8; \ - x |= r << 16; \ - x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ - x &= 0xff00ff; \ - x |= t; \ - } while (0) - -/* - x_c = (x_c * a + y_c *b) / 256 -*/ -#define FbByteAddMul_256(x, a, y, b) do { \ - uint32_t t = (x & 0xff00ff) * a + (y & 0xff00ff) * b; \ - t >>= 8; \ - t &= 0xff00ff; \ - \ - x = ((x >> 8) & 0xff00ff) * a + ((y >> 8) & 0xff00ff) * b; \ - x &= 0xff00ff00; \ - x += t; \ - } while (0) - -/* - x_c = (x_c * a_c) / 255 -*/ -#define FbByteMulC(x, a) do { \ - uint32_t t; \ - uint32_t r = (x & 0xff) * (a & 0xff); \ - r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ - r += 0x800080; \ - r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ - r &= 0xff00ff; \ - \ - x >>= 8; \ - t = (x & 0xff) * ((a >> 8) & 0xff); \ - t |= (x & 0xff0000) * (a >> 24); \ - t += 0x800080; \ - t = t + ((t >> 8) & 0xff00ff); \ - x = r | (t & 0xff00ff00); \ - \ - } while (0) - -/* - x_c = (x_c * a) / 255 + y -*/ -#define FbByteMulAddC(x, a, y) do { \ - uint32_t t; \ - uint32_t r = (x & 0xff) * (a & 0xff); \ - r |= (x & 0xff0000) * ((a >> 16) & 0xff); \ - r += 0x800080; \ - r = (r + ((r >> 8) & 0xff00ff)) >> 8; \ - r &= 0xff00ff; \ - r += y & 0xff00ff; \ - r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ - r &= 0xff00ff; \ - \ - x >>= 8; \ - t = (x & 0xff) * ((a >> 8) & 0xff); \ - t |= (x & 0xff0000) * (a >> 24); \ - t += 0x800080; \ - t = (t + ((t >> 8) & 0xff00ff)) >> 8; \ - t &= 0xff00ff; \ - t += (y >> 8) & 0xff00ff; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - x = r | (t << 8); \ - } while (0) - -/* - x_c = (x_c * a_c + y_c * b) / 255 -*/ -#define FbByteAddMulC(x, a, y, b) do { \ - uint32_t t; \ - uint32_t r = (x >> 24) * (a >> 24) + (y >> 24) * b; \ - r += (r >> 8) + 0x80; \ - r >>= 8; \ - \ - t = (x & 0xff00) * ((a >> 8) & 0xff) + (y & 0xff00) * b; \ - t += (t >> 8) + 0x8000; \ - t >>= 16; \ - \ - t |= r << 16; \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - t &= 0xff00ff; \ - t <<= 8; \ - \ - r = ((x >> 16) & 0xff) * ((a >> 16) & 0xff) + ((y >> 16) & 0xff) * b + 0x80; \ - r += (r >> 8); \ - r >>= 8; \ - \ - x = (x & 0xff) * (a & 0xff) + (y & 0xff) * b + 0x80; \ - x += (x >> 8); \ - x >>= 8; \ - x |= r << 16; \ - x |= 0x1000100 - ((x >> 8) & 0xff00ff); \ - x &= 0xff00ff; \ - x |= t; \ - } while (0) - -/* - x_c = min(x_c + y_c, 255) -*/ -#define FbByteAdd(x, y) do { \ - uint32_t t; \ - uint32_t r = (x & 0xff00ff) + (y & 0xff00ff); \ - r |= 0x1000100 - ((r >> 8) & 0xff00ff); \ - r &= 0xff00ff; \ - \ - t = ((x >> 8) & 0xff00ff) + ((y >> 8) & 0xff00ff); \ - t |= 0x1000100 - ((t >> 8) & 0xff00ff); \ - r |= (t & 0xff00ff) << 8; \ - x = r; \ - } while (0) - - -/* - * There are two ways of handling alpha -- either as a single unified value or - * a separate value for each component, hence each macro must have two - * versions. The unified alpha version has a 'U' at the end of the name, - * the component version has a 'C'. Similarly, functions which deal with - * this difference will have two versions using the same convention. - */ - -/* - * Combine src and mask - */ -FASTCALL static void -pixman_fbCombineMaskU (uint32_t *src, const uint32_t *mask, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t a = *(mask + i) >> 24; - uint32_t s = *(src + i); - FbByteMul(s, a); - *(src + i) = s; - } -} - -/* - * All of the composing functions - */ - -FASTCALL static void -fbCombineClear (uint32_t *dest, const uint32_t *src, int width) -{ - memset(dest, 0, width*sizeof(uint32_t)); -} - -FASTCALL static void -fbCombineSrcU (uint32_t *dest, const uint32_t *src, int width) -{ - memcpy(dest, src, width*sizeof(uint32_t)); -} - -/* if the Src is opaque, call fbCombineSrcU */ -FASTCALL static void -fbCombineOverU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t ia = Alpha(~s); - - FbByteMulAdd(d, ia, s); - *(dest + i) = d; - } -} - -/* if the Dst is opaque, this is a noop */ -FASTCALL static void -fbCombineOverReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t ia = Alpha(~*(dest + i)); - FbByteMulAdd(s, ia, d); - *(dest + i) = s; - } -} - -/* if the Dst is opaque, call fbCombineSrcU */ -FASTCALL static void -fbCombineInU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t a = Alpha(*(dest + i)); - FbByteMul(s, a); - *(dest + i) = s; - } -} - -/* if the Src is opaque, this is a noop */ -FASTCALL static void -fbCombineInReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint32_t a = Alpha(*(src + i)); - FbByteMul(d, a); - *(dest + i) = d; - } -} - -/* if the Dst is opaque, call fbCombineClear */ -FASTCALL static void -fbCombineOutU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t a = Alpha(~*(dest + i)); - FbByteMul(s, a); - *(dest + i) = s; - } -} - -/* if the Src is opaque, call fbCombineClear */ -FASTCALL static void -fbCombineOutReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t d = *(dest + i); - uint32_t a = Alpha(~*(src + i)); - FbByteMul(d, a); - *(dest + i) = d; - } -} - -/* if the Src is opaque, call fbCombineInU */ -/* if the Dst is opaque, call fbCombineOverU */ -/* if both the Src and Dst are opaque, call fbCombineSrcU */ -FASTCALL static void -fbCombineAtopU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t dest_a = Alpha(d); - uint32_t src_ia = Alpha(~s); - - FbByteAddMul(s, dest_a, d, src_ia); - *(dest + i) = s; - } -} - -/* if the Src is opaque, call fbCombineOverReverseU */ -/* if the Dst is opaque, call fbCombineInReverseU */ -/* if both the Src and Dst are opaque, call fbCombineDstU */ -FASTCALL static void -fbCombineAtopReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t src_a = Alpha(s); - uint32_t dest_ia = Alpha(~d); - - FbByteAddMul(s, dest_ia, d, src_a); - *(dest + i) = s; - } -} - -/* if the Src is opaque, call fbCombineOverU */ -/* if the Dst is opaque, call fbCombineOverReverseU */ -/* if both the Src and Dst are opaque, call fbCombineClear */ -FASTCALL static void -fbCombineXorU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t src_ia = Alpha(~s); - uint32_t dest_ia = Alpha(~d); - - FbByteAddMul(s, dest_ia, d, src_ia); - *(dest + i) = s; - } -} - -FASTCALL static void -fbCombineAddU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - FbByteAdd(d, s); - *(dest + i) = d; - } -} - -/* if the Src is opaque, call fbCombineAddU */ -/* if the Dst is opaque, call fbCombineAddU */ -/* if both the Src and Dst are opaque, call fbCombineAddU */ -FASTCALL static void -fbCombineSaturateU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint16_t sa, da; - - sa = s >> 24; - da = ~d >> 24; - if (sa > da) - { - sa = FbIntDiv(da, sa); - FbByteMul(s, sa); - }; - FbByteAdd(d, s); - *(dest + i) = d; - } -} - - -/* - * All of the disjoint composing functions - - The four entries in the first column indicate what source contributions - come from each of the four areas of the picture -- areas covered by neither - A nor B, areas covered only by A, areas covered only by B and finally - areas covered by both A and B. - - Disjoint Conjoint - Fa Fb Fa Fb - (0,0,0,0) 0 0 0 0 - (0,A,0,A) 1 0 1 0 - (0,0,B,B) 0 1 0 1 - (0,A,B,A) 1 min((1-a)/b,1) 1 max(1-a/b,0) - (0,A,B,B) min((1-b)/a,1) 1 max(1-b/a,0) 1 - (0,0,0,A) max(1-(1-b)/a,0) 0 min(1,b/a) 0 - (0,0,0,B) 0 max(1-(1-a)/b,0) 0 min(a/b,1) - (0,A,0,0) min(1,(1-b)/a) 0 max(1-b/a,0) 0 - (0,0,B,0) 0 min(1,(1-a)/b) 0 max(1-a/b,0) - (0,0,B,A) max(1-(1-b)/a,0) min(1,(1-a)/b) min(1,b/a) max(1-a/b,0) - (0,A,0,B) min(1,(1-b)/a) max(1-(1-a)/b,0) max(1-b/a,0) min(1,a/b) - (0,A,B,0) min(1,(1-b)/a) min(1,(1-a)/b) max(1-b/a,0) max(1-a/b,0) - -*/ - -#define CombineAOut 1 -#define CombineAIn 2 -#define CombineBOut 4 -#define CombineBIn 8 - -#define CombineClear 0 -#define CombineA (CombineAOut|CombineAIn) -#define CombineB (CombineBOut|CombineBIn) -#define CombineAOver (CombineAOut|CombineBOut|CombineAIn) -#define CombineBOver (CombineAOut|CombineBOut|CombineBIn) -#define CombineAAtop (CombineBOut|CombineAIn) -#define CombineBAtop (CombineAOut|CombineBIn) -#define CombineXor (CombineAOut|CombineBOut) - -/* portion covered by a but not b */ -FASTCALL static uint8_t -fbCombineDisjointOutPart (uint8_t a, uint8_t b) -{ - /* min (1, (1-b) / a) */ - - b = ~b; /* 1 - b */ - if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ - return 0xff; /* 1 */ - return FbIntDiv(b,a); /* (1-b) / a */ -} - -/* portion covered by both a and b */ -FASTCALL static uint8_t -fbCombineDisjointInPart (uint8_t a, uint8_t b) -{ - /* max (1-(1-b)/a,0) */ - /* = - min ((1-b)/a - 1, 0) */ - /* = 1 - min (1, (1-b)/a) */ - - b = ~b; /* 1 - b */ - if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ - return 0; /* 1 - 1 */ - return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ -} - -/* portion covered by a but not b */ -FASTCALL static uint8_t -fbCombineConjointOutPart (uint8_t a, uint8_t b) -{ - /* max (1-b/a,0) */ - /* = 1-min(b/a,1) */ - - /* min (1, (1-b) / a) */ - - if (b >= a) /* b >= a -> b/a >= 1 */ - return 0x00; /* 0 */ - return ~FbIntDiv(b,a); /* 1 - b/a */ -} - -/* portion covered by both a and b */ -FASTCALL static uint8_t -fbCombineConjointInPart (uint8_t a, uint8_t b) -{ - /* min (1,b/a) */ - - if (b >= a) /* b >= a -> b/a >= 1 */ - return 0xff; /* 1 */ - return FbIntDiv(b,a); /* b/a */ -} - -FASTCALL static void -fbCombineDisjointGeneralU (uint32_t *dest, const uint32_t *src, int width, uint8_t combine) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint32_t d = *(dest + i); - uint32_t m,n,o,p; - uint16_t Fa, Fb, t, u, v; - uint8_t sa = s >> 24; - uint8_t da = d >> 24; - - switch (combine & CombineA) { - default: - Fa = 0; - break; - case CombineAOut: - Fa = fbCombineDisjointOutPart (sa, da); - break; - case CombineAIn: - Fa = fbCombineDisjointInPart (sa, da); - break; - case CombineA: - Fa = 0xff; - break; - } - - switch (combine & CombineB) { - default: - Fb = 0; - break; - case CombineBOut: - Fb = fbCombineDisjointOutPart (da, sa); - break; - case CombineBIn: - Fb = fbCombineDisjointInPart (da, sa); - break; - case CombineB: - Fb = 0xff; - break; - } - m = FbGen (s,d,0,Fa,Fb,t, u, v); - n = FbGen (s,d,8,Fa,Fb,t, u, v); - o = FbGen (s,d,16,Fa,Fb,t, u, v); - p = FbGen (s,d,24,Fa,Fb,t, u, v); - s = m|n|o|p; - *(dest + i) = s; - } -} - -FASTCALL static void -fbCombineDisjointOverU (uint32_t *dest, const uint32_t *src, int width) -{ - int i; - for (i = 0; i < width; ++i) { - uint32_t s = *(src + i); - uint16_t a = s >> 24; - - if (a != 0x00) - { - if (a != 0xff) - { - uint32_t d = *(dest + i); - a = fbCombineDisjointOutPart (d >> 24, a); - FbByteMulAdd(d, a, s); - s = d; - } - *(dest + i) = s; - } - } -} - -FASTCALL static void -fbCombineDisjointInU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineAIn); -} - -FASTCALL static void -fbCombineDisjointInReverseU (uint32_t *dest, const uint32_t *src, int width) -{ - fbCombineDisjointGeneralU (dest, src, width, CombineBIn); -} - -FASTCALL static void -fbCombineDisjointOutU (uint32_t *dest, const uint32_t *src, int width) -{ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]