From: Søren Sandmann Pedersen <[email protected]>

Commit 4312f077365bf9f59423b1694136089c6da6216b claimed to have made
print_image() work with negative strides, but it didn't actually
work. When the stride was negative, the image buffer would be accesses
as if the stride was positive.

Fix the bug by not changing the stride variable and instead use a
temporary, s, that contains the absolute value of stride.
---
 test/utils.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/utils.c b/test/utils.c
index 3400747..a83fc06 100644
--- a/test/utils.c
+++ b/test/utils.c
@@ -251,6 +251,7 @@ print_image (pixman_image_t *image)
     int width, height, stride;
     pixman_format_code_t format;
     uint8_t *buffer;
+    int s;
 
     width = pixman_image_get_width (image);
     height = pixman_image_get_height (image);
@@ -258,13 +259,12 @@ print_image (pixman_image_t *image)
     format = pixman_image_get_format (image);
     buffer = (uint8_t *)pixman_image_get_data (image);
 
-    if (stride < 0)
-       stride = - stride;
+    s = (stride >= 0)? stride : - stride;
     
     printf ("---\n");
     for (i = 0; i < height; i++)
     {
-       for (j = 0; j < stride; j++)
+       for (j = 0; j < s; j++)
        {
            if (j == (width * PIXMAN_FORMAT_BPP (format) + 7) / 8)
                printf ("| ");
-- 
1.7.1

_______________________________________________
Pixman mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to