From: Simon McVittie Date: Thu, 2 Sep 2021 21:34:14 +0000 (+0100) Subject: reftest-compare: Treat colour channels as undefined if alpha is zero X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1~1^2^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=068fcd11c8189016b4d121ff041e5d604a690e65;p=gtk4.git 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 Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3914 Applied-upstream: 4.5.0 Gbp-Pq: Name reftest-compare-Treat-colour-channels-as-undefined-if-alp.patch --- diff --git a/testsuite/reftests/reftest-compare.c b/testsuite/reftests/reftest-compare.c index 9db00ab6ae..ac72c61c04 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,