From 5b8304fd17b86639a3adb3eec8ce1116a9d3425e Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Fri, 22 May 2009 08:15:35 -0400 Subject: [PATCH] Move some code around - use image->fetch_pixel in FbFetchSolid --- pixman/pixman-bits-image.c | 125 +++++++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index 396688d..33f5a30 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -38,6 +38,67 @@ #define READ_ACCESS(f) ((image->common.read_func)? f##_accessors : f) #define WRITE_ACCESS(f) ((image->common.write_func)? f##_accessors : f) +/* Store functions */ + +static void +bits_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, uint32_t *buffer) +{ + uint32_t *bits; + int32_t stride; + const pixman_indexed_t * indexed = image->indexed; + + bits = image->bits; + stride = image->rowstride; + bits += y*stride; + + image->store_scanline_raw_32 ((pixman_image_t *)image, bits, buffer, x, width, indexed); + + if (image->common.alpha_map) + { + x -= image->common.alpha_origin.x; + y -= image->common.alpha_origin.y; + + bits_image_store_scanline_32 (image->common.alpha_map, x, y, width, buffer); + } +} + +static void +bits_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, uint32_t *buffer) +{ + uint32_t *bits; + int32_t stride; + const pixman_indexed_t * indexed = image->indexed; + + bits = image->bits; + stride = image->rowstride; + bits += y*stride; + + image->store_scanline_raw_64 ((pixman_image_t *)image, bits, (uint64_t *)buffer, x, width, indexed); + + if (image->common.alpha_map) + { + x -= image->common.alpha_origin.x; + y -= image->common.alpha_origin.y; + + bits_image_store_scanline_64 (image->common.alpha_map, x, y, width, buffer); + } +} + +void +_pixman_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, + uint32_t *buffer) +{ + image->store_scanline_32 (image, x, y, width, buffer); +} + +void +_pixman_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, + uint32_t *buffer) +{ + image->store_scanline_64 (image, x, y, width, buffer); +} + +/* Fetch functions */ static void fbFetchSolid(bits_image_t * image, int x, int y, int width, @@ -46,10 +107,8 @@ fbFetchSolid(bits_image_t * image, { uint32_t color; uint32_t *end; - fetchPixelProc32 fetch = - READ_ACCESS(pixman_fetchPixelProcForPicture32)(image); - color = fetch(image, 0, 0); + color = image->fetch_pixel(image, 0, 0); end = buffer + width; while (buffer < end) @@ -63,10 +122,8 @@ fbFetchSolid64(bits_image_t * image, { uint64_t color; uint64_t *end; - fetchPixelProc64 fetch = - READ_ACCESS(pixman_fetchPixelProcForPicture64)(image); - color = fetch(image, 0, 0); + color = image->fetch_pixel(image, 0, 0); end = buffer + width; while (buffer < end) @@ -89,49 +146,8 @@ fbFetch64(bits_image_t * image, image->fetch_scanline_raw_64(image, x, y, width, buffer); } -static void -bits_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, uint32_t *buffer) -{ - uint32_t *bits; - int32_t stride; - const pixman_indexed_t * indexed = image->indexed; - bits = image->bits; - stride = image->rowstride; - bits += y*stride; - image->store_scanline_raw_32 ((pixman_image_t *)image, bits, buffer, x, width, indexed); - - if (image->common.alpha_map) - { - x -= image->common.alpha_origin.x; - y -= image->common.alpha_origin.y; - - bits_image_store_scanline_32 (image->common.alpha_map, x, y, width, buffer); - } -} - -static void -bits_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, uint32_t *buffer) -{ - uint32_t *bits; - int32_t stride; - const pixman_indexed_t * indexed = image->indexed; - - bits = image->bits; - stride = image->rowstride; - bits += y*stride; - - image->store_scanline_raw_64 ((pixman_image_t *)image, bits, (uint64_t *)buffer, x, width, indexed); - - if (image->common.alpha_map) - { - x -= image->common.alpha_origin.x; - y -= image->common.alpha_origin.y; - - bits_image_store_scanline_64 (image->common.alpha_map, x, y, width, buffer); - } -} /* On entry, @buffer should contain @n_pixels (x, y) coordinate pairs, where * x and y are both uint32_ts. On exit, buffer will contain the corresponding @@ -745,21 +761,6 @@ bits_image_property_changed (pixman_image_t *image) bits->fetch_pixel = READ_ACCESS(pixman_fetchPixelProcForPicture32)(bits); } - -void -_pixman_image_store_scanline_32 (bits_image_t *image, int x, int y, int width, - uint32_t *buffer) -{ - image->store_scanline_32 (image, x, y, width, buffer); -} - -void -_pixman_image_store_scanline_64 (bits_image_t *image, int x, int y, int width, - uint32_t *buffer) -{ - image->store_scanline_64 (image, x, y, width, buffer); -} - static uint32_t * create_bits (pixman_format_code_t format, int width, -- 2.7.4