summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-12-14 15:55:23 +0100
committerAndrea Canciani <ranma42@gmail.com>2010-12-20 11:07:39 +0100
commit470db3c4fb53640e03b9305ee7164273a7085d0f (patch)
tree09614672331c74bac772f4deae884ebfc19dbc67
parent5854f6352f80dcf51a326c9bd566f2c1e089f3a2 (diff)
direct fetchers
-rw-r--r--pixman/pixman-access.c97
1 files changed, 34 insertions, 63 deletions
diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c
index 717ecba..068d952 100644
--- a/pixman/pixman-access.c
+++ b/pixman/pixman-access.c
@@ -139,11 +139,12 @@
#endif
-static force_inline uint32_t
+static force_inline void
fetch_and_convert_pixel (pixman_image_t * image,
const uint8_t * bits,
int offset,
- pixman_format_code_t format)
+ pixman_format_code_t format,
+ pixman_component_t *buffer)
{
uint32_t pixel;
@@ -178,7 +179,8 @@ fetch_and_convert_pixel (pixman_image_t * image,
break;
}
- return convert_pixel_to_a8r8g8b8 (image, format, pixel);
+ pixel = convert_pixel_to_a8r8g8b8 (image, format, pixel);
+ pixman_expand_to_float (buffer, &pixel, format, 1);
}
static force_inline void
@@ -229,8 +231,8 @@ convert_and_store_pixel (bits_image_t * image,
int x, \
int y, \
int width, \
- uint32_t * buffer, \
- const uint32_t *mask) \
+ pixman_component_t * buffer, \
+ const pixman_component_t *mask) \
{ \
uint8_t *bits = \
(uint8_t *)(image->bits.bits + y * image->bits.rowstride); \
@@ -238,8 +240,8 @@ convert_and_store_pixel (bits_image_t * image,
\
for (i = 0; i < width; ++i) \
{ \
- *buffer++ = \
- fetch_and_convert_pixel (image, bits, x + i, PIXMAN_ ## format); \
+ fetch_and_convert_pixel (image, bits, x + i, PIXMAN_ ## format, buffer); \
+ buffer+=4; \
} \
} \
\
@@ -248,7 +250,7 @@ convert_and_store_pixel (bits_image_t * image,
int x, \
int y, \
int width, \
- const uint32_t *values) \
+ const pixman_component_t *values) \
{ \
uint8_t *dest = \
(uint8_t *)(image->bits + y * image->rowstride); \
@@ -256,8 +258,11 @@ convert_and_store_pixel (bits_image_t * image,
\
for (i = 0; i < width; ++i) \
{ \
+ uint32_t value; \
+ \
+ pixman_contract_from_float (&value, values+i*4, 1); \
convert_and_store_pixel ( \
- image, dest, i + x, PIXMAN_ ## format, values[i]); \
+ image, dest, i + x, PIXMAN_ ## format, value); \
} \
} \
\
@@ -710,18 +715,15 @@ fetch_scanline_generic_lossy_32 (pixman_image_t *image,
typedef struct
{
pixman_format_code_t format;
- fetch_scanline_t fetch_scanline_32;
- fetch_scanline_t fetch_scanline_64;
- store_scanline_t store_scanline_32;
- store_scanline_t store_scanline_64;
+ fetch_scanline_new_t fetch_scanline;
+ store_scanline_new_t store_scanline;
} format_info_t;
#define FORMAT_INFO(format) \
{ \
PIXMAN_ ## format, \
fetch_scanline_ ## format, \
- fetch_scanline_generic_64, \
- store_scanline_ ## format, store_scanline_generic_64 \
+ store_scanline_ ## format \
}
static const format_info_t accessors[] =
@@ -789,67 +791,41 @@ static const format_info_t accessors[] =
/* 1bpp formats */
FORMAT_INFO (a1),
FORMAT_INFO (g1),
-
+
+#if 0
/* Wide formats */
{ PIXMAN_a2r10g10b10,
- fetch_scanline_generic_lossy_32, fetch_scanline_a2r10g10b10,
- NULL, store_scanline_a2r10g10b10 },
+ fetch_scanline_a2r10g10b10,
+ store_scanline_a2r10g10b10 },
{ PIXMAN_x2r10g10b10,
- fetch_scanline_generic_lossy_32, fetch_scanline_x2r10g10b10,
- NULL, store_scanline_x2r10g10b10 },
+ fetch_scanline_x2r10g10b10,
+ store_scanline_x2r10g10b10 },
{ PIXMAN_a2b10g10r10,
- fetch_scanline_generic_lossy_32, fetch_scanline_a2b10g10r10,
- NULL, store_scanline_a2b10g10r10 },
+ fetch_scanline_a2b10g10r10,
+ store_scanline_a2b10g10r10 },
{ PIXMAN_x2b10g10r10,
- fetch_scanline_generic_lossy_32, fetch_scanline_x2b10g10r10,
- NULL, store_scanline_x2b10g10r10 },
+ fetch_scanline_x2b10g10r10,
+ store_scanline_x2b10g10r10 },
/* YUV formats */
{ PIXMAN_yuy2,
- fetch_scanline_yuy2, fetch_scanline_generic_64,
- NULL, NULL },
+ fetch_scanline_yuy2,
+ NULL },
{ PIXMAN_yv12,
- fetch_scanline_yv12, fetch_scanline_generic_64,
- NULL, NULL },
+ fetch_scanline_yv12,
+ NULL },
+#endif
{ PIXMAN_null },
};
static void
-fetch_scanline_generic (pixman_image_t * image,
- int x,
- int y,
- int width,
- pixman_component_t *buffer,
- const pixman_component_t * mask)
-{
- uint64_t *tmp = malloc (sizeof(uint64_t) * width);
- image->bits.fetch_scanline_64 (image, x, y, width, (uint32_t *)tmp, NULL);
- pixman_expand_64 (buffer, tmp, width);
- free (tmp);
-}
-
-static void
-store_scanline_generic (bits_image_t * image,
- int x,
- int y,
- int width,
- const pixman_component_t *buffer)
-{
- uint64_t *tmp = malloc (sizeof(uint64_t) * 4 * width);
- pixman_contract_64 (tmp, buffer, width);
- image->store_scanline_64 (image, x, y, width, (uint32_t *) tmp);
- free (tmp);
-}
-
-
-static void
setup_accessors (bits_image_t *image)
{
const format_info_t *info = accessors;
@@ -858,13 +834,8 @@ setup_accessors (bits_image_t *image)
{
if (info->format == image->format)
{
- image->fetch_scanline_32 = info->fetch_scanline_32;
- image->fetch_scanline_64 = info->fetch_scanline_64;
- image->store_scanline_32 = info->store_scanline_32;
- image->store_scanline_64 = info->store_scanline_64;
-
- image->fetch_scanline = fetch_scanline_generic;
- image->store_scanline = store_scanline_generic;
+ image->fetch_scanline = info->fetch_scanline;
+ image->store_scanline = info->store_scanline;
return;
}