[Pixman] [PATCH 1/3] {scaling, affine, composite-traps}-test: Use compute_crc32_for_image()

Søren Sandmann Pedersen sandmann at cs.au.dk
Thu Sep 12 11:07:23 PDT 2013


By using this function instead of compute_crc32() the alpha masking
code and the call to image_endian_swap() are not duplicated.
---
 test/affine-test.c          |   12 ++----------
 test/composite-traps-test.c |   11 +----------
 test/scaling-test.c         |   12 ++----------
 3 files changed, 5 insertions(+), 30 deletions(-)

diff --git a/test/affine-test.c b/test/affine-test.c
index c1649ed..3a37d7f 100644
--- a/test/affine-test.c
+++ b/test/affine-test.c
@@ -273,15 +273,8 @@ test_composite (int      testnum,
     pixman_image_composite (op, src_img, NULL, dst_img,
                             src_x, src_y, 0, 0, dst_x, dst_y, w, h);
 
-    if (dst_fmt == PIXMAN_x8r8g8b8)
-    {
-	/* ignore unused part */
-	for (i = 0; i < dst_stride * dst_height / 4; i++)
-	    dstbuf[i] &= 0xFFFFFF;
-    }
-
-    image_endian_swap (dst_img);
-
+    crc32 = compute_crc32_for_image (0, dst_img);
+    
     if (verbose)
     {
 	int j;
@@ -298,7 +291,6 @@ test_composite (int      testnum,
     pixman_image_unref (src_img);
     pixman_image_unref (dst_img);
 
-    crc32 = compute_crc32 (0, dstbuf, dst_stride * dst_height);
     free (srcbuf);
     free (dstbuf);
 
diff --git a/test/composite-traps-test.c b/test/composite-traps-test.c
index 2983eae..34ae340 100644
--- a/test/composite-traps-test.c
+++ b/test/composite-traps-test.c
@@ -214,14 +214,7 @@ test_composite (int      testnum,
     pixman_composite_trapezoids (op, src_img, dst_img, mask_format,
 				 src_x, src_y, dst_x, dst_y, n_traps, traps);
 
-    if (dst_format == PIXMAN_x8r8g8b8)
-    {
-	/* ignore unused part */
-	for (i = 0; i < dst_stride * dst_height / 4; i++)
-	    dst_bits[i] &= 0xFFFFFF;
-    }
-
-    image_endian_swap (dst_img);
+    crc32 = compute_crc32_for_image (0, dst_img);
 
     if (verbose)
     {
@@ -236,8 +229,6 @@ test_composite (int      testnum,
 	}
     }
 
-    crc32 = compute_crc32 (0, dst_bits, dst_stride * dst_height);
-
     fence_free (dst_bits);
     
     pixman_image_unref (src_img);
diff --git a/test/scaling-test.c b/test/scaling-test.c
index b4142a7..04ecb63 100644
--- a/test/scaling-test.c
+++ b/test/scaling-test.c
@@ -340,15 +340,8 @@ test_composite (int      testnum,
 	pixman_image_composite (op, src_img, mask_img, dst_img,
                             src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h);
 
-    if (dst_fmt == PIXMAN_x8r8g8b8 || dst_fmt == PIXMAN_x8b8g8r8)
-    {
-	/* ignore unused part */
-	for (i = 0; i < dst_stride * dst_height / 4; i++)
-	    dstbuf[i] &= 0xFFFFFF;
-    }
-
-    image_endian_swap (dst_img);
-
+    crc32 = compute_crc32_for_image (0, dst_img);
+    
     if (verbose)
     {
 	int j;
@@ -366,7 +359,6 @@ test_composite (int      testnum,
     pixman_image_unref (mask_img);
     pixman_image_unref (dst_img);
 
-    crc32 = compute_crc32 (0, dstbuf, dst_stride * dst_height);
     free (srcbuf);
     free (maskbuf);
     free (dstbuf);
-- 
1.7.1



More information about the Pixman mailing list