diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-03-13 12:55:42 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2011-04-21 17:13:29 -0400 |
commit | 67c24bdc4529db6cb1d0f3fbede0d6d018087915 (patch) | |
tree | 7f77e5361750580709a770eb9dfc6d04a456599d | |
parent | ee0c659855dbeda744662c9f7a323f631f02063b (diff) |
Add x16r16g16b16 and don't support accessors for 64bpp formats64bpp
-rw-r--r-- | pixman/pixman-access.c | 57 | ||||
-rw-r--r-- | pixman/pixman-image.c | 7 | ||||
-rw-r--r-- | pixman/pixman.c | 1 | ||||
-rw-r--r-- | pixman/pixman.h | 1 | ||||
-rw-r--r-- | test/composite.c | 1 |
5 files changed, 62 insertions, 5 deletions
diff --git a/pixman/pixman-access.c b/pixman/pixman-access.c index 655723af..3373ee27 100644 --- a/pixman/pixman-access.c +++ b/pixman/pixman-access.c @@ -287,7 +287,27 @@ fetch_scanline_a16r16g16b16 (pixman_image_t *image, uint64_t *bits = (uint64_t *)image->bits.bits; int stride = image->bits.rowstride / 2; - MEMCPY_WRAPPED (image, b, bits + y * stride + x, width * sizeof (uint64_t)); + /* Note: accessors are not supported for images with bpp > 32 */ + memcpy (b, bits + y * stride + x, width * sizeof (uint64_t)); +} + +/* Expects a uint64_t buffer */ +static void +fetch_scanline_x16r16g16b16 (pixman_image_t *image, + int x, + int y, + int width, + uint32_t * b, + const uint32_t *mask) +{ + uint64_t *bits = (uint64_t *)image->bits.bits; + uint64_t *buffer = (uint64_t *)b; + int stride = image->bits.rowstride / 2; + int i; + + /* Note: accessors are not supported for images with bpp > 32 */ + for (i = 0; i < width; ++i) + buffer[i] = *(bits + y * stride + x) | 0xffff000000000000ULL; } /* Expects a uint64_t buffer */ @@ -1192,9 +1212,22 @@ fetch_pixel_a16r16g16b16 (bits_image_t *image, uint64_t *bits = (uint64_t *)image->bits; int stride = image->rowstride / 2; + /* Accessors are not support for images with bpp > 32 */ return *(bits + line * stride + offset); } +/* Expects a uint64_t buffer */ +static uint64_t +fetch_pixel_x16r16g16b16 (bits_image_t *image, + int offset, + int line) +{ + uint64_t *bits = (uint64_t *)image->bits; + int stride = image->rowstride / 2; + + return *(bits + line * stride + offset) | 0xffff000000000000ULL; +} + static uint64_t fetch_pixel_a2r10g10b10 (bits_image_t *image, int offset, @@ -2020,7 +2053,7 @@ store_scanline_a8r8g8b8 (bits_image_t * image, static void store_scanline_x8r8g8b8 (bits_image_t * image, - int x, + int x, int y, int width, const uint32_t *values) @@ -2540,7 +2573,20 @@ store_scanline_a16r16g16b16 (bits_image_t *image, uint64_t *bits = (uint64_t *)image->bits; int stride = image->rowstride / 2; - MEMCPY_WRAPPED (image, bits + y * stride + x, values, width * sizeof (uint64_t)); + memcpy (bits + y * stride + x, values, width * sizeof (uint64_t)); +} + +static void +store_scanline_x16r16g16b16 (bits_image_t *image, + int x, + int y, + int width, + const uint32_t *values) +{ + uint64_t *bits = (uint64_t *)image->bits; + int stride = image->rowstride / 2; + + memcpy (bits + y * stride + x, values, width * sizeof (uint64_t)); } static void @@ -3048,6 +3094,11 @@ static const format_info_t accessors[] = fetch_pixel_generic_lossy_32, fetch_pixel_a16r16g16b16, NULL, store_scanline_a16r16g16b16 }, + { PIXMAN_x16r16g16b16, + NULL, fetch_scanline_x16r16g16b16, + fetch_pixel_generic_lossy_32, fetch_pixel_x16r16g16b16, + NULL, store_scanline_x16r16g16b16 }, + { PIXMAN_a2r10g10b10, NULL, fetch_scanline_a2r10g10b10, fetch_pixel_generic_lossy_32, fetch_pixel_a2r10g10b10, diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index 84bacf87..2f88414d 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -690,8 +690,11 @@ pixman_image_set_accessors (pixman_image_t * image, pixman_write_memory_func_t write_func) { return_if_fail (image != NULL); - - if (image->type == BITS) + + /* Accessors return uint32_t, so they can't be used with + * pixels wider than that. + */ + if (image->type == BITS && PIXMAN_FORMAT_BPP (image->bits.format <= 32)) { image->bits.read_func = read_func; image->bits.write_func = write_func; diff --git a/pixman/pixman.c b/pixman/pixman.c index 5668101c..9a6bbaea 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -1098,6 +1098,7 @@ pixman_format_supported_source (pixman_format_code_t format) { /* 64 bpp formats */ case PIXMAN_a16r16g16b16: + case PIXMAN_x16r16g16b16: /* 32 bpp formats */ case PIXMAN_a2b10g10r10: case PIXMAN_x2b10g10r10: diff --git a/pixman/pixman.h b/pixman/pixman.h index 1a133eaf..d36dfc84 100644 --- a/pixman/pixman.h +++ b/pixman/pixman.h @@ -666,6 +666,7 @@ struct pixman_indexed typedef enum { /* 64bpp formats */ PIXMAN_a16r16g16b16 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_w,8,8,8,8), + PIXMAN_x16r16g16b16 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB_w,0,8,8,8), /* 32bpp formats */ PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8), diff --git a/test/composite.c b/test/composite.c index a55c32d4..33504135 100644 --- a/test/composite.c +++ b/test/composite.c @@ -97,6 +97,7 @@ static const format_t formats[] = /* 64 bpp formats */ P(a16r16g16b16), + P(x16r16g16b16), /* 32 bpp formats */ P(a8r8g8b8), |