pixman: Branch 'master' - 4 commits

Søren Sandmann Pedersen sandmann at kemper.freedesktop.org
Wed Jan 23 09:53:41 PST 2013


 README               |  110 +++++++++++++++++++++++--
 test/affine-test.c   |    6 -
 test/alphamap.c      |   19 ----
 test/blitters-test.c |    6 -
 test/composite.c     |  221 +++++++++++++++++++++++----------------------------
 test/scaling-test.c  |    7 -
 test/utils.c         |  162 +++++++++++++++++++++++++++++++++++++
 test/utils.h         |    6 +
 8 files changed, 382 insertions(+), 155 deletions(-)

New commits:
commit b527a0e615a726aa6a7d18f0ea0b38564b153afa
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Jan 19 12:29:48 2013 -0500

    test: Use operator_name() and format_name() in composite.c
    
    With the operator_name() and format_name() functions there is no
    longer any reason for composite.c to have its own table of format and
    operator names.

diff --git a/test/composite.c b/test/composite.c
index 09752c5..b107b11 100644
--- a/test/composite.c
+++ b/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);
 
commit 4eb9a24abae6cee7562c3ec8965dc4eaaba0e8ab
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Jan 19 09:36:50 2013 -0500

    utils.[ch]: Add new format_name() function
    
    This function returns the name of the given format code, which is
    useful for printing out debug information. The function is written as
    a switch without a default value so that the compiler will warn if new
    formats are added in the future. The fake formats used in the fast
    path tables are also recognized.
    
    The function is used in alpha_map.c, where it replaces an existing
    format_name() function, and in blitters-test.c, affine-test.c, and
    scaling-test.c.

diff --git a/test/affine-test.c b/test/affine-test.c
index 477c1e1..678fbe8 100644
--- a/test/affine-test.c
+++ b/test/affine-test.c
@@ -200,7 +200,7 @@ 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 ("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"
diff --git a/test/alphamap.c b/test/alphamap.c
index 1a6fca5..4d09076 100644
--- a/test/alphamap.c
+++ b/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/test/blitters-test.c b/test/blitters-test.c
index c5b452c..8766fa8 100644
--- a/test/blitters-test.c
+++ b/test/blitters-test.c
@@ -329,8 +329,10 @@ test_composite (int testnum, int verbose)
 
     if (verbose)
     {
-	printf ("op=%s, src_fmt=%08X, dst_fmt=%08X, mask_fmt=%08X\n",
-	    operator_name (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/test/scaling-test.c b/test/scaling-test.c
index 173179c..a8cb4c4 100644
--- a/test/scaling-test.c
+++ b/test/scaling-test.c
@@ -239,7 +239,8 @@ test_composite (int      testnum,
 
     if (verbose)
     {
-	printf ("src_fmt=%08X, dst_fmt=%08X\n", src_fmt, dst_fmt);
+	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",
diff --git a/test/utils.c b/test/utils.c
index 480129b..ba7e353 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -939,6 +939,99 @@ operator_name (pixman_op_t op)
     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/test/utils.h b/test/utils.h
index e984210..4988314 100644
--- a/test/utils.h
+++ b/test/utils.h
@@ -180,6 +180,9 @@ 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;
commit 1676b4938912bd140791c347aa4d08db255dd60f
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Jan 19 08:55:27 2013 -0500

    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.

diff --git a/test/affine-test.c b/test/affine-test.c
index f60ec14..477c1e1 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 9bde99c..c5b452c 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 64c12dd..173179c 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 08eaabb..480129b 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 45b457e..e984210 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;
commit 8d85311143b0bc30d3490c0ca2ddbe927a1f9ac8
Author: Søren Sandmann Pedersen <ssp at redhat.com>
Date:   Sat Jan 12 08:03:35 2013 -0500

    README: Add guidelines on how to contribute patches
    
    Ben Avison pointed out here:
    
       http://lists.freedesktop.org/archives/pixman/2013-January/002485.html
    
    that there isn't really any documentation about how to submit patches
    to pixman. This patch adds some information to the README file.
    
    v2: Incorporate some comments from Ben Avison
    v3: Change gitweb URL to cgit

diff --git a/README b/README
index 3cfbc50..6d8cfd8 100644
--- a/README
+++ b/README
@@ -1,22 +1,116 @@
-pixman is a library that provides low-level pixel manipulation
+Pixman is a library that provides low-level pixel manipulation
 features such as image compositing and trapezoid rasterization.
 
-All questions regarding this software should be directed to the pixman
+Questions, bug reports and patches should be directed to the pixman
 mailing list:
 
         http://lists.freedesktop.org/mailman/listinfo/pixman
 
-Please send patches and bug reports either to the mailing list above,
-or file them at the freedesktop bug tracker:
+You can also file bugs at
 
         https://bugs.freedesktop.org/enter_bug.cgi?product=pixman
 
-The master development code repository can be found at:
+For real time discussions about pixman, feel free to join the IRC
+channels #cairo and #xorg-devel on the FreeNode IRC network.
+
+
+Contributing
+------------
+
+In order to contribute to pixman, you will need a working knowledge of
+the git version control system. For a quick getting started guide,
+there is the "Everyday Git With 20 Commands Or So guide"
+
+        http://www.kernel.org/pub/software/scm/git/docs/everyday.html
+
+from the Git homepage. For more in depth git documentation, see the
+resources on the Git community documentation page:
+
+        http://git-scm.com/documentation
+
+Pixman uses the infrastructure from the freedesktop.org umbrella
+project. For instructions about how to use the git service on
+freedesktop.org, see:
+
+        http://www.freedesktop.org/wiki/Infrastructure/git/Developers
+
+The Pixman master repository can be found at:
 
 	git://anongit.freedesktop.org/git/pixman
 
-	http://gitweb.freedesktop.org/?p=pixman;a=summary
+and browsed on the web here:
+
+	http://cgit.freedesktop.org/pixman/
+
+
+Sending patches
+---------------
+
+The general workflow for sending patches is to first make sure that
+git can send mail on your system. Then, 
+
+ - create a branch off of master in your local git repository
+
+ - make your changes as one or more commits
+
+ - use the 
+
+        git send-email
+
+   command to send the patch series to pixman at lists.freedesktop.org.
+
+In order for your patches to be accepted, please consider the
+following guidelines:
+
+ - This link:
+
+        http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#patch-series
+
+   describes how what a good patch series is, and to create one with
+   git.
+
+ - At each point in the series, pixman should compile and the test
+   suite should pass.
+
+   The exception here is if you are changing the test suite to
+   demonstrate a bug. In this case, make one commit that makes the
+   test suite fail due to the bug, and then another commit that fixes
+   the bug.
+
+   You can run the test suite with 
+
+        make check
+
+   It will take around two minutes to run on a modern PC.
+
+ - Follow the coding style described in the CODING_STYLE file
+
+ - For bug fixes, include an update to the test suite to make sure
+   the bug doesn't reappear.
+
+ - For new features, add tests of the feature to the test
+   suite. Also, add a program demonstrating the new feature to the
+   demos/ directory.
+
+ - Write descriptive commit messages. Useful information to include:
+        - Benchmark results, before and after
+	- Description of the bug that was fixed
+	- Detailed rationale for any new API
+	- Alternative approaches that were rejected (and why they
+          don't work)
+	- If review comments were incorporated, a brief version
+          history describing what those changes were.
+
+ - For big patch series, send an introductory email with an overall
+   description of the patch series, including benchmarks and
+   motivation. Each commit message should still be descriptive and
+   include enough information to understand why this particular commit
+   was necessary.
 
-For more information on the git code manager, see:
+Pixman has high standards for code quality and so almost everybody
+should expect to have the first versions of their patches rejected.
 
-	http://wiki.x.org/wiki/GitPage
+If you think that the reviewers are wrong about something, or that the
+guidelines above are wrong, feel free to discuss the issue on the
+list. The purpose of the guidelines and code review is to ensure high
+code quality; it is not an exercise in compliance.


More information about the xorg-commit mailing list