summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2010-12-10 12:19:50 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2011-01-18 12:42:25 -0500
commitb2c9eaa5020d08cfaac6c2296895e5a65c971ffd (patch)
tree5d8e4048cefb6608574a9c0d65d64ff842cf0cfc
parent15b1645c7b96498788c9376e3bb7d8a5e7b4e584 (diff)
Move initialization of iterators for bits images to pixman-bits-image.c
pixman_iter_t is now defined in pixman-private.h, and iterators for bits images are being initialized in pixman-bits-image.c
-rw-r--r--pixman/pixman-bits-image.c80
-rw-r--r--pixman/pixman-general.c69
-rw-r--r--pixman/pixman-private.h28
3 files changed, 123 insertions, 54 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c
index c453e0ee..bcada58b 100644
--- a/pixman/pixman-bits-image.c
+++ b/pixman/pixman-bits-image.c
@@ -1347,6 +1347,86 @@ bits_image_property_changed (pixman_image_t *image)
}
static uint32_t *
+src_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
+{
+ iter->image->common.get_scanline_32 (
+ iter->image, iter->x, iter->y++, iter->width, iter->buffer, mask);
+
+ return iter->buffer;
+}
+
+static uint32_t *
+src_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
+{
+ iter->image->common.get_scanline_64 (
+ iter->image, iter->x, iter->y++, iter->width, iter->buffer, mask);
+
+ return iter->buffer;
+}
+
+void
+_pixman_bits_image_src_iter_init (pixman_image_t *image,
+ pixman_iter_t *iter,
+ int x, int y, int width, int height,
+ uint8_t *buffer, iter_flags_t flags)
+{
+ if (flags & ITER_NARROW)
+ iter->get_scanline = src_get_scanline_narrow;
+ else
+ iter->get_scanline = src_get_scanline_wide;
+}
+
+static uint32_t *
+dest_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
+{
+ iter->image->common.get_scanline_32 (
+ iter->image, iter->x, iter->y, iter->width, iter->buffer, mask);
+
+ return iter->buffer;
+}
+
+static uint32_t *
+dest_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
+{
+ iter->image->common.get_scanline_64 (
+ iter->image, iter->x, iter->y, iter->width, iter->buffer, mask);
+
+ return iter->buffer;
+}
+
+static void
+dest_write_back_narrow (pixman_iter_t *iter)
+{
+ _pixman_image_store_scanline_32 (
+ &iter->image->bits, iter->x, iter->y++, iter->width, iter->buffer);
+}
+
+static void
+dest_write_back_wide (pixman_iter_t *iter)
+{
+ _pixman_image_store_scanline_64 (
+ &iter->image->bits, iter->x, iter->y++, iter->width, iter->buffer);
+}
+
+void
+_pixman_bits_image_dest_iter_init (pixman_image_t *image,
+ pixman_iter_t *iter,
+ int x, int y, int width, int height,
+ uint8_t *buffer, iter_flags_t flags)
+{
+ if (flags & ITER_NARROW)
+ {
+ iter->get_scanline = dest_get_scanline_narrow;
+ iter->write_back = dest_write_back_narrow;
+ }
+ else
+ {
+ iter->get_scanline = dest_get_scanline_wide;
+ iter->write_back = dest_write_back_wide;
+ }
+}
+
+static uint32_t *
create_bits (pixman_format_code_t format,
int width,
int height,
diff --git a/pixman/pixman-general.c b/pixman/pixman-general.c
index ea27e802..3b7b59df 100644
--- a/pixman/pixman-general.c
+++ b/pixman/pixman-general.c
@@ -39,23 +39,6 @@
#include "pixman-combine32.h"
#include "pixman-private.h"
-typedef struct pixman_iter_t pixman_iter_t;
-typedef enum
-{
- ITER_NARROW = (1 << 0)
-} iter_flags_t;
-
-struct pixman_iter_t
-{
- uint32_t *(* get_scanline) (pixman_iter_t *iter, const uint32_t *mask);
- void (* write_back) (pixman_iter_t *iter);
-
- pixman_image_t * image;
- uint32_t * buffer;
- int x, y;
- int width;
-};
-
static uint32_t *
src_get_scanline_null (pixman_iter_t *iter, const uint32_t *mask)
{
@@ -94,43 +77,22 @@ src_iter_init (pixman_implementation_t *imp,
iter->buffer = (uint32_t *)buffer;
if (!image)
+ {
iter->get_scanline = src_get_scanline_null;
+ }
+ else if (image->type == BITS)
+ {
+ _pixman_bits_image_src_iter_init (
+ image, iter, x, y, width, height, buffer, flags);
+ }
else if (flags & ITER_NARROW)
+ {
iter->get_scanline = src_get_scanline_narrow;
+ }
else
+ {
iter->get_scanline = src_get_scanline_wide;
-}
-
-static uint32_t *
-dest_get_scanline_narrow (pixman_iter_t *iter, const uint32_t *mask)
-{
- _pixman_image_get_scanline_32 (
- iter->image, iter->x, iter->y, iter->width, iter->buffer, mask);
-
- return iter->buffer;
-}
-
-static uint32_t *
-dest_get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask)
-{
- _pixman_image_get_scanline_64 (
- iter->image, iter->x, iter->y, iter->width, iter->buffer, mask);
-
- return iter->buffer;
-}
-
-static void
-write_back_narrow (pixman_iter_t *iter)
-{
- _pixman_image_store_scanline_32 (
- &iter->image->bits, iter->x, iter->y++, iter->width, iter->buffer);
-}
-
-static void
-write_back_wide (pixman_iter_t *iter)
-{
- _pixman_image_store_scanline_64 (
- &iter->image->bits, iter->x, iter->y++, iter->width, iter->buffer);
+ }
}
static void
@@ -146,15 +108,14 @@ dest_iter_init (pixman_implementation_t *imp,
iter->width = width;
iter->buffer = (uint32_t *)buffer;
- if (flags & ITER_NARROW)
+ if (image->type == BITS)
{
- iter->get_scanline = dest_get_scanline_narrow;
- iter->write_back = write_back_narrow;
+ _pixman_bits_image_dest_iter_init (
+ image, iter, x, y, width, height, buffer, flags);
}
else
{
- iter->get_scanline = dest_get_scanline_wide;
- iter->write_back = write_back_wide;
+ _pixman_log_error (FUNC, "Trying to write to a non-writable image");
}
}
diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h
index 383748ab..853fb5a7 100644
--- a/pixman/pixman-private.h
+++ b/pixman/pixman-private.h
@@ -193,10 +193,38 @@ union pixman_image
solid_fill_t solid;
};
+typedef struct pixman_iter_t pixman_iter_t;
+typedef enum
+{
+ ITER_NARROW = (1 << 0),
+} iter_flags_t;
+
+struct pixman_iter_t
+{
+ uint32_t *(* get_scanline) (pixman_iter_t *iter, const uint32_t *mask);
+ void (* write_back) (pixman_iter_t *iter);
+
+ pixman_image_t * image;
+ uint32_t * buffer;
+ int x, y;
+ int width;
+};
+
void
_pixman_bits_image_setup_accessors (bits_image_t *image);
void
+_pixman_bits_image_src_iter_init (pixman_image_t *image,
+ pixman_iter_t *iter,
+ int x, int y, int width, int height,
+ uint8_t *buffer, iter_flags_t flags);
+void
+_pixman_bits_image_dest_iter_init (pixman_image_t *image,
+ pixman_iter_t *iter,
+ int x, int y, int width, int height,
+ uint8_t *buffer, iter_flags_t flags);
+
+void
_pixman_image_get_scanline_generic_64 (pixman_image_t *image,
int x,
int y,