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

package info (click to toggle)
gtk4 4.18.6%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 191,540 kB
  • sloc: ansic: 808,125; xml: 3,256; javascript: 3,061; python: 2,118; sh: 972; cpp: 799; java: 685; makefile: 319; perl: 218
file content (54 lines) | stat: -rw-r--r-- 2,425 bytes parent folder | download | duplicates (2)
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 41a98fb..b4ea8bd 100644
--- a/testsuite/gsk/scaling.c
+++ b/testsuite/gsk/scaling.c
@@ -278,6 +278,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;
+    }
+
   input = create_stipple_texture (format, width, height, colors, &average_color);
   node = gsk_texture_scale_node_new (input, &GRAPHENE_RECT_INIT (0, 0, width / 2, height / 2), GSK_SCALING_FILTER_LINEAR);
   output = gsk_renderer_render_texture (renderer, node, NULL);
@@ -306,6 +316,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;
+    }
+
   input = create_stipple_texture (format, 2, 2, colors, &average_color);
   node = gsk_texture_scale_node_new (input, &GRAPHENE_RECT_INIT (0, 0, 1, 1), GSK_SCALING_FILTER_TRILINEAR);
   output = gsk_renderer_render_texture (renderer, node, NULL);