diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2010-12-10 12:19:50 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-01-03 15:59:41 -0500 |
commit | 8609455cba774bc091db401027a436004b149525 (patch) | |
tree | c0c3e1776c99ce24aac44e4a99d83a2bfc4c0fa2 | |
parent | 00e6606c45ef2721bd8652b2ca31f44acd8d1551 (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.
The function next_line_regular() is needed in both pixman-general.c
and pixman-bits-image.c, so rename it to
_pixman_iter_next_line_regular() and move it to pixman-utils.
-rw-r--r-- | pixman/pixman-bits-image.c | 59 | ||||
-rw-r--r-- | pixman/pixman-general.c | 51 | ||||
-rw-r--r-- | pixman/pixman-private.h | 26 | ||||
-rw-r--r-- | pixman/pixman-utils.c | 6 |
4 files changed, 95 insertions, 47 deletions
diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index ff2dde33..33b908a9 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -1349,6 +1349,65 @@ bits_image_property_changed (pixman_image_t *image) } static uint32_t * +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 * +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 +next_line_write_narrow (pixman_iter_t *iter) +{ + _pixman_image_store_scanline_32 ( + &iter->image->bits, iter->x, iter->y++, iter->width, iter->buffer); +} + +static void +next_line_write_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_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_WRITE)) == (ITER_NARROW | ITER_WRITE)) + { + iter->get_scanline = get_scanline_narrow; + iter->next_line = next_line_write_narrow; + } + else if (flags & ITER_WRITE) + { + iter->get_scanline = get_scanline_wide; + iter->next_line = next_line_write_wide; + } + else + { + if (flags & ITER_NARROW) + iter->get_scanline = get_scanline_narrow; + else + iter->get_scanline = get_scanline_wide; + + iter->next_line = _pixman_iter_next_line_regular; + } +} + +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 05d97ccd..a66298a1 100644 --- a/pixman/pixman-general.c +++ b/pixman/pixman-general.c @@ -39,24 +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_WRITE = (1 << 1) -} iter_flags_t; - -struct pixman_iter_t -{ - uint32_t *(* get_scanline) (pixman_iter_t *iter, const uint32_t *mask); - void (* next_line) (pixman_iter_t *iter); - - pixman_image_t * image; - uint32_t * buffer; - int x, y; - int width; -}; - static uint32_t * get_scanline_null (pixman_iter_t *iter, const uint32_t *mask) { @@ -82,26 +64,6 @@ get_scanline_wide (pixman_iter_t *iter, const uint32_t *mask) } static void -next_line_write_narrow (pixman_iter_t *iter) -{ - _pixman_image_store_scanline_32 ( - &iter->image->bits, iter->x, iter->y++, iter->width, iter->buffer); -} - -static void -next_line_write_wide (pixman_iter_t *iter) -{ - _pixman_image_store_scanline_64 ( - &iter->image->bits, iter->x, iter->y++, iter->width, iter->buffer); -} - -static void -next_line_regular (pixman_iter_t *iter) -{ - iter->y++; -} - -static void next_line_noop (pixman_iter_t *iter) { } @@ -124,15 +86,10 @@ iter_init (pixman_implementation_t *imp, iter->get_scanline = get_scanline_null; iter->next_line = next_line_noop; } - else if ((flags & (ITER_NARROW | ITER_WRITE)) == (ITER_NARROW | ITER_WRITE)) - { - iter->get_scanline = get_scanline_narrow; - iter->next_line = next_line_write_narrow; - } - else if (flags & ITER_WRITE) + else if (image->type == BITS) { - iter->get_scanline = get_scanline_wide; - iter->next_line = next_line_write_wide; + _pixman_bits_image_iter_init ( + image, iter, x, y, width, height, buffer, flags); } else { @@ -141,7 +98,7 @@ iter_init (pixman_implementation_t *imp, else iter->get_scanline = get_scanline_wide; - iter->next_line = next_line_regular; + iter->next_line = _pixman_iter_next_line_regular; } } diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 383748ab..5e441fe8 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -193,10 +193,34 @@ union pixman_image solid_fill_t solid; }; +typedef struct pixman_iter_t pixman_iter_t; +typedef enum +{ + ITER_NARROW = (1 << 0), + ITER_WRITE = (1 << 1) +} iter_flags_t; + +struct pixman_iter_t +{ + uint32_t *(* get_scanline) (pixman_iter_t *iter, const uint32_t *mask); + void (* next_line) (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_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, @@ -526,6 +550,8 @@ _pixman_choose_implementation (void); /* * Utilities */ +void +_pixman_iter_next_line_regular (pixman_iter_t *iter); /* These "formats" all have depth 0, so they * will never clash with any real ones diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c index 3ef88b75..630c870d 100644 --- a/pixman/pixman-utils.c +++ b/pixman/pixman-utils.c @@ -167,6 +167,12 @@ pixman_contract (uint32_t * dst, } } +void +_pixman_iter_next_line_regular (pixman_iter_t *iter) +{ + iter->y++; +} + #define N_TMP_BOXES (16) pixman_bool_t |