From: Søren Sandmann Pedersen Date: Thu, 30 Apr 2009 06:50:18 +0000 (-0400) Subject: Move store logic into pixman-image.c X-Git-Tag: 1.0_branch~1175^2~35 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0a6c1e9a5447e982dc4d544146c1b5234e490cf;p=profile%2Fivi%2Fpixman.git Move store logic into pixman-image.c --- diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c index 701edd4..cdb30a2 100644 --- a/pixman/pixman-compose.c +++ b/pixman/pixman-compose.c @@ -42,50 +42,6 @@ #define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_no_accessors #endif -static void -fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer) -{ - uint32_t *bits; - int32_t stride; - storeProc32 store = ACCESS(pixman_storeProcForPicture32)(pict); - const pixman_indexed_t * indexed = pict->indexed; - - bits = pict->bits; - stride = pict->rowstride; - bits += y*stride; - store((pixman_image_t *)pict, bits, buffer, x, width, indexed); -} - -static void -fbStore64(bits_image_t * pict, int x, int y, int width, uint64_t *buffer) -{ - uint32_t *bits; - int32_t stride; - storeProc64 store = ACCESS(pixman_storeProcForPicture64)(pict); - const pixman_indexed_t * indexed = pict->indexed; - - bits = pict->bits; - stride = pict->rowstride; - bits += y*stride; - store((pixman_image_t *)pict, bits, buffer, x, width, indexed); -} - -static inline scanStoreProc get_store(const int wide) -{ - if (wide) - return (scanStoreProc)fbStore64; - else - return (scanStoreProc)fbStore; -} - -static inline scanStoreProc get_store_external_alpha(const int wide) -{ - if (wide) - return (scanStoreProc)ACCESS(fbStoreExternalAlpha64); - else - return (scanStoreProc)ACCESS(fbStoreExternalAlpha); -} - #ifndef PIXMAN_FB_ACCESSORS static #endif @@ -129,27 +85,21 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, else fetchDest = _pixman_image_get_fetcher (data->dest, wide); - if (data->dest->common.alpha_map) - { - store = get_store_external_alpha(wide); - } - else - { - store = get_store(wide); + store = _pixman_image_get_storer (data->dest, wide); #ifndef PIXMAN_FB_ACCESSORS - // Skip the store step and composite directly into the - // destination if the output format of the compose func matches - // the destination format. - if (!wide && - (data->op == PIXMAN_OP_ADD || data->op == PIXMAN_OP_OVER) && - (data->dest->bits.format == PIXMAN_a8r8g8b8 || - data->dest->bits.format == PIXMAN_x8r8g8b8)) - { - store = NULL; - } -#endif + // Skip the store step and composite directly into the + // destination if the output format of the compose func matches + // the destination format. + if (!wide && + !data->dest->common.alpha_map && + (data->op == PIXMAN_OP_ADD || data->op == PIXMAN_OP_OVER) && + (data->dest->bits.format == PIXMAN_a8r8g8b8 || + data->dest->bits.format == PIXMAN_x8r8g8b8)) + { + store = NULL; } +#endif if (!store) { diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index cecd02c..4bc47dc 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -274,6 +274,56 @@ _pixman_image_get_fetcher (pixman_image_t *image, } } +#define WRITE_ACCESS(f) ((image->common.write_func)? f##_accessors : f) + +static void +fbStore(bits_image_t * image, int x, int y, int width, uint32_t *buffer) +{ + uint32_t *bits; + int32_t stride; + storeProc32 store = WRITE_ACCESS(pixman_storeProcForPicture32)(image); + const pixman_indexed_t * indexed = image->indexed; + + bits = image->bits; + stride = image->rowstride; + bits += y*stride; + store((pixman_image_t *)image, bits, buffer, x, width, indexed); +} + +static void +fbStore64(bits_image_t * image, int x, int y, int width, uint64_t *buffer) +{ + uint32_t *bits; + int32_t stride; + storeProc64 store = WRITE_ACCESS(pixman_storeProcForPicture64)(image); + const pixman_indexed_t * indexed = image->indexed; + + bits = image->bits; + stride = image->rowstride; + bits += y*stride; + store((pixman_image_t *)image, bits, buffer, x, width, indexed); +} + +scanStoreProc +_pixman_image_get_storer (pixman_image_t *image, + int wide) +{ + if (image->common.alpha_map) + { + if (wide) + return (scanStoreProc)WRITE_ACCESS(fbStoreExternalAlpha64); + else + return (scanStoreProc)WRITE_ACCESS(fbStoreExternalAlpha); + } + else + { + if (wide) + return (scanStoreProc)fbStore64; + else + return (scanStoreProc)fbStore; + } +} + /* Ref Counting */ PIXMAN_EXPORT pixman_image_t * pixman_image_ref (pixman_image_t *image) diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index e7fbb58..4ef915d 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -303,7 +303,9 @@ scanFetchProc _pixman_image_get_fetcher (pixman_image_t *image, int wide); - +scanStoreProc +_pixman_image_get_storer (pixman_image_t *image, + int wide); struct point {