--- cairo-1.3.6/configure.in-orig 2007-02-14 16:14:49.502261000 +0800 +++ cairo-1.3.6/configure.in 2007-02-14 16:16:47.137239000 +0800 @@ -694,6 +694,18 @@ AC_SUBST(MMX_CFLAGS) AM_CONDITIONAL(USE_MMX, test $have_mmx_intrinsics = yes) dnl =========================================================================== +dnl Check for mediaLib + +AC_MSG_CHECKING(for mediaLib 2.3) +# Check for a mediaLib 2.3 function since that is what the cairo mediaLib +# patch requires. +AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no) +if test $use_mlib = yes; then + AC_DEFINE(USE_MEDIALIB, 1, [use mediaLib]) +fi +AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes) + +dnl =========================================================================== AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov], --- cairo-1.3.6/pixman/src/Makefile.am-orig 2007-02-14 16:17:05.989498000 +0800 +++ cairo-1.3.6/pixman/src/Makefile.am 2007-02-14 16:11:21.754172000 +0800 @@ -40,4 +40,8 @@ libpixman_mmx_la_CFLAGS = @MMX_CFLAGS@ $ libpixman_la_LIBADD = libpixman-mmx.la endif +if USE_MEDIALIB +libpixman_la_LIBADD = -lmlib +endif + INCLUDES = -I$(top_srcdir) -I$(srcdir) @WARN_CFLAGS@ --- cairo-1.4.0/pixman/src/fbcompose.c-orig 2007-02-28 16:31:13.777947000 +0800 +++ cairo-1.4.0/pixman/src/fbcompose.c 2007-03-02 16:24:15.477602000 +0800 @@ -40,6 +40,10 @@ #include #include +#ifdef USE_MEDIALIB +#include +#endif + #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -386,7 +390,15 @@ fbFetch_a8 (const FbBits *bits, int x, i { const CARD8 *pixel = (const CARD8 *)bits + x; const CARD8 *end = pixel + width; - while (pixel < end) { + +#ifdef __SUNPRO_C + int i; + +#pragma pipeloop(0) + for (i = 0; i < width; ++i) { +#else + while (pixel < end) { +#endif *buffer++ = (*pixel++) << 24; } } @@ -1291,11 +1303,25 @@ fbStore_x4b4g4r4 (FbBits *bits, const CA static FASTCALL void fbStore_a8 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { - int i; CARD8 *pixel = ((CARD8 *) bits) + x; + +#ifdef USE_MEDIALIB + mlib_image img_src, img_dst; + + mlib_ImageSetStruct(&img_dst, MLIB_BYTE, 1, width, 1, width, pixel); + mlib_ImageSetStruct(&img_src, MLIB_BYTE, 4, width, 1, (4 * width), values); + +#ifdef _BIG_ENDIAN + mlib_ImageChannelExtract (&img_dst, &img_src, 0x08); +#else + mlib_ImageChannelExtract (&img_dst, &img_src, 0x01); +#endif +#else + int i; for (i = 0; i < width; ++i) { *pixel++ = values[i] >> 24; } +#endif } static FASTCALL void @@ -1522,6 +1548,18 @@ static storeProc storeProcForPicture (Pi static FASTCALL void fbCombineMaskU (CARD32 *src, const CARD32 *mask, int width) { +#ifdef USE_MEDIALIB + mlib_image img_src, img_dst; + + mlib_ImageSetStruct(&img_dst, MLIB_BYTE, 4, width, 1, (4 * width), src); + mlib_ImageSetStruct(&img_src, MLIB_BYTE, 4, width, 1, (4 * width), mask); + +#ifdef _BIG_ENDIAN + mlib_ImageBlend_SA_ZERO_Inp (&img_dst, &img_src, 0x08); +#else + mlib_ImageBlend_SA_ZERO_Inp (&img_dst, &img_src, 0x01); +#endif +#else int i; for (i = 0; i < width; ++i) { CARD32 a = mask[i] >> 24; @@ -1529,6 +1567,7 @@ fbCombineMaskU (CARD32 *src, const CARD3 FbByteMul(s, a); src[i] = s; } +#endif } /* @@ -1550,6 +1589,18 @@ fbCombineSrcU (CARD32 *dest, const CARD3 static FASTCALL void fbCombineOverU (CARD32 *dest, const CARD32 *src, int width) { +#ifdef USE_MEDIALIB + mlib_image img_src, img_dst; + + mlib_ImageSetStruct (&img_dst, MLIB_BYTE, 4, width, 1, (4 * width), dest); + mlib_ImageSetStruct (&img_src, MLIB_BYTE, 4, width, 1, (4 * width), src); + +#ifdef _BIG_ENDIAN + mlib_ImageBlend_OMSA_ONE_Inp (&img_dst, &img_src, 0x08); +#else + mlib_ImageBlend_OMSA_ONE_Inp (&img_dst, &img_src, 0x01); +#endif +#else int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; @@ -1559,6 +1610,7 @@ fbCombineOverU (CARD32 *dest, const CARD FbByteMulAdd(d, ia, s); dest[i] = d; } +#endif } static FASTCALL void @@ -1577,6 +1629,18 @@ fbCombineOverReverseU (CARD32 *dest, con static FASTCALL void fbCombineInU (CARD32 *dest, const CARD32 *src, int width) { +#ifdef USE_MEDIALIB + mlib_image img_src, img_dst; + + mlib_ImageSetStruct (&img_dst, MLIB_BYTE, 4, width, 1, (4 * width), dest); + mlib_ImageSetStruct (&img_src, MLIB_BYTE, 4, width, 1, (4 * width), src); + +#ifdef _BIG_ENDIAN + mlib_ImageBlend_ZERO_DA_Inp (&img_dst, &img_src, 0x08); +#else + mlib_ImageBlend_ZERO_DA_Inp (&img_dst, &img_src, 0x01); +#endif +#else int i; for (i = 0; i < width; ++i) { CARD32 s = src[i]; @@ -1584,6 +1648,7 @@ fbCombineInU (CARD32 *dest, const CARD32 FbByteMul(s, a); dest[i] = s; } +#endif } static FASTCALL void