aboutsummaryrefslogtreecommitdiff
path: root/pixman/test
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-01-24 08:36:10 +0100
committermarha <marha@users.sourceforge.net>2013-01-24 08:36:10 +0100
commit06872e284da1c00ce03b234ca24aefeac64990d2 (patch)
treee1e8bee8a20f7b759b50edfc21d2313489280d10 /pixman/test
parent470f7ca9f0be348faf2f03fc16811844c5eeffce (diff)
downloadvcxsrv-06872e284da1c00ce03b234ca24aefeac64990d2.tar.gz
vcxsrv-06872e284da1c00ce03b234ca24aefeac64990d2.tar.bz2
vcxsrv-06872e284da1c00ce03b234ca24aefeac64990d2.zip
fontconfig mesa pixman xkbcomp xserver git update 24 jan 2013
fontconfig: fb3b410998aba8835999e2ca7003a180431cfaf4 mesa: 5bd86b26df30d32412ca1b7ac02892ab5e10c6ef pixman: b527a0e615a726aa6a7d18f0ea0b38564b153afa xkbcomp: 705b9bbb426410f9510601c7010da51184919b36 xserver: 7fe5e6dfa5c1e71d8b7540b28c1d508687a2fbee
Diffstat (limited to 'pixman/test')
-rw-r--r--pixman/test/Makefile.am2
-rw-r--r--pixman/test/affine-test.c6
-rw-r--r--pixman/test/alphamap.c19
-rw-r--r--pixman/test/blitters-test.c6
-rw-r--r--pixman/test/composite.c221
-rw-r--r--pixman/test/scaling-test.c7
-rw-r--r--pixman/test/utils.c162
-rw-r--r--pixman/test/utils.h6
8 files changed, 281 insertions, 148 deletions
diff --git a/pixman/test/Makefile.am b/pixman/test/Makefile.am
index eeb3679f0..ca87f4ef4 100644
--- a/pixman/test/Makefile.am
+++ b/pixman/test/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/test/Makefile.sources
AM_CFLAGS = $(OPENMP_CFLAGS)
AM_LDFLAGS = $(OPENMP_CFLAGS) $(TESTPROGS_EXTRA_LDFLAGS)
LDADD = libutils.la $(top_builddir)/pixman/libpixman-1.la -lm $(PNG_LIBS)
-INCLUDES = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(PNG_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(PNG_CFLAGS)
libutils_la_SOURCES = $(libutils_sources) $(libutils_headers)
diff --git a/pixman/test/affine-test.c b/pixman/test/affine-test.c
index f60ec14eb..678fbe844 100644
--- a/pixman/test/affine-test.c
+++ b/pixman/test/affine-test.c
@@ -200,9 +200,9 @@ test_composite (int testnum,
#define M(r,c) \
transform.matrix[r][c]
- printf ("src_fmt=%08X, dst_fmt=%08X\n", src_fmt, dst_fmt);
- printf ("op=%d, repeat=%d, transform=\n",
- op, repeat);
+ printf ("src_fmt=%s, dst_fmt=%s\n", format_name (src_fmt), format_name (dst_fmt));
+ printf ("op=%s, repeat=%d, transform=\n",
+ operator_name (op), repeat);
printf (" { { { 0x%08x, 0x%08x, 0x%08x },\n"
" { 0x%08x, 0x%08x, 0x%08x },\n"
" { 0x%08x, 0x%08x, 0x%08x },\n"
diff --git a/pixman/test/alphamap.c b/pixman/test/alphamap.c
index 1a6fca55a..4d09076fb 100644
--- a/pixman/test/alphamap.c
+++ b/pixman/test/alphamap.c
@@ -26,25 +26,6 @@ static const int origins[] =
0, 10, -100
};
-static const char *
-format_name (pixman_format_code_t format)
-{
- if (format == PIXMAN_a8)
- return "a8";
- else if (format == PIXMAN_a2r10g10b10)
- return "a2r10g10b10";
- else if (format == PIXMAN_a8r8g8b8)
- return "a8r8g8b8";
- else if (format == PIXMAN_a4r4g4b4)
- return "a4r4g4b4";
- else if (format == PIXMAN_null)
- return "none";
- else
- assert (0);
-
- return "<unknown - bug in alphamap.c>";
-}
-
static void
on_destroy (pixman_image_t *image, void *data)
{
diff --git a/pixman/test/blitters-test.c b/pixman/test/blitters-test.c
index 9bde99c62..8766fa800 100644
--- a/pixman/test/blitters-test.c
+++ b/pixman/test/blitters-test.c
@@ -329,8 +329,10 @@ test_composite (int testnum, int verbose)
if (verbose)
{
- printf ("op=%d, src_fmt=%08X, dst_fmt=%08X, mask_fmt=%08X\n",
- op, src_fmt, dst_fmt, mask_fmt);
+ printf ("op=%s\n", operator_name (op));
+ printf ("src_fmt=%s, dst_fmt=%s, mask_fmt=%s\n",
+ format_name (src_fmt), format_name (dst_fmt),
+ format_name (mask_fmt));
printf ("src_width=%d, src_height=%d, dst_width=%d, dst_height=%d\n",
src_width, src_height, dst_width, dst_height);
printf ("src_x=%d, src_y=%d, dst_x=%d, dst_y=%d\n",
diff --git a/pixman/test/composite.c b/pixman/test/composite.c
index 09752c5c7..b107b1106 100644
--- a/pixman/test/composite.c
+++ b/pixman/test/composite.c
@@ -28,15 +28,7 @@
#include <time.h>
#include "utils.h"
-typedef struct format_t format_t;
typedef struct image_t image_t;
-typedef struct operator_t operator_t;
-
-struct format_t
-{
- pixman_format_code_t format;
- const char *name;
-};
static const color_t colors[] =
{
@@ -82,122 +74,111 @@ static const int sizes[] =
10
};
-static const format_t formats[] =
+static const pixman_format_code_t formats[] =
{
-#define P(x) { PIXMAN_##x, #x }
-
/* 32 bpp formats */
- P(a8r8g8b8),
- P(x8r8g8b8),
- P(a8b8g8r8),
- P(x8b8g8r8),
- P(b8g8r8a8),
- P(b8g8r8x8),
- P(r8g8b8a8),
- P(r8g8b8x8),
- P(x2r10g10b10),
- P(x2b10g10r10),
- P(a2r10g10b10),
- P(a2b10g10r10),
+ PIXMAN_a8r8g8b8,
+ PIXMAN_x8r8g8b8,
+ PIXMAN_a8b8g8r8,
+ PIXMAN_x8b8g8r8,
+ PIXMAN_b8g8r8a8,
+ PIXMAN_b8g8r8x8,
+ PIXMAN_r8g8b8a8,
+ PIXMAN_r8g8b8x8,
+ PIXMAN_x2r10g10b10,
+ PIXMAN_x2b10g10r10,
+ PIXMAN_a2r10g10b10,
+ PIXMAN_a2b10g10r10,
/* sRGB formats */
- P(a8r8g8b8_sRGB),
+ PIXMAN_a8r8g8b8_sRGB,
/* 24 bpp formats */
- P(r8g8b8),
- P(b8g8r8),
- P(r5g6b5),
- P(b5g6r5),
+ PIXMAN_r8g8b8,
+ PIXMAN_b8g8r8,
+ PIXMAN_r5g6b5,
+ PIXMAN_b5g6r5,
/* 16 bpp formats */
- P(x1r5g5b5),
- P(x1b5g5r5),
- P(a1r5g5b5),
- P(a1b5g5r5),
- P(a4b4g4r4),
- P(x4b4g4r4),
- P(a4r4g4b4),
- P(x4r4g4b4),
+ PIXMAN_x1r5g5b5,
+ PIXMAN_x1b5g5r5,
+ PIXMAN_a1r5g5b5,
+ PIXMAN_a1b5g5r5,
+ PIXMAN_a4b4g4r4,
+ PIXMAN_x4b4g4r4,
+ PIXMAN_a4r4g4b4,
+ PIXMAN_x4r4g4b4,
/* 8 bpp formats */
- P(a8),
- P(r3g3b2),
- P(b2g3r3),
- P(a2r2g2b2),
- P(a2b2g2r2),
- P(x4a4),
+ PIXMAN_a8,
+ PIXMAN_r3g3b2,
+ PIXMAN_b2g3r3,
+ PIXMAN_a2r2g2b2,
+ PIXMAN_a2b2g2r2,
+ PIXMAN_x4a4,
/* 4 bpp formats */
- P(a4),
- P(r1g2b1),
- P(b1g2r1),
- P(a1r1g1b1),
- P(a1b1g1r1),
+ PIXMAN_a4,
+ PIXMAN_r1g2b1,
+ PIXMAN_b1g2r1,
+ PIXMAN_a1r1g1b1,
+ PIXMAN_a1b1g1r1,
/* 1 bpp formats */
- P(a1)
-#undef P
+ PIXMAN_a1,
};
struct image_t
{
pixman_image_t *image;
- const format_t *format;
+ pixman_format_code_t format;
const color_t *color;
pixman_repeat_t repeat;
int size;
};
-struct operator_t
+static const pixman_op_t operators[] =
{
- pixman_op_t op;
- const char *name;
-};
-
-static const operator_t operators[] =
-{
-#define P(x) { PIXMAN_OP_##x, #x }
- P(CLEAR),
- P(SRC),
- P(DST),
- P(OVER),
- P(OVER_REVERSE),
- P(IN),
- P(IN_REVERSE),
- P(OUT),
- P(OUT_REVERSE),
- P(ATOP),
- P(ATOP_REVERSE),
- P(XOR),
- P(ADD),
- P(SATURATE),
-
- P(DISJOINT_CLEAR),
- P(DISJOINT_SRC),
- P(DISJOINT_DST),
- P(DISJOINT_OVER),
- P(DISJOINT_OVER_REVERSE),
- P(DISJOINT_IN),
- P(DISJOINT_IN_REVERSE),
- P(DISJOINT_OUT),
- P(DISJOINT_OUT_REVERSE),
- P(DISJOINT_ATOP),
- P(DISJOINT_ATOP_REVERSE),
- P(DISJOINT_XOR),
-
- P(CONJOINT_CLEAR),
- P(CONJOINT_SRC),
- P(CONJOINT_DST),
- P(CONJOINT_OVER),
- P(CONJOINT_OVER_REVERSE),
- P(CONJOINT_IN),
- P(CONJOINT_IN_REVERSE),
- P(CONJOINT_OUT),
- P(CONJOINT_OUT_REVERSE),
- P(CONJOINT_ATOP),
- P(CONJOINT_ATOP_REVERSE),
- P(CONJOINT_XOR),
-#undef P
+ PIXMAN_OP_CLEAR,
+ PIXMAN_OP_SRC,
+ PIXMAN_OP_DST,
+ PIXMAN_OP_OVER,
+ PIXMAN_OP_OVER_REVERSE,
+ PIXMAN_OP_IN,
+ PIXMAN_OP_IN_REVERSE,
+ PIXMAN_OP_OUT,
+ PIXMAN_OP_OUT_REVERSE,
+ PIXMAN_OP_ATOP,
+ PIXMAN_OP_ATOP_REVERSE,
+ PIXMAN_OP_XOR,
+ PIXMAN_OP_ADD,
+ PIXMAN_OP_SATURATE,
+
+ PIXMAN_OP_DISJOINT_CLEAR,
+ PIXMAN_OP_DISJOINT_SRC,
+ PIXMAN_OP_DISJOINT_DST,
+ PIXMAN_OP_DISJOINT_OVER,
+ PIXMAN_OP_DISJOINT_OVER_REVERSE,
+ PIXMAN_OP_DISJOINT_IN,
+ PIXMAN_OP_DISJOINT_IN_REVERSE,
+ PIXMAN_OP_DISJOINT_OUT,
+ PIXMAN_OP_DISJOINT_OUT_REVERSE,
+ PIXMAN_OP_DISJOINT_ATOP,
+ PIXMAN_OP_DISJOINT_ATOP_REVERSE,
+ PIXMAN_OP_DISJOINT_XOR,
+
+ PIXMAN_OP_CONJOINT_CLEAR,
+ PIXMAN_OP_CONJOINT_SRC,
+ PIXMAN_OP_CONJOINT_DST,
+ PIXMAN_OP_CONJOINT_OVER,
+ PIXMAN_OP_CONJOINT_OVER_REVERSE,
+ PIXMAN_OP_CONJOINT_IN,
+ PIXMAN_OP_CONJOINT_IN_REVERSE,
+ PIXMAN_OP_CONJOINT_OUT,
+ PIXMAN_OP_CONJOINT_OUT_REVERSE,
+ PIXMAN_OP_CONJOINT_ATOP,
+ PIXMAN_OP_CONJOINT_ATOP_REVERSE,
+ PIXMAN_OP_CONJOINT_XOR,
};
static double
@@ -498,7 +479,7 @@ describe_image (image_t *info, char *buf)
if (info->size)
{
sprintf (buf, "%s, %dx%d%s",
- info->format->name,
+ format_name (info->format),
info->size, info->size,
info->repeat ? " R" :"");
}
@@ -521,7 +502,7 @@ describe_color (const color_t *color, char *buf)
static pixman_bool_t
composite_test (image_t *dst,
- const operator_t *op,
+ pixman_op_t op,
image_t *src,
image_t *mask,
pixman_bool_t component_alpha,
@@ -534,12 +515,12 @@ composite_test (image_t *dst,
{
pixman_image_set_component_alpha (mask->image, component_alpha);
- pixman_image_composite (op->op, src->image, mask->image, dst->image,
+ pixman_image_composite (op, src->image, mask->image, dst->image,
0, 0, 0, 0, 0, 0, dst->size, dst->size);
}
else
{
- pixman_image_composite (op->op, src->image, NULL, dst->image,
+ pixman_image_composite (op, src->image, NULL, dst->image,
0, 0,
0, 0,
0, 0,
@@ -561,43 +542,43 @@ composite_test (image_t *dst,
*/
if (src->size)
{
- if (PIXMAN_FORMAT_TYPE (src->format->format) == PIXMAN_TYPE_ARGB_SRGB)
+ if (PIXMAN_FORMAT_TYPE (src->format) == PIXMAN_TYPE_ARGB_SRGB)
{
tsrc.r = convert_linear_to_srgb (tsrc.r);
tsrc.g = convert_linear_to_srgb (tsrc.g);
tsrc.b = convert_linear_to_srgb (tsrc.b);
- round_color (src->format->format, &tsrc);
+ round_color (src->format, &tsrc);
tsrc.r = convert_srgb_to_linear (tsrc.r);
tsrc.g = convert_srgb_to_linear (tsrc.g);
tsrc.b = convert_srgb_to_linear (tsrc.b);
}
else
{
- round_color (src->format->format, &tsrc);
+ round_color (src->format, &tsrc);
}
}
if (mask && mask->size)
{
- if (PIXMAN_FORMAT_TYPE (mask->format->format) == PIXMAN_TYPE_ARGB_SRGB)
+ if (PIXMAN_FORMAT_TYPE (mask->format) == PIXMAN_TYPE_ARGB_SRGB)
{
tmsk.r = convert_linear_to_srgb (tmsk.r);
tmsk.g = convert_linear_to_srgb (tmsk.g);
tmsk.b = convert_linear_to_srgb (tmsk.b);
- round_color (mask->format->format, &tmsk);
+ round_color (mask->format, &tmsk);
tmsk.r = convert_srgb_to_linear (tmsk.r);
tmsk.g = convert_srgb_to_linear (tmsk.g);
tmsk.b = convert_srgb_to_linear (tmsk.b);
}
else
{
- round_color (mask->format->format, &tmsk);
+ round_color (mask->format, &tmsk);
}
}
if (mask)
{
- if (component_alpha && PIXMAN_FORMAT_R (mask->format->format) == 0)
+ if (component_alpha && PIXMAN_FORMAT_R (mask->format) == 0)
{
/* Ax component-alpha masks expand alpha into
* all color channels.
@@ -606,29 +587,29 @@ composite_test (image_t *dst,
}
}
- if (PIXMAN_FORMAT_TYPE (dst->format->format) == PIXMAN_TYPE_ARGB_SRGB)
+ if (PIXMAN_FORMAT_TYPE (dst->format) == PIXMAN_TYPE_ARGB_SRGB)
{
tdst.r = convert_linear_to_srgb (tdst.r);
tdst.g = convert_linear_to_srgb (tdst.g);
tdst.b = convert_linear_to_srgb (tdst.b);
- round_color (dst->format->format, &tdst);
+ round_color (dst->format, &tdst);
tdst.r = convert_srgb_to_linear (tdst.r);
tdst.g = convert_srgb_to_linear (tdst.g);
tdst.b = convert_srgb_to_linear (tdst.b);
}
else
{
- round_color (dst->format->format, &tdst);
+ round_color (dst->format, &tdst);
}
- do_composite (op->op,
+ do_composite (op,
&tsrc,
mask? &tmsk : NULL,
&tdst,
&expected,
component_alpha);
- pixel_checker_init (&checker, dst->format->format);
+ pixel_checker_init (&checker, dst->format);
if (!pixel_checker_check (&checker, get_value (dst->image), &expected))
{
@@ -638,7 +619,7 @@ composite_test (image_t *dst,
printf ("---- Test %d failed ----\n", testno);
printf ("Operator: %s %s\n",
- op->name, component_alpha ? "CA" : "");
+ operator_name (op), component_alpha ? "CA" : "");
printf ("Source: %s\n", describe_image (src, buf));
if (mask != NULL)
@@ -687,7 +668,7 @@ image_init (image_t *info,
info->color = &colors[color];
compute_pixman_color (info->color, &fill);
- info->format = &formats[format];
+ info->format = formats[format];
info->size = sizes[size] & ~FLAGS;
info->repeat = PIXMAN_REPEAT_NONE;
@@ -695,7 +676,7 @@ image_init (image_t *info,
{
pixman_image_t *solid;
- info->image = pixman_image_create_bits (info->format->format,
+ info->image = pixman_image_create_bits (info->format,
info->size, info->size,
NULL, 0);
@@ -744,7 +725,7 @@ static pixman_bool_t
run_test (uint32_t seed)
{
image_t src, mask, dst;
- const operator_t *op;
+ pixman_op_t op;
int ca;
int ok;
@@ -754,7 +735,7 @@ run_test (uint32_t seed)
image_init (&src, random_color(), random_format(), random_size());
image_init (&mask, random_color(), random_format(), random_size());
- op = &(operators [prng_rand_n (ARRAY_LENGTH (operators))]);
+ op = operators [prng_rand_n (ARRAY_LENGTH (operators))];
ca = prng_rand_n (3);
diff --git a/pixman/test/scaling-test.c b/pixman/test/scaling-test.c
index 64c12dd7c..a8cb4c47b 100644
--- a/pixman/test/scaling-test.c
+++ b/pixman/test/scaling-test.c
@@ -239,9 +239,10 @@ test_composite (int testnum,
if (verbose)
{
- printf ("src_fmt=%08X, dst_fmt=%08X\n", src_fmt, dst_fmt);
- printf ("op=%d, scale_x=%d, scale_y=%d, repeat=%d\n",
- op, scale_x, scale_y, repeat);
+ printf ("src_fmt=%s, dst_fmt=%s\n",
+ format_name (src_fmt), format_name (dst_fmt));
+ printf ("op=%s, scale_x=%d, scale_y=%d, repeat=%d\n",
+ operator_name (op), scale_x, scale_y, repeat);
printf ("translate_x=%d, translate_y=%d\n",
translate_x, translate_y);
printf ("src_width=%d, src_height=%d, dst_width=%d, dst_height=%d\n",
diff --git a/pixman/test/utils.c b/pixman/test/utils.c
index 08eaabbf6..ba7e35335 100644
--- a/pixman/test/utils.c
+++ b/pixman/test/utils.c
@@ -870,6 +870,168 @@ initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb)
}
}
+const char *
+operator_name (pixman_op_t op)
+{
+ switch (op)
+ {
+ case PIXMAN_OP_CLEAR: return "PIXMAN_OP_CLEAR";
+ case PIXMAN_OP_SRC: return "PIXMAN_OP_SRC";
+ case PIXMAN_OP_DST: return "PIXMAN_OP_DST";
+ case PIXMAN_OP_OVER: return "PIXMAN_OP_OVER";
+ case PIXMAN_OP_OVER_REVERSE: return "PIXMAN_OP_OVER_REVERSE";
+ case PIXMAN_OP_IN: return "PIXMAN_OP_IN";
+ case PIXMAN_OP_IN_REVERSE: return "PIXMAN_OP_IN_REVERSE";
+ case PIXMAN_OP_OUT: return "PIXMAN_OP_OUT";
+ case PIXMAN_OP_OUT_REVERSE: return "PIXMAN_OP_OUT_REVERSE";
+ case PIXMAN_OP_ATOP: return "PIXMAN_OP_ATOP";
+ case PIXMAN_OP_ATOP_REVERSE: return "PIXMAN_OP_ATOP_REVERSE";
+ case PIXMAN_OP_XOR: return "PIXMAN_OP_XOR";
+ case PIXMAN_OP_ADD: return "PIXMAN_OP_ADD";
+ case PIXMAN_OP_SATURATE: return "PIXMAN_OP_SATURATE";
+
+ case PIXMAN_OP_DISJOINT_CLEAR: return "PIXMAN_OP_DISJOINT_CLEAR";
+ case PIXMAN_OP_DISJOINT_SRC: return "PIXMAN_OP_DISJOINT_SRC";
+ case PIXMAN_OP_DISJOINT_DST: return "PIXMAN_OP_DISJOINT_DST";
+ case PIXMAN_OP_DISJOINT_OVER: return "PIXMAN_OP_DISJOINT_OVER";
+ case PIXMAN_OP_DISJOINT_OVER_REVERSE: return "PIXMAN_OP_DISJOINT_OVER_REVERSE";
+ case PIXMAN_OP_DISJOINT_IN: return "PIXMAN_OP_DISJOINT_IN";
+ case PIXMAN_OP_DISJOINT_IN_REVERSE: return "PIXMAN_OP_DISJOINT_IN_REVERSE";
+ case PIXMAN_OP_DISJOINT_OUT: return "PIXMAN_OP_DISJOINT_OUT";
+ case PIXMAN_OP_DISJOINT_OUT_REVERSE: return "PIXMAN_OP_DISJOINT_OUT_REVERSE";
+ case PIXMAN_OP_DISJOINT_ATOP: return "PIXMAN_OP_DISJOINT_ATOP";
+ case PIXMAN_OP_DISJOINT_ATOP_REVERSE: return "PIXMAN_OP_DISJOINT_ATOP_REVERSE";
+ case PIXMAN_OP_DISJOINT_XOR: return "PIXMAN_OP_DISJOINT_XOR";
+
+ case PIXMAN_OP_CONJOINT_CLEAR: return "PIXMAN_OP_CONJOINT_CLEAR";
+ case PIXMAN_OP_CONJOINT_SRC: return "PIXMAN_OP_CONJOINT_SRC";
+ case PIXMAN_OP_CONJOINT_DST: return "PIXMAN_OP_CONJOINT_DST";
+ case PIXMAN_OP_CONJOINT_OVER: return "PIXMAN_OP_CONJOINT_OVER";
+ case PIXMAN_OP_CONJOINT_OVER_REVERSE: return "PIXMAN_OP_CONJOINT_OVER_REVERSE";
+ case PIXMAN_OP_CONJOINT_IN: return "PIXMAN_OP_CONJOINT_IN";
+ case PIXMAN_OP_CONJOINT_IN_REVERSE: return "PIXMAN_OP_CONJOINT_IN_REVERSE";
+ case PIXMAN_OP_CONJOINT_OUT: return "PIXMAN_OP_CONJOINT_OUT";
+ case PIXMAN_OP_CONJOINT_OUT_REVERSE: return "PIXMAN_OP_CONJOINT_OUT_REVERSE";
+ case PIXMAN_OP_CONJOINT_ATOP: return "PIXMAN_OP_CONJOINT_ATOP";
+ case PIXMAN_OP_CONJOINT_ATOP_REVERSE: return "PIXMAN_OP_CONJOINT_ATOP_REVERSE";
+ case PIXMAN_OP_CONJOINT_XOR: return "PIXMAN_OP_CONJOINT_XOR";
+
+ case PIXMAN_OP_MULTIPLY: return "PIXMAN_OP_MULTIPLY";
+ case PIXMAN_OP_SCREEN: return "PIXMAN_OP_SCREEN";
+ case PIXMAN_OP_OVERLAY: return "PIXMAN_OP_OVERLAY";
+ case PIXMAN_OP_DARKEN: return "PIXMAN_OP_DARKEN";
+ case PIXMAN_OP_LIGHTEN: return "PIXMAN_OP_LIGHTEN";
+ case PIXMAN_OP_COLOR_DODGE: return "PIXMAN_OP_COLOR_DODGE";
+ case PIXMAN_OP_COLOR_BURN: return "PIXMAN_OP_COLOR_BURN";
+ case PIXMAN_OP_HARD_LIGHT: return "PIXMAN_OP_HARD_LIGHT";
+ case PIXMAN_OP_SOFT_LIGHT: return "PIXMAN_OP_SOFT_LIGHT";
+ case PIXMAN_OP_DIFFERENCE: return "PIXMAN_OP_DIFFERENCE";
+ case PIXMAN_OP_EXCLUSION: return "PIXMAN_OP_EXCLUSION";
+ case PIXMAN_OP_HSL_HUE: return "PIXMAN_OP_HSL_HUE";
+ case PIXMAN_OP_HSL_SATURATION: return "PIXMAN_OP_HSL_SATURATION";
+ case PIXMAN_OP_HSL_COLOR: return "PIXMAN_OP_HSL_COLOR";
+ case PIXMAN_OP_HSL_LUMINOSITY: return "PIXMAN_OP_HSL_LUMINOSITY";
+
+ case PIXMAN_OP_NONE:
+ return "<invalid operator 'none'>";
+ };
+
+ return "<unknown operator>";
+}
+
+const char *
+format_name (pixman_format_code_t format)
+{
+ switch (format)
+ {
+/* 32bpp formats */
+ case PIXMAN_a8r8g8b8: return "a8r8g8b8";
+ case PIXMAN_x8r8g8b8: return "x8r8g8b8";
+ case PIXMAN_a8b8g8r8: return "a8b8g8r8";
+ case PIXMAN_x8b8g8r8: return "x8b8g8r8";
+ case PIXMAN_b8g8r8a8: return "b8g8r8a8";
+ case PIXMAN_b8g8r8x8: return "b8g8r8x8";
+ case PIXMAN_r8g8b8a8: return "r8g8b8a8";
+ case PIXMAN_r8g8b8x8: return "r8g8b8x8";
+ case PIXMAN_x14r6g6b6: return "x14r6g6b6";
+ case PIXMAN_x2r10g10b10: return "x2r10g10b10";
+ case PIXMAN_a2r10g10b10: return "a2r10g10b10";
+ case PIXMAN_x2b10g10r10: return "x2b10g10r10";
+ case PIXMAN_a2b10g10r10: return "a2b10g10r10";
+
+/* sRGB formats */
+ case PIXMAN_a8r8g8b8_sRGB: return "a8r8g8b8_sRGB";
+
+/* 24bpp formats */
+ case PIXMAN_r8g8b8: return "r8g8b8";
+ case PIXMAN_b8g8r8: return "b8g8r8";
+
+/* 16bpp formats */
+ case PIXMAN_r5g6b5: return "r5g6b5";
+ case PIXMAN_b5g6r5: return "b5g6r5";
+
+ case PIXMAN_a1r5g5b5: return "a1r5g5b5";
+ case PIXMAN_x1r5g5b5: return "x1r5g5b5";
+ case PIXMAN_a1b5g5r5: return "a1b5g5r5";
+ case PIXMAN_x1b5g5r5: return "x1b5g5r5";
+ case PIXMAN_a4r4g4b4: return "a4r4g4b4";
+ case PIXMAN_x4r4g4b4: return "x4r4g4b4";
+ case PIXMAN_a4b4g4r4: return "a4b4g4r4";
+ case PIXMAN_x4b4g4r4: return "x4b4g4r4";
+
+/* 8bpp formats */
+ case PIXMAN_a8: return "a8";
+ case PIXMAN_r3g3b2: return "r3g3b2";
+ case PIXMAN_b2g3r3: return "b2g3r3";
+ case PIXMAN_a2r2g2b2: return "a2r2g2b2";
+ case PIXMAN_a2b2g2r2: return "a2b2g2r2";
+
+#if 0
+ case PIXMAN_x4c4: return "x4c4";
+ case PIXMAN_g8: return "g8";
+#endif
+ case PIXMAN_c8: return "x4c4 / c8";
+ case PIXMAN_x4g4: return "x4g4 / g8";
+
+ case PIXMAN_x4a4: return "x4a4";
+
+/* 4bpp formats */
+ case PIXMAN_a4: return "a4";
+ case PIXMAN_r1g2b1: return "r1g2b1";
+ case PIXMAN_b1g2r1: return "b1g2r1";
+ case PIXMAN_a1r1g1b1: return "a1r1g1b1";
+ case PIXMAN_a1b1g1r1: return "a1b1g1r1";
+
+ case PIXMAN_c4: return "c4";
+ case PIXMAN_g4: return "g4";
+
+/* 1bpp formats */
+ case PIXMAN_a1: return "a1";
+
+ case PIXMAN_g1: return "g1";
+
+/* YUV formats */
+ case PIXMAN_yuy2: return "yuy2";
+ case PIXMAN_yv12: return "yv12";
+ };
+
+ /* Fake formats.
+ *
+ * This is separate switch to prevent GCC from complaining
+ * that the values are not in the pixman_format_code_t enum.
+ */
+ switch ((uint32_t)format)
+ {
+ case PIXMAN_null: return "null";
+ case PIXMAN_solid: return "solid";
+ case PIXMAN_pixbuf: return "pixbuf";
+ case PIXMAN_rpixbuf: return "rpixbuf";
+ case PIXMAN_unknown: return "unknown";
+ };
+
+ return "<unknown format>";
+};
+
static double
round_channel (double p, int m)
{
diff --git a/pixman/test/utils.h b/pixman/test/utils.h
index 45b457ead..498831433 100644
--- a/pixman/test/utils.h
+++ b/pixman/test/utils.h
@@ -177,6 +177,12 @@ convert_linear_to_srgb (double component);
void
initialize_palette (pixman_indexed_t *palette, uint32_t depth, int is_rgb);
+const char *
+operator_name (pixman_op_t op);
+
+const char *
+format_name (pixman_format_code_t format);
+
typedef struct
{
double r, g, b, a;