diff options
Diffstat (limited to 'pixman')
-rw-r--r-- | pixman/pixman/pixman-access.c | 97 | ||||
-rw-r--r-- | pixman/pixman/pixman.c | 6 | ||||
-rw-r--r-- | pixman/pixman/pixman.h | 6 | ||||
-rw-r--r-- | pixman/test/blitters-test.c | 9 | ||||
-rw-r--r-- | pixman/test/composite.c | 17 | ||||
-rw-r--r-- | pixman/test/fetch-test.c | 10 | ||||
-rw-r--r-- | pixman/test/stress-test.c | 2 |
7 files changed, 140 insertions, 7 deletions
diff --git a/pixman/pixman/pixman-access.c b/pixman/pixman/pixman-access.c index 8dc770081..d56dab4b2 100644 --- a/pixman/pixman/pixman-access.c +++ b/pixman/pixman/pixman-access.c @@ -211,6 +211,46 @@ fetch_scanline_b8g8r8x8 (pixman_image_t *image, }
static void
+fetch_scanline_r8g8b8a8 (pixman_image_t *image,
+ int x,
+ int y,
+ int width,
+ uint32_t * buffer,
+ const uint32_t *mask)
+{
+ const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
+ const uint32_t *pixel = (uint32_t *)bits + x;
+ const uint32_t *end = pixel + width;
+
+ while (pixel < end)
+ {
+ uint32_t p = READ (image, pixel++);
+
+ *buffer++ = (((p & 0x000000ff) << 24) | (p >> 8));
+ }
+}
+
+static void
+fetch_scanline_r8g8b8x8 (pixman_image_t *image,
+ int x,
+ int y,
+ int width,
+ uint32_t * buffer,
+ const uint32_t *mask)
+{
+ const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
+ const uint32_t *pixel = (uint32_t *)bits + x;
+ const uint32_t *end = pixel + width;
+
+ while (pixel < end)
+ {
+ uint32_t p = READ (image, pixel++);
+
+ *buffer++ = (0xff000000 | (p >> 8));
+ }
+}
+
+static void
fetch_scanline_x14r6g6b6 (pixman_image_t *image,
int x,
int y,
@@ -1292,6 +1332,28 @@ fetch_pixel_b8g8r8x8 (bits_image_t *image, }
static uint32_t
+fetch_pixel_r8g8b8a8 (bits_image_t *image,
+ int offset,
+ int line)
+{
+ uint32_t *bits = image->bits + line * image->rowstride;
+ uint32_t pixel = READ (image, (uint32_t *)bits + offset);
+
+ return (((pixel & 0x000000ff) << 24) | (pixel >> 8));
+}
+
+static uint32_t
+fetch_pixel_r8g8b8x8 (bits_image_t *image,
+ int offset,
+ int line)
+{
+ uint32_t *bits = image->bits + line * image->rowstride;
+ uint32_t pixel = READ (image, (uint32_t *)bits + offset);
+
+ return (0xff000000 | (pixel >> 8));
+}
+
+static uint32_t
fetch_pixel_x14r6g6b6 (bits_image_t *image,
int offset,
int line)
@@ -2028,6 +2090,39 @@ store_scanline_b8g8r8x8 (bits_image_t * image, }
static void
+store_scanline_r8g8b8a8 (bits_image_t * image,
+ int x,
+ int y,
+ int width,
+ const uint32_t *values)
+{
+ uint32_t *bits = image->bits + image->rowstride * y;
+ uint32_t *pixel = (uint32_t *)bits + x;
+ int i;
+
+ for (i = 0; i < width; ++i)
+ {
+ WRITE (image, pixel++,
+ ((values[i] >> 24) & 0x000000ff) | (values[i] << 8));
+ }
+}
+
+static void
+store_scanline_r8g8b8x8 (bits_image_t * image,
+ int x,
+ int y,
+ int width,
+ const uint32_t *values)
+{
+ uint32_t *bits = image->bits + image->rowstride * y;
+ uint32_t *pixel = (uint32_t *)bits + x;
+ int i;
+
+ for (i = 0; i < width; ++i)
+ WRITE (image, pixel++, (values[i] << 8));
+}
+
+static void
store_scanline_x14r6g6b6 (bits_image_t * image,
int x,
int y,
@@ -2845,6 +2940,8 @@ static const format_info_t accessors[] = FORMAT_INFO (x8b8g8r8),
FORMAT_INFO (b8g8r8a8),
FORMAT_INFO (b8g8r8x8),
+ FORMAT_INFO (r8g8b8a8),
+ FORMAT_INFO (r8g8b8x8),
FORMAT_INFO (x14r6g6b6),
/* 24bpp formats */
diff --git a/pixman/pixman/pixman.c b/pixman/pixman/pixman.c index 8b24849af..b374acc54 100644 --- a/pixman/pixman/pixman.c +++ b/pixman/pixman/pixman.c @@ -873,6 +873,8 @@ color_to_pixel (pixman_color_t * color, format == PIXMAN_x8b8g8r8 ||
format == PIXMAN_b8g8r8a8 ||
format == PIXMAN_b8g8r8x8 ||
+ format == PIXMAN_r8g8b8a8 ||
+ format == PIXMAN_r8g8b8x8 ||
format == PIXMAN_r5g6b5 ||
format == PIXMAN_b5g6r5 ||
format == PIXMAN_a8 ||
@@ -895,6 +897,8 @@ color_to_pixel (pixman_color_t * color, ((c & 0x0000ff00) << 8) |
((c & 0x000000ff) << 24);
}
+ if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_RGBA)
+ c = ((c & 0xff000000) >> 24) | (c << 8);
if (format == PIXMAN_a1)
c = c >> 31;
@@ -1105,6 +1109,8 @@ pixman_format_supported_source (pixman_format_code_t format) case PIXMAN_x8b8g8r8:
case PIXMAN_b8g8r8a8:
case PIXMAN_b8g8r8x8:
+ case PIXMAN_r8g8b8a8:
+ case PIXMAN_r8g8b8x8:
case PIXMAN_r8g8b8:
case PIXMAN_b8g8r8:
case PIXMAN_r5g6b5:
diff --git a/pixman/pixman/pixman.h b/pixman/pixman/pixman.h index 855575a30..691901743 100644 --- a/pixman/pixman/pixman.h +++ b/pixman/pixman/pixman.h @@ -650,11 +650,13 @@ struct pixman_indexed #define PIXMAN_TYPE_YUY2 6
#define PIXMAN_TYPE_YV12 7
#define PIXMAN_TYPE_BGRA 8
+#define PIXMAN_TYPE_RGBA 9
#define PIXMAN_FORMAT_COLOR(f) \
(PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ARGB || \
PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_ABGR || \
- PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA)
+ PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_BGRA || \
+ PIXMAN_FORMAT_TYPE(f) == PIXMAN_TYPE_RGBA)
/* 32bpp formats */
typedef enum {
@@ -664,6 +666,8 @@ typedef enum { PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
PIXMAN_b8g8r8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,8,8,8,8),
PIXMAN_b8g8r8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_BGRA,0,8,8,8),
+ PIXMAN_r8g8b8a8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,8,8,8,8),
+ PIXMAN_r8g8b8x8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_RGBA,0,8,8,8),
PIXMAN_x14r6g6b6 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,6,6,6),
PIXMAN_x2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,10,10,10),
PIXMAN_a2r10g10b10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,2,10,10,10),
diff --git a/pixman/test/blitters-test.c b/pixman/test/blitters-test.c index 5a867f23a..5b9180f66 100644 --- a/pixman/test/blitters-test.c +++ b/pixman/test/blitters-test.c @@ -88,8 +88,11 @@ free_random_image (uint32_t initcrc, uint32_t *data = pixman_image_get_data (img);
uint32_t mask = (1 << PIXMAN_FORMAT_DEPTH (fmt)) - 1;
- if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_BGRA)
+ if (PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_BGRA ||
+ PIXMAN_FORMAT_TYPE (fmt) == PIXMAN_TYPE_RGBA)
+ {
mask <<= (PIXMAN_FORMAT_BPP (fmt) - PIXMAN_FORMAT_DEPTH (fmt));
+ }
for (i = 0; i < 32; i++)
mask |= mask << (i * PIXMAN_FORMAT_BPP (fmt));
@@ -182,6 +185,8 @@ static pixman_format_code_t img_fmt_list[] = { PIXMAN_x8b8g8r8,
PIXMAN_b8g8r8a8,
PIXMAN_b8g8r8x8,
+ PIXMAN_r8g8b8a8,
+ PIXMAN_r8g8b8x8,
PIXMAN_x14r6g6b6,
PIXMAN_r8g8b8,
PIXMAN_b8g8r8,
@@ -412,6 +417,6 @@ main (int argc, const char *argv[]) }
return fuzzer_test_main("blitters", 2000000,
- 0x1DB8BDF8,
+ 0x265CDFEB,
test_composite, argc, argv);
}
diff --git a/pixman/test/composite.c b/pixman/test/composite.c index 5e486708d..ea10f8a6e 100644 --- a/pixman/test/composite.c +++ b/pixman/test/composite.c @@ -102,6 +102,8 @@ static const format_t formats[] = P(x8b8g8r8),
P(b8g8r8a8),
P(b8g8r8x8),
+ P(r8g8b8a8),
+ P(r8g8b8x8),
P(x2r10g10b10),
P(x2b10g10r10),
P(a2r10g10b10),
@@ -556,6 +558,13 @@ get_pixel (pixman_image_t *image, bs = g + gs;
break;
+ case PIXMAN_TYPE_RGBA:
+ as = 0;
+ bs = PIXMAN_FORMAT_BPP (format) - (b + g + r);
+ gs = b + bs;
+ rs = g + gs;
+ break;
+
case PIXMAN_TYPE_A:
as = 0;
rs = 0;
@@ -900,13 +909,13 @@ main (int argc, char **argv) #ifdef USE_OPENMP
# pragma omp parallel for default(none) shared(result, argv, seed)
#endif
- for (i = seed; i <= N_TESTS; ++i)
+ for (i = 0; i <= N_TESTS; ++i)
{
- if (!result && !run_test (i))
+ if (!result && !run_test (i + seed))
{
- printf ("Test 0x%08X failed.\n", i);
+ printf ("Test 0x%08X failed.\n", seed + i);
- result = i;
+ result = seed + i;
}
}
diff --git a/pixman/test/fetch-test.c b/pixman/test/fetch-test.c index 4554f9f9b..cbb1ee63e 100644 --- a/pixman/test/fetch-test.c +++ b/pixman/test/fetch-test.c @@ -34,6 +34,16 @@ static testcase_t testcases[] = NULL,
},
{
+ PIXMAN_r8g8b8a8,
+ 2, 2,
+ 8,
+ { 0x11223300, 0x55667744,
+ 0x99aabb88, 0xddeeffcc },
+ { 0x00112233, 0x44556677,
+ 0x8899aabb, 0xccddeeff },
+ NULL,
+ },
+ {
PIXMAN_g1,
8, 2,
4,
diff --git a/pixman/test/stress-test.c b/pixman/test/stress-test.c index c694bde8c..92b5f0bca 100644 --- a/pixman/test/stress-test.c +++ b/pixman/test/stress-test.c @@ -19,6 +19,8 @@ static const pixman_format_code_t image_formats[] = PIXMAN_x8b8g8r8,
PIXMAN_b8g8r8a8,
PIXMAN_b8g8r8x8,
+ PIXMAN_r8g8b8a8,
+ PIXMAN_r8g8b8x8,
PIXMAN_x14r6g6b6,
PIXMAN_r8g8b8,
PIXMAN_b8g8r8,
|