diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-01-19 08:55:27 -0500 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2013-01-23 12:24:31 -0500 |
commit | 1676b4938912bd140791c347aa4d08db255dd60f (patch) | |
tree | 04c276a7971e138043f35254be65374935238e30 | |
parent | 8d85311143b0bc30d3490c0ca2ddbe927a1f9ac8 (diff) |
test/utils.[ch]: Add new function operator_name()
This function returns the name of the given operator, which is useful
for printing out debug information. The function is done as a switch
without a default value so that the compiler will warn if new
operators are added in the future.
The function is used in affine-test.c, scaling-test.c, and
blitters-test.c.
-rw-r--r-- | test/affine-test.c | 4 | ||||
-rw-r--r-- | test/blitters-test.c | 4 | ||||
-rw-r--r-- | test/scaling-test.c | 4 | ||||
-rw-r--r-- | test/utils.c | 69 | ||||
-rw-r--r-- | test/utils.h | 3 |
5 files changed, 78 insertions, 6 deletions
diff --git a/test/affine-test.c b/test/affine-test.c index f60ec14e..477c1e13 100644 --- a/test/affine-test.c +++ b/test/affine-test.c @@ -201,8 +201,8 @@ test_composite (int testnum, 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 ("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/test/blitters-test.c b/test/blitters-test.c index 9bde99c6..c5b452c3 100644 --- a/test/blitters-test.c +++ b/test/blitters-test.c @@ -329,8 +329,8 @@ 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, src_fmt=%08X, dst_fmt=%08X, mask_fmt=%08X\n", + operator_name (op), src_fmt, dst_fmt, 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/test/scaling-test.c b/test/scaling-test.c index 64c12dd7..173179cf 100644 --- a/test/scaling-test.c +++ b/test/scaling-test.c @@ -240,8 +240,8 @@ 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 ("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/test/utils.c b/test/utils.c index 08eaabbf..480129b9 100644 --- a/test/utils.c +++ b/test/utils.c @@ -870,6 +870,75 @@ 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>"; +} + static double round_channel (double p, int m) { diff --git a/test/utils.h b/test/utils.h index 45b457ea..e9842107 100644 --- a/test/utils.h +++ b/test/utils.h @@ -177,6 +177,9 @@ 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); + typedef struct { double r, g, b, a; |