Add patch to ignore colour differences on pixels with zero alpha
authorSimon McVittie <smcv@debian.org>
Thu, 2 Sep 2021 22:23:35 +0000 (23:23 +0100)
committerSimon McVittie <smcv@debian.org>
Thu, 2 Sep 2021 22:57:37 +0000 (23:57 +0100)
This makes some of the remaining failing tests pass on mips*el.

debian/patches/reftest-compare-Treat-colour-channels-as-undefined-if-alp.patch [new file with mode: 0644]
debian/patches/series
debian/rules

diff --git a/debian/patches/reftest-compare-Treat-colour-channels-as-undefined-if-alp.patch b/debian/patches/reftest-compare-Treat-colour-channels-as-undefined-if-alp.patch
new file mode 100644 (file)
index 0000000..40a2544
--- /dev/null
@@ -0,0 +1,37 @@
+From: Simon McVittie <smcv@debian.org>
+Date: Thu, 2 Sep 2021 22:34:14 +0100
+Subject: reftest-compare: Treat colour channels as undefined if alpha is zero
+
+If the alpha channel is zero, it doesn't matter what the values of the
+red, green and blue channels are: the pixel is still fully transparent.
+On most architectures, fully transparent pixels end up all-zeroes
+(fully transparent black), matching what's in the reference PNG file;
+but on mips*el the blend-difference and blend-normal tests get all-ones
+(fully transparent white) and a test failure.
+
+Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/4227
+Signed-off-by: Simon McVittie <smcv@debian.org>
+Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3914
+Applied-upstream: 4.5.0
+---
+ testsuite/reftests/reftest-compare.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/testsuite/reftests/reftest-compare.c b/testsuite/reftests/reftest-compare.c
+index 9db00ab..ac72c61 100644
+--- a/testsuite/reftests/reftest-compare.c
++++ b/testsuite/reftests/reftest-compare.c
+@@ -108,7 +108,12 @@ buffer_diff_core (const guchar *buf_a,
+           /* check if the pixels are the same */
+           if (row_a[x] == row_b[x])
+             continue;
+-        
++
++          /* even if they're not literally the same, fully-transparent
++           * pixels are effectively the same regardless of colour */
++          if ((row_a[x] & 0xff000000) == 0 && (row_b[x] & 0xff000000) == 0)
++            continue;
++
+           if (diff == NULL)
+             {
+               diff = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
index 2b751b7a20204e6f6bac60ec02d68c1f16f32c81..60db8eae6560ad7e13d9fa7c02578bdf19c43161 100644 (file)
@@ -5,3 +5,4 @@ debian/templates-Remove-html5shiv.patch
 compose-Generate-endian-dependent-compact-Compose-data.patch
 compose-Document-how-to-get-compose-parse-input-from-libX.patch
 compose-Update-sequences-from-libX11-1.7.2.patch
+reftest-compare-Treat-colour-channels-as-undefined-if-alp.patch
index 7022ce49199867591962036367c956fd16f234ba..e5d5fd99e3aa123715eb9085b0800884a700cc0f 100755 (executable)
@@ -230,10 +230,6 @@ skipped_suites = \
        $(NULL)
 
 # TODO: Known failures: https://gitlab.gnome.org/GNOME/gtk/-/issues/4110
-# mips(64)el: gtk:gsk+gsk-compare+gsk-opengl+gsk-compare-opengl / opengl blend-normal
-#             gtk:gsk+gsk-compare+gsk-opengl+gsk-compare-opengl / opengl blend-difference
-#             gtk:gsk+gsk-compare+gsk-broadway+gsk-compare-broadway / broadway blend-normal
-#             gtk:gsk+gsk-compare+gsk-broadway+gsk-compare-broadway / broadway blend-difference
 # s390x: many (endianness?)
 ifeq (big,$(DEB_HOST_ARCH_ENDIAN))
        skipped_suites += \