summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pixman/pixman-bits-image.c81
1 files changed, 33 insertions, 48 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index b401540f..52df1cf5 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -447,82 +447,67 @@ _pixman_bits_image_src_iter_init (pixman_image_t *image, pixman_iter_t *iter)
iter->get_scanline = bits_image_fetch_general;
}
-static uint32_t *
-dest_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
+static void
+fetch_scanline_wide (bits_image_t *image, int x, int y, int width,
+ argb_t *buffer, const uint32_t *mask)
{
- pixman_image_t *image = iter->image;
- int x = iter->x;
- int y = iter->y;
- int width = iter->width;
- uint32_t * buffer = iter->buffer;
+ image->fetch_scanline_float (
+ (pixman_image_t *)image, x, y, width, (uint32_t *)buffer, mask);
- image->bits.fetch_scanline_32 (image, x, y, width, buffer, mask);
if (image->common.alpha_map)
{
- uint32_t *alpha;
+ argb_t *alpha;
- if ((alpha = malloc (width * sizeof (uint32_t))))
+ if ((alpha = malloc (width * sizeof (argb_t))))
{
int i;
x -= image->common.alpha_origin_x;
y -= image->common.alpha_origin_y;
- image->common.alpha_map->fetch_scanline_32 (
+ image->common.alpha_map->fetch_scanline_float (
(pixman_image_t *)image->common.alpha_map,
- x, y, width, alpha, mask);
+ x, y, width, (uint32_t *)alpha, mask);
for (i = 0; i < width; ++i)
- {
- buffer[i] &= ~0xff000000;
- buffer[i] |= (alpha[i] & 0xff000000);
- }
+ buffer[i].a = alpha[i].a;
free (alpha);
}
}
-
- return iter->buffer;
}
static uint32_t *
dest_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
{
- bits_image_t * image = &iter->image->bits;
- int x = iter->x;
- int y = iter->y;
- int width = iter->width;
- argb_t * buffer = (argb_t *)iter->buffer;
+ fetch_scanline_wide (
+ &iter->image->bits, iter->x, iter->y, iter->width,
+ (argb_t *)iter->buffer, mask);
- image->fetch_scanline_float (
- (pixman_image_t *)image, x, y, width, (uint32_t *)buffer, mask);
- if (image->common.alpha_map)
- {
- argb_t *alpha;
-
- if ((alpha = malloc (width * sizeof (argb_t))))
- {
- int i;
+ return iter->buffer;
+}
- x -= image->common.alpha_origin_x;
- y -= image->common.alpha_origin_y;
+static uint32_t *
+dest_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
+{
+ argb_t *tmp = malloc (iter->width * sizeof (argb_t));
- image->common.alpha_map->fetch_scanline_float (
- (pixman_image_t *)image->common.alpha_map,
- x, y, width, (uint32_t *)alpha, mask);
+ if (tmp)
+ {
+ fetch_scanline_wide (
+ &iter->image->bits, iter->x, iter->y, iter->width,
+ tmp, NULL);
- for (i = 0; i < width; ++i)
- buffer[i].a = alpha[i].a;
+ pixman_contract_from_float (iter->buffer, tmp, iter->width);
- free (alpha);
- }
+ free (tmp);
}
return iter->buffer;
-}
+}
static void
-dest_write_back_narrow (pixman_iter_t *iter)
+dest_write_back_wide (pixman_iter_t *iter)
{
bits_image_t * image = &iter->image->bits;
int x = iter->x;
@@ -530,14 +515,14 @@ dest_write_back_narrow (pixman_iter_t *iter)
int width = iter->width;
const uint32_t *buffer = iter->buffer;
- image->store_scanline_32 (image, x, y, width, buffer);
+ image->store_scanline_float (image, x, y, width, buffer);
if (image->common.alpha_map)
{
x -= image->common.alpha_origin_x;
y -= image->common.alpha_origin_y;
- image->common.alpha_map->store_scanline_32 (
+ image->common.alpha_map->store_scanline_float (
image->common.alpha_map, x, y, width, buffer);
}
@@ -545,7 +530,7 @@ dest_write_back_narrow (pixman_iter_t *iter)
}
static void
-dest_write_back_wide (pixman_iter_t *iter)
+dest_write_back_narrow (pixman_iter_t *iter)
{
bits_image_t * image = &iter->image->bits;
int x = iter->x;
@@ -553,14 +538,14 @@ dest_write_back_wide (pixman_iter_t *iter)
int width = iter->width;
const uint32_t *buffer = iter->buffer;
- image->store_scanline_float (image, x, y, width, buffer);
+ image->store_scanline_32 (image, x, y, width, buffer);
if (image->common.alpha_map)
{
x -= image->common.alpha_origin_x;
y -= image->common.alpha_origin_y;
- image->common.alpha_map->store_scanline_float (
+ image->common.alpha_map->store_scanline_32 (
image->common.alpha_map, x, y, width, buffer);
}