Blame SOURCES/0065-tests-Fix-image-writing-on-big-endian.patch

73b847
From 1dc9e06987c3787c3e6177fd010e5b0d5eab2ad9 Mon Sep 17 00:00:00 2001
73b847
From: Benjamin Berg <bberg@redhat.com>
73b847
Date: Wed, 4 Dec 2019 13:21:11 +0100
73b847
Subject: [PATCH 065/181] tests: Fix image writing on big endian
73b847
73b847
The code tried to only write the RGB bytes of FORMAT_RGB24, however, the
73b847
in-memory layout is different on big-endian which would result in the
73b847
wrong bytes being written.
73b847
73b847
Fix this by simply also writing the byte we do not care about.
73b847
---
73b847
 tests/capture.py | 4 +++-
73b847
 1 file changed, 3 insertions(+), 1 deletion(-)
73b847
73b847
diff --git a/tests/capture.py b/tests/capture.py
73b847
index 2ad9385..a7b7583 100755
73b847
--- a/tests/capture.py
73b847
+++ b/tests/capture.py
73b847
@@ -36,10 +36,12 @@ c_buf = c_img.get_data()
73b847
 
73b847
 for x in range(width):
73b847
     for y in range(height):
73b847
+        # The upper byte is don't care, but the location depends on endianness,
73b847
+        # so just set all of them.
73b847
         c_buf[y * c_rowstride + x * 4 + 0] = buf[y * width + x]
73b847
         c_buf[y * c_rowstride + x * 4 + 1] = buf[y * width + x]
73b847
         c_buf[y * c_rowstride + x * 4 + 2] = buf[y * width + x]
73b847
-        # Byte 4 is don't care
73b847
+        c_buf[y * c_rowstride + x * 4 + 3] = buf[y * width + x]
73b847
 
73b847
 c_img.mark_dirty()
73b847
 c_img.write_to_png(sys.argv[1])
73b847
-- 
73b847
2.24.1
73b847