png: Correct endianness for big-endian machines
authorSimon McVittie <smcv@debian.org>
Sat, 8 Jan 2022 16:39:36 +0000 (16:39 +0000)
committerJeremy Bicha <jeremy.bicha@canonical.com>
Wed, 9 Feb 2022 18:25:53 +0000 (18:25 +0000)
commit7f65f471930e347712fcca801e6ae98e5e2f22a8
tree66bdafeb2e5f51a3db000c37eae2f52b3e9b8e67
parentc07cb350b05076c9feaa39195146b51dc13823ff
png: Correct endianness for big-endian machines

libpng wants to receive samples in either RGB or RGBA order, whether
each sample is big-endian or not. This resolves test failures in
testsuite/gdk/memorytexture.c (and a lot of reftests) on s390x, and
probably the PowerPC family too.

Modifying the test to show the color in use and write out the PNG bytes
to a file, and running the memorytexture test on s390x, produces a PNG
that loads with the correct color values in GIMP (on an x86_64 machine),
which seems like evidence that this is the correct change and not just
compensating errors.

Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/4616
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4357

Gbp-Pq: Name png-Correct-endianness-for-big-endian-machines.patch
gdk/loaders/gdkpng.c