scaling-test: list more details when verbose
authorBen Avison <bavison@riscosopen.org>
Thu, 20 Aug 2015 12:07:48 +0000 (13:07 +0100)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 28 Aug 2015 11:24:28 +0000 (14:24 +0300)
Add mask details to the output.

[Pekka: redo whitespace and print src,dst,mask x and y.]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Ben Avison <bavison@riscosopen.org>
test/scaling-test.c

index e2f7fa9..0ece611 100644 (file)
@@ -73,7 +73,7 @@ test_composite (int      testnum,
     pixman_op_t        op;
     pixman_repeat_t    repeat = PIXMAN_REPEAT_NONE;
     pixman_repeat_t    mask_repeat = PIXMAN_REPEAT_NONE;
-    pixman_format_code_t src_fmt, dst_fmt;
+    pixman_format_code_t src_fmt, mask_fmt, dst_fmt;
     uint32_t *         srcbuf;
     uint32_t *         dstbuf;
     uint32_t *         maskbuf;
@@ -145,6 +145,7 @@ test_composite (int      testnum,
     prng_randmemset (dstbuf, dst_stride * dst_height, 0);
 
     src_fmt = get_format (src_bpp);
+    mask_fmt = PIXMAN_a8;
     dst_fmt = get_format (dst_bpp);
 
     if (prng_rand_n (2))
@@ -169,7 +170,7 @@ test_composite (int      testnum,
         src_fmt, src_width, src_height, srcbuf, src_stride);
 
     mask_img = pixman_image_create_bits (
-        PIXMAN_a8, mask_width, mask_height, maskbuf, mask_stride);
+        mask_fmt, mask_width, mask_height, maskbuf, mask_stride);
 
     dst_img = pixman_image_create_bits (
         dst_fmt, dst_width, dst_height, dstbuf, dst_stride);
@@ -255,21 +256,6 @@ test_composite (int      testnum,
     else
        pixman_image_set_filter (mask_img, PIXMAN_FILTER_BILINEAR, NULL, 0);
 
-    if (verbose)
-    {
-       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",
-               src_width, src_height, dst_width, dst_height);
-       printf ("src_x=%d, src_y=%d, dst_x=%d, dst_y=%d\n",
-               src_x, src_y, dst_x, dst_y);
-       printf ("w=%d, h=%d\n", w, h);
-    }
-
     if (prng_rand_n (8) == 0)
     {
        pixman_box16_t clip_boxes[2];
@@ -352,10 +338,45 @@ test_composite (int      testnum,
     }
 
     if (prng_rand_n (2) == 0)
-       pixman_image_composite (op, src_img, NULL, dst_img,
-                            src_x, src_y, 0, 0, dst_x, dst_y, w, h);
-    else
-       pixman_image_composite (op, src_img, mask_img, dst_img,
+    {
+       mask_fmt = PIXMAN_null;
+       pixman_image_unref (mask_img);
+       mask_img = NULL;
+       mask_x = 0;
+       mask_y = 0;
+    }
+
+    if (verbose)
+    {
+       printf ("op=%s, src_fmt=%s, mask_fmt=%s, dst_fmt=%s\n",
+               operator_name (op), format_name (src_fmt),
+               format_name (mask_fmt), format_name (dst_fmt));
+       printf ("scale_x=%d, scale_y=%d, repeat=%d, filter=%d\n",
+               scale_x, scale_y, repeat, src_img->common.filter);
+       printf ("translate_x=%d, translate_y=%d\n",
+               translate_x, translate_y);
+       if (mask_fmt != PIXMAN_null)
+       {
+           printf ("mask_scale_x=%d, mask_scale_y=%d, "
+                   "mask_repeat=%d, mask_filter=%d\n",
+                   mask_scale_x, mask_scale_y, mask_repeat,
+                   mask_img->common.filter);
+           printf ("mask_translate_x=%d, mask_translate_y=%d\n",
+                   mask_translate_x, mask_translate_y);
+       }
+       printf ("src_width=%d, src_height=%d, src_x=%d, src_y=%d\n",
+               src_width, src_height, src_x, src_y);
+       if (mask_fmt != PIXMAN_null)
+       {
+           printf ("mask_width=%d, mask_height=%d, mask_x=%d, mask_y=%d\n",
+                   mask_width, mask_height, mask_x, mask_y);
+       }
+       printf ("dst_width=%d, dst_height=%d, dst_x=%d, dst_y=%d\n",
+               dst_width, dst_height, dst_x, dst_y);
+       printf ("w=%d, h=%d\n", w, h);
+    }
+
+    pixman_image_composite (op, src_img, mask_img, dst_img,
                             src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h);
 
     crc32 = compute_crc32_for_image (0, dst_img);
@@ -364,7 +385,8 @@ test_composite (int      testnum,
        print_image (dst_img);
 
     pixman_image_unref (src_img);
-    pixman_image_unref (mask_img);
+    if (mask_img != NULL)
+       pixman_image_unref (mask_img);
     pixman_image_unref (dst_img);
 
     if (src_stride < 0)