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.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6978
Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
Simon McVittie 2024-09-03 10:39:53 +01:00
parent 567c8b5ab3
commit 781f8c18b2

View File

@ -284,6 +284,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);
@ -312,6 +322,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);