File: scaling-test-Skip-floating-point-pixel-formats-with-Cairo.patch

package info (click to toggle)
gtk4 4.20.1%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 180,184 kB
  • sloc: ansic: 778,064; xml: 3,092; javascript: 3,054; python: 1,911; java: 752; sh: 682; makefile: 314; perl: 162; cpp: 21
file content (54 lines) | stat: -rw-r--r-- 2,179 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From: Simon McVittie <smcv@debian.org>
Date: Tue, 3 Sep 2024 10:39:53 +0100
Subject: scaling test: Skip floating-point pixel formats with Cairo renderer

If the four chosen pixel values happen to have alpha values that average
to 16/17, GTK will quantize that into 8bpp integer space as
16/17*255 = 240, but Cairo/Pixman does its quantization differently and
gets 16/17*256 = 241.

Bug: https://gitlab.gnome.org/GNOME/gtk/-/issues/6978
Signed-off-by: Simon McVittie <smcv@debian.org>
Forwarded: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/7685
---
 testsuite/gsk/scaling.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/testsuite/gsk/scaling.c b/testsuite/gsk/scaling.c
index eec5ea8..53902ab 100644
--- a/testsuite/gsk/scaling.c
+++ b/testsuite/gsk/scaling.c
@@ -302,6 +302,16 @@ test_linear_filtering (gconstpointer data,
 
   decode_renderer_format (data, &renderer, &format);
 
+  /* Cairo/Pixman and GTK/GL/Vulkan disagree on how to convert 241/256
+   * from floating-point to 8bpp (Cairo says 0xf1, GTK says 0xf0) */
+  if (GSK_IS_CAIRO_RENDERER (renderer) &&
+      (gdk_memory_format_get_channel_type (format) == CHANNEL_FLOAT_16 ||
+       gdk_memory_format_get_channel_type (format) == CHANNEL_FLOAT_32))
+    {
+      g_test_skip ("https://gitlab.gnome.org/GNOME/gtk/-/issues/6978");
+      return;
+    }
+
   width = MAX (width, gdk_memory_format_get_block_width (format));
   height = MAX (height, gdk_memory_format_get_block_height (format));
 
@@ -334,6 +344,16 @@ test_mipmaps (gconstpointer data)
 
   decode_renderer_format (data, &renderer, &format);
 
+  /* Cairo/Pixman and GTK/GL/Vulkan disagree on how to convert 241/256
+   * from floating-point to 8bpp (Cairo says 0xf1, GTK says 0xf0) */
+  if (GSK_IS_CAIRO_RENDERER (renderer) &&
+      (gdk_memory_format_get_channel_type (format) == CHANNEL_FLOAT_16 ||
+       gdk_memory_format_get_channel_type (format) == CHANNEL_FLOAT_32))
+    {
+      g_test_skip ("https://gitlab.gnome.org/GNOME/gtk/-/issues/6978");
+      return;
+    }
+
   width = MAX (2, gdk_memory_format_get_block_width (format));
   height = MAX (2, gdk_memory_format_get_block_height (format));