crc32 = compute_crc32_for_image (0, dst_img);
if (verbose)
- {
- int j;
-
- for (i = 0; i < dst_height; i++)
- {
- for (j = 0; j < dst_stride; j++)
- printf ("%02X ", *((uint8_t *)dstbuf + i * dst_stride + j));
-
- printf ("\n");
- }
- }
+ print_image (dst_img);
pixman_image_unref (src_img);
pixman_image_unref (dst_img);
uint32_t
test_composite (int testnum, int verbose)
{
- int i;
pixman_image_t *src_img = NULL;
pixman_image_t *dst_img = NULL;
pixman_image_t *mask_img = NULL;
src_x, src_y, mask_x, mask_y, dst_x, dst_y, w, h);
if (verbose)
- {
- int j;
-
- printf ("---\n");
- for (i = 0; i < dst_height; i++)
- {
- for (j = 0; j < dst_stride; j++)
- {
- if (j == (dst_width * PIXMAN_FORMAT_BPP (dst_fmt) + 7) / 8)
- printf ("| ");
-
- printf ("%02X ", *((uint8_t *)dstbuf + i * dst_stride + j));
- }
- printf ("\n");
- }
- printf ("---\n");
- }
+ print_image (dst_img);
free_random_image (0, src_img, PIXMAN_null);
crc32 = free_random_image (0, dst_img, dst_fmt);
crc32 = compute_crc32_for_image (0, dst_img);
if (verbose)
- {
- int j;
-
- for (i = 0; i < dst_height; i++)
- {
- for (j = 0; j < dst_stride; j++)
- printf ("%02X ", *((uint8_t *)dst_bits + i * dst_stride + j));
-
- printf ("\n");
- }
- }
+ print_image (dst_img);
fence_free (dst_bits);
crc32 = compute_crc32_for_image (0, dst_img);
if (verbose)
- {
- int j;
-
- for (i = 0; i < dst_height; i++)
- {
- for (j = 0; j < dst_stride; j++)
- printf ("%02X ", *((uint8_t *)dstbuf + i * dst_stride + j));
-
- printf ("\n");
- }
- }
+ print_image (dst_img);
pixman_image_unref (src_img);
pixman_image_unref (mask_img);
return crc32;
}
+void
+print_image (pixman_image_t *image)
+{
+ int i, j;
+ int width, height, stride;
+ pixman_format_code_t format;
+ uint8_t *buffer;
+
+ width = pixman_image_get_width (image);
+ height = pixman_image_get_height (image);
+ stride = pixman_image_get_stride (image);
+ format = pixman_image_get_format (image);
+ buffer = (uint8_t *)pixman_image_get_data (image);
+
+ if (stride < 0)
+ stride = - stride;
+
+ printf ("---\n");
+ for (i = 0; i < height; i++)
+ {
+ for (j = 0; j < stride; j++)
+ {
+ if (j == (width * PIXMAN_FORMAT_BPP (format) + 7) / 8)
+ printf ("| ");
+
+ printf ("%02X ", *((uint8_t *)buffer + i * stride + j));
+ }
+ printf ("\n");
+ }
+ printf ("---\n");
+}
+
/* perform endian conversion of pixel data
*/
void
compute_crc32_for_image (uint32_t in_crc32,
pixman_image_t *image);
+/* Print the image in hexadecimal */
+void
+print_image (pixman_image_t *image);
+
/* Returns TRUE if running on a little endian system
*/
static force_inline pixman_bool_t