[Pixman] [PATCH] test: List more details of the operation when running scaling-test verbosely

Pekka Paalanen ppaalanen at gmail.com
Fri Aug 21 03:34:35 PDT 2015


On Thu, 20 Aug 2015 13:07:48 +0100
Ben Avison <bavison at riscosopen.org> wrote:

> ---
> I've been doing a fair bit of work on scaled plots again recently, and I was
> finding that scaling-test omitted to mention lots of useful information
> (notably whether a mask was used, and what the mask parameers were).
> 
>  test/scaling-test.c |   63 +++++++++++++++++++++++++++++++++-----------------
>  1 files changed, 41 insertions(+), 22 deletions(-)
> 
> diff --git a/test/scaling-test.c b/test/scaling-test.c
> index e2f7fa9..02bd0d0 100644
> --- a/test/scaling-test.c
> +++ b/test/scaling-test.c
> @@ -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,42 @@ 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_width, src_height);
> +        if (mask_fmt != PIXMAN_null)
> +        {
> +            printf ("mask_width=%d, mask_height=%d, ",
> +                    mask_width, mask_height);
> +        }
> +        printf ("dst_width=%d, dst_height=%d\n",
> +                dst_width, dst_height);
> +        printf ("w=%d, h=%d\n", w, h);

Hi Ben,

are you forgetting src_x, src_y, dst_x, dst_y? These were printed in
the old code.

> +    }
> +
> +    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 +382,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)

Otherwise this looks good to me and 'make check' passes.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 811 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20150821/45d50875/attachment.sig>


More information about the Pixman mailing list