From: Søren Sandmann Pedersen Date: Thu, 30 Apr 2009 06:42:47 +0000 (-0400) Subject: Move fetch logic to pixman-image.c X-Git-Tag: 1.0_branch~1175^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=363be5285950d20cc77cf4a7eb50d5f1f5fea0f7;p=profile%2Fivi%2Fpixman.git Move fetch logic to pixman-image.c --- diff --git a/pixman/pixman-compose.c b/pixman/pixman-compose.c index 1f9a689..701edd4 100644 --- a/pixman/pixman-compose.c +++ b/pixman/pixman-compose.c @@ -42,46 +42,6 @@ #define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_no_accessors #endif -static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) -{ - uint32_t color; - uint32_t *end; - fetchPixelProc32 fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict); - - color = fetch(pict, 0, 0); - - end = buffer + width; - while (buffer < end) - *(buffer++) = color; -} - -static void fbFetchSolid64(bits_image_t * pict, int x, int y, int width, uint64_t *buffer, void *unused, uint32_t unused2) -{ - uint64_t color; - uint64_t *end; - fetchPixelProc64 fetch = ACCESS(pixman_fetchPixelProcForPicture64)(pict); - - color = fetch(pict, 0, 0); - - end = buffer + width; - while (buffer < end) - *(buffer++) = color; -} - -static void fbFetch(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) -{ - fetchProc32 fetch = ACCESS(pixman_fetchProcForPicture32)(pict); - - fetch(pict, x, y, width, buffer); -} - -static void fbFetch64(bits_image_t * pict, int x, int y, int width, uint64_t *buffer, void *unused, uint32_t unused2) -{ - fetchProc64 fetch = ACCESS(pixman_fetchProcForPicture64)(pict); - - fetch(pict, x, y, width, buffer); -} - static void fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer) { @@ -110,50 +70,6 @@ fbStore64(bits_image_t * pict, int x, int y, int width, uint64_t *buffer) store((pixman_image_t *)pict, bits, buffer, x, width, indexed); } -typedef void (*scanStoreProc)(pixman_image_t *, int, int, int, uint32_t *); -typedef void (*scanFetchProc)(pixman_image_t *, int, int, int, uint32_t *, - uint32_t *, uint32_t); - -static inline scanFetchProc get_fetch_source_pict(const int wide) -{ - if (wide) - return (scanFetchProc)pixmanFetchSourcePict64; - else - return (scanFetchProc)pixmanFetchSourcePict; -} - -static inline scanFetchProc get_fetch_solid(const int wide) -{ - if (wide) - return (scanFetchProc)fbFetchSolid64; - else - return (scanFetchProc)fbFetchSolid; -} - -static inline scanFetchProc get_fetch(const int wide) -{ - if (wide) - return (scanFetchProc)fbFetch64; - else - return (scanFetchProc)fbFetch; -} - -static inline scanFetchProc get_fetch_external_alpha(const int wide) -{ - if (wide) - return (scanFetchProc)ACCESS(fbFetchExternalAlpha64); - else - return (scanFetchProc)ACCESS(fbFetchExternalAlpha); -} - -static inline scanFetchProc get_fetch_transformed(const int wide) -{ - if (wide) - return (scanFetchProc)ACCESS(fbFetchTransformed64); - else - return (scanFetchProc)ACCESS(fbFetchTransformed); -} - static inline scanStoreProc get_store(const int wide) { if (wide) @@ -170,39 +86,6 @@ static inline scanStoreProc get_store_external_alpha(const int wide) return (scanStoreProc)ACCESS(fbStoreExternalAlpha); } -static scanFetchProc -get_fetcher (pixman_image_t *image, int wide) -{ - if (IS_SOURCE_IMAGE (image)) - { - return get_fetch_source_pict(wide); - } - else - { - bits_image_t *bits = (bits_image_t *)image; - - if (bits->common.alpha_map) - { - return get_fetch_external_alpha(wide); - } - else if ((bits->common.repeat != PIXMAN_REPEAT_NONE) && - bits->width == 1 && - bits->height == 1) - { - return get_fetch_solid(wide); - } - else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION - && bits->common.repeat != PIXMAN_REPEAT_PAD && bits->common.repeat != PIXMAN_REPEAT_REFLECT) - { - return get_fetch(wide); - } - else - { - return get_fetch_transformed(wide); - } - } -} - #ifndef PIXMAN_FB_ACCESSORS static #endif @@ -234,22 +117,24 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, if (data->op == PIXMAN_OP_CLEAR) fetchSrc = NULL; else - fetchSrc = get_fetcher (data->src, wide); + fetchSrc = _pixman_image_get_fetcher (data->src, wide); if (!data->mask || data->op == PIXMAN_OP_CLEAR) fetchMask = NULL; else - fetchMask = get_fetcher (data->mask, wide); + fetchMask = _pixman_image_get_fetcher (data->mask, wide); + + if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC) + fetchDest = NULL; + else + fetchDest = _pixman_image_get_fetcher (data->dest, wide); if (data->dest->common.alpha_map) { - fetchDest = get_fetch_external_alpha(wide); store = get_store_external_alpha(wide); - } else { - fetchDest = get_fetch(wide); store = get_store(wide); #ifndef PIXMAN_FB_ACCESSORS @@ -266,9 +151,6 @@ PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data, #endif } - if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC) - fetchDest = NULL; - if (!store) { bits = data->dest->bits.bits; diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index 819d29a..cecd02c 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -183,6 +183,97 @@ _pixman_image_classify (pixman_image_t *image, return SOURCE_IMAGE_CLASS_UNKNOWN; } +#define READ_ACCESS(f) ((image->common.read_func)? f##_accessors : f) + +static void fbFetchSolid(bits_image_t * image, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) +{ + uint32_t color; + uint32_t *end; + fetchPixelProc32 fetch = READ_ACCESS(pixman_fetchPixelProcForPicture32)(image); + + color = fetch(image, 0, 0); + + end = buffer + width; + while (buffer < end) + *(buffer++) = color; +} + +static void fbFetchSolid64(bits_image_t * image, int x, int y, int width, uint64_t *buffer, void *unused, uint32_t unused2) +{ + uint64_t color; + uint64_t *end; + fetchPixelProc64 fetch = READ_ACCESS(pixman_fetchPixelProcForPicture64)(image); + + color = fetch(image, 0, 0); + + end = buffer + width; + while (buffer < end) + *(buffer++) = color; +} + +static void fbFetch(bits_image_t * image, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits) +{ + fetchProc32 fetch = READ_ACCESS(pixman_fetchProcForPicture32)(image); + + fetch(image, x, y, width, buffer); +} + +static void fbFetch64(bits_image_t * image, int x, int y, int width, uint64_t *buffer, void *unused, uint32_t unused2) +{ + fetchProc64 fetch = READ_ACCESS(pixman_fetchProcForPicture64)(image); + + fetch(image, x, y, width, buffer); +} + +scanFetchProc +_pixman_image_get_fetcher (pixman_image_t *image, + int wide) +{ + if (IS_SOURCE_IMAGE (image)) + { + if (wide) + return (scanFetchProc)pixmanFetchSourcePict64; + else + return (scanFetchProc)pixmanFetchSourcePict; + } + else + { + bits_image_t *bits = (bits_image_t *)image; + + if (bits->common.alpha_map) + { + if (wide) + return (scanFetchProc)READ_ACCESS(fbFetchExternalAlpha64); + else + return (scanFetchProc)READ_ACCESS(fbFetchExternalAlpha); + } + else if ((bits->common.repeat != PIXMAN_REPEAT_NONE) && + bits->width == 1 && + bits->height == 1) + { + if (wide) + return (scanFetchProc)fbFetchSolid64; + else + return (scanFetchProc)fbFetchSolid; + } + else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION + && bits->common.repeat != PIXMAN_REPEAT_PAD && bits->common.repeat != PIXMAN_REPEAT_REFLECT) + { + if (wide) + return (scanFetchProc)fbFetch64; + else + return (scanFetchProc)fbFetch; + } + else + { + if (wide) + return (scanFetchProc)READ_ACCESS(fbFetchTransformed64); + else + return (scanFetchProc)READ_ACCESS(fbFetchTransformed); + } + } +} + /* 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 3049c7c..e7fbb58 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -289,12 +289,22 @@ typedef source_pict_class_t (* classify_func_t) (pixman_image_t *image, int width, int height); +typedef void (*scanStoreProc)(pixman_image_t *, int, int, int, uint32_t *); +typedef void (*scanFetchProc)(pixman_image_t *, int, int, int, uint32_t *, + uint32_t *, uint32_t); + source_pict_class_t _pixman_image_classify (pixman_image_t *image, int x, int y, int width, int height); +scanFetchProc +_pixman_image_get_fetcher (pixman_image_t *image, + int wide); + + + struct point { int16_t x, y;