--- pixman/pixman/pixman-compose.c.old 2007-11-08 14:14:10.870989000 +0800 +++ pixman/pixman/pixman-compose.c 2007-11-09 18:56:09.696762000 +0800 @@ -33,6 +33,10 @@ #include #include +#ifdef HAVE_MLIB_H +#include +#endif + #include "pixman-private.h" /* @@ -1803,11 +1807,16 @@ 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 (ia == 0) { + *(dest + i) = s; + } + else { + uint32_t d = *(dest + i); + FbByteMulAdd(d, ia, s); + *(dest + i) = d; + } } } @@ -1831,8 +1840,16 @@ for (i = 0; i < width; ++i) { uint32_t s = *(src + i); uint32_t a = Alpha(*(dest + i)); - FbByteMul(s, a); - *(dest + i) = s; + + if (a == 0xff) + { + *(dest + i) = s; + } + else + { + FbByteMul(s, a); + *(dest + i) = s; + } } } @@ -4456,83 +4473,115 @@ if (fetchMask) mask_buffer = dest_buffer + data->width; +#ifdef HAVE_MLIB_H + if (fetchMask || xoff || store || yoff || + data->xDest || data->xSrc || data->yDest || data->ySrc || + ((compose != fbCombineSrcU) && (compose != fbCombineOverU)) + ) { +#endif - for (i = 0; i < data->height; ++i) { - /* fill first half of scanline with source */ - if (fetchSrc) - { - if (fetchMask) - { - /* fetch mask before source so that fetching of - source can be optimized */ - fetchMask (data->mask, data->xMask, data->yMask + i, + for (i = 0; i < data->height; ++i) { + /* fill first half of scanline with source */ + if (fetchSrc) + { + if (fetchMask) + { + /* fetch mask before source so that fetching of + source can be optimized */ + fetchMask (data->mask, data->xMask, data->yMask + i, data->width, mask_buffer, 0, 0); - if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL) - fetchMask = NULL; - } - - if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL) - { - fetchSrc (data->src, data->xSrc, data->ySrc + i, + if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL) + fetchMask = NULL; + } + + if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL) + { + fetchSrc (data->src, data->xSrc, data->ySrc + i, data->width, src_buffer, 0, 0); - if (mask_buffer) - { - fbCombineInU (mask_buffer, src_buffer, data->width); - src_mask_buffer = mask_buffer; - } - else - src_mask_buffer = src_buffer; - - fetchSrc = NULL; - } - else - { - fetchSrc (data->src, data->xSrc, data->ySrc + i, - data->width, src_buffer, mask_buffer, - 0xff000000); - - if (mask_buffer) - PIXMAN_COMPOSE_FUNCTIONS.combineMaskU (src_buffer, - mask_buffer, - data->width); + if (mask_buffer) + { + fbCombineInU (mask_buffer, src_buffer, data->width); + src_mask_buffer = mask_buffer; + } + else + src_mask_buffer = src_buffer; + + fetchSrc = NULL; + } + else + { + fetchSrc (data->src, data->xSrc, data->ySrc + i, + data->width, src_buffer, mask_buffer, + 0xff000000); + + if (mask_buffer) + PIXMAN_COMPOSE_FUNCTIONS.combineMaskU (src_buffer, + mask_buffer, + data->width); - src_mask_buffer = src_buffer; - } - } - else if (fetchMask) - { - fetchMask (data->mask, data->xMask, data->yMask + i, - data->width, mask_buffer, 0, 0); - - fbCombineInU (mask_buffer, src_buffer, data->width); - - src_mask_buffer = mask_buffer; - } - - if (store) - { - /* fill dest into second half of scanline */ - if (fetchDest) - fetchDest (data->dest, data->xDest, data->yDest + i, - data->width, dest_buffer, 0, 0); - - /* blend */ - compose (dest_buffer, src_mask_buffer, data->width); + src_mask_buffer = src_buffer; + } + } + else if (fetchMask) + { + fetchMask (data->mask, data->xMask, data->yMask + i, + data->width, mask_buffer, 0, 0); + + fbCombineInU (mask_buffer, src_buffer, data->width); + + src_mask_buffer = mask_buffer; + } + + if (store) + { + /* fill dest into second half of scanline */ + if (fetchDest) + fetchDest (data->dest, data->xDest, data->yDest + i, + data->width, dest_buffer, 0, 0); + + /* blend */ + compose (dest_buffer, src_mask_buffer, data->width); + + /* write back */ + store (data->dest, data->xDest, data->yDest + i, data->width, dest_buffer); + } + else + { + /* blend */ + compose (bits + (data->yDest + i+ yoff) * stride + + data->xDest + xoff, + src_mask_buffer, data->width); + } + } +#ifdef HAVE_MLIB_H + } + /* fetchmask = NULL */ + else { + mlib_image *m_src; + mlib_image *m_dst; + + m_src = mlib_ImageCreateStruct(MLIB_BYTE, 4, + pixman_image_get_width(data->src), + pixman_image_get_height(data->src), + pixman_image_get_stride(data->src), + pixman_image_get_data(data->src)); + + m_dst = mlib_ImageCreateStruct(MLIB_BYTE ,4, + pixman_image_get_width(data->dest), + pixman_image_get_height(data->dest), + pixman_image_get_stride(data->dest), + pixman_image_get_data(data->dest)); + if ((data->src->bits.format != PIXMAN_x8r8g8b8) && (compose == fbCombineOverU)) + mlib_ImageBlend_OMSA_ONE_Inp(m_dst, m_src, 0x08); + else + mlib_ImageBlend_ZERO_ONE_Inp(m_dst, m_src, 0x08); - /* write back */ - store (data->dest, data->xDest, data->yDest + i, data->width, - dest_buffer); - } - else - { - /* blend */ - compose (bits + (data->yDest + i+ yoff) * stride + - data->xDest + xoff, - src_mask_buffer, data->width); - } - } + mlib_ImageDelete(m_src); + mlib_ImageDelete(m_dst); + } +#endif } if (!store) --- pixman/pixman/pixman-utils.c.old 2007-11-08 14:26:51.026259000 +0800 +++ pixman/pixman/pixman-utils.c 2007-11-09 18:44:26.170278000 +0800 @@ -25,6 +25,10 @@ #include #endif +#ifdef HAVE_MLIB_H +#include +#endif + #include #include "pixman.h" #include "pixman-private.h" @@ -145,8 +149,22 @@ { int i; +#ifdef HAVE_MLIB_H + mlib_image *m_img; + mlib_s32 color[4]; +#endif + bits = bits + y * stride + x; +#ifdef HAVE_MLIB_H + color[3] = xor & 0xff; + color[2] = (xor & 0xff00) >> 8; + color[1] = (xor & 0xff0000) >> 16; + color[0] = (xor & 0xff000000) >> 24; + m_img = mlib_ImageCreateStruct(MLIB_BYTE, 4, width, height, stride*4, bits); + mlib_ImageClear(m_img, color); + mlib_ImageDelete(m_img); +#else while (height--) { for (i = 0; i < width; ++i) @@ -154,6 +172,7 @@ bits += stride; } +#endif } pixman_bool_t --- pixman/configure.ac.old 2007-11-09 18:40:47.223450000 +0800 +++ pixman/configure.ac 2007-11-09 16:26:20.379681000 +0800 @@ -54,6 +54,9 @@ AC_PROG_CC AC_PROG_LIBTOOL AC_CHECK_FUNCS([getisax]) +AC_CHECK_HEADER([mlib.h],[AC_DEFINE([HAVE_MLIB_H],[1],[mediaLib Libraries]) LIBS="-lmlib $LIBS"]) +#AC_CHECK_LIB(mlib,mlib_ImageClear) +#AC_SUBST(HAVE_LIBMLIB) AC_C_BIGENDIAN #