| 1 |
#cxx . . $ `<file>/testsuite/gsk/scaling.c`/include "config.h"cxx . . $ `<file>/build/config.h`/ |
| 2 |
|
| 3 |
#include <gtk/gtk.h>cxx . . $ `<file>/gtk/gtk.h`/ |
| 4 |
|
| 5 |
#include "gdk/gdkmemoryformatprivate.h"cxx . . $ `<file>/gdk/gdkmemoryformatprivate.h`/ |
| 6 |
#include "gsk/gl/fp16private.h"cxx . . $ `<file>/gsk/gl/fp16private.h`/ |
| 7 |
#include "testsuite/gdk/gdktestutils.h"cxx . . $ `<file>/testsuite/gdk/gdktestutils.h`/ |
| 8 |
|
| 9 |
structcxx . . $ $anonymous_type_5d06d3f3e959c38d_0# { |
| 10 |
const char *namecxx . . $ $anonymous_type_5d06d3f3e959c38d_0#name.; |
| 11 |
GskRenderercxx . . $ GskRenderer# * (*create_funccxx . . $ $anonymous_type_5d06d3f3e959c38d_0#create_func.) (void); |
| 12 |
GskRenderercxx . . $ GskRenderer# *renderercxx . . $ $anonymous_type_5d06d3f3e959c38d_0#renderer.; |
| 13 |
} rendererscxx . . $ renderers.[] = { |
| 14 |
{ |
| 15 |
"cairo", |
| 16 |
gsk_cairo_renderer_newcxx . . $ gsk_cairo_renderer_new(c8f38e55b6171e41)., |
| 17 |
}, |
| 18 |
{ |
| 19 |
"vulkan", |
| 20 |
gsk_vulkan_renderer_newcxx . . $ gsk_vulkan_renderer_new(c8f38e55b6171e41)., |
| 21 |
}, |
| 22 |
{ |
| 23 |
"gl", |
| 24 |
gsk_gl_renderer_newcxx . . $ gsk_gl_renderer_new(c8f38e55b6171e41)., |
| 25 |
}, |
| 26 |
}; |
| 27 |
|
| 28 |
static gpointercxx . . $ gpointer# |
| 29 |
encode_renderer_formatcxx . . $ encode_renderer_format(924a4541844b4683). (guintcxx . . $ guint# renderer, |
| 30 |
GdkMemoryFormatcxx . . $ GdkMemoryFormat# format) |
| 31 |
{ |
| 32 |
return GSIZE_TO_POINTERcxx . . $ `<external>/12741050725406041920/gmacros.h:998:9`! (format * G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (renderers) + renderer); |
| 33 |
} |
| 34 |
|
| 35 |
static void |
| 36 |
decode_renderer_formatcxx . . $ decode_renderer_format(e73ad8afbbd80754). (gconstpointercxx . . $ gconstpointer# data, |
| 37 |
GskRenderercxx . . $ GskRenderer# **renderer, |
| 38 |
GdkMemoryFormatcxx . . $ GdkMemoryFormat# *format) |
| 39 |
{ |
| 40 |
gsizecxx . . $ gsize# value = GPOINTER_TO_SIZEcxx . . $ `<external>/12741050725406041920/gmacros.h:997:9`! (data); |
| 41 |
|
| 42 |
*renderer = rendererscxx . . $ renderers.[value % G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (renderers)].renderercxx . . $ $anonymous_type_5d06d3f3e959c38d_0#renderer.; |
| 43 |
value /= G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (renderers); |
| 44 |
|
| 45 |
*format = value; |
| 46 |
} |
| 47 |
|
| 48 |
#if 0 |
| 49 |
static GdkTexture * |
| 50 |
ensure_texture_format (GdkTexture *texture, |
| 51 |
GdkMemoryFormat format) |
| 52 |
{ |
| 53 |
GdkTextureDownloader *downloader; |
| 54 |
GdkTexture *result; |
| 55 |
GBytes *bytes; |
| 56 |
gsize stride; |
| 57 |
|
| 58 |
if (gdk_texture_get_format (texture) == format) |
| 59 |
return texture; |
| 60 |
|
| 61 |
downloader = gdk_texture_downloader_new (texture); |
| 62 |
gdk_texture_downloader_set_format (downloader, format); |
| 63 |
bytes = gdk_texture_downloader_download_bytes (downloader, &stride); |
| 64 |
gdk_texture_downloader_free (downloader); |
| 65 |
|
| 66 |
result = gdk_memory_texture_new (gdk_texture_get_width (texture), |
| 67 |
gdk_texture_get_height (texture), |
| 68 |
format, |
| 69 |
bytes, |
| 70 |
stride); |
| 71 |
g_bytes_unref (bytes); |
| 72 |
g_object_unref (texture); |
| 73 |
|
| 74 |
return result; |
| 75 |
} |
| 76 |
#endif |
| 77 |
|
| 78 |
static void |
| 79 |
color_make_opaquecxx . . $ color_make_opaque(c36953b5cda1334b). (GdkRGBAcxx . . $ GdkRGBA# *result, |
| 80 |
const GdkRGBAcxx . . $ GdkRGBA# *color) |
| 81 |
{ |
| 82 |
result->redcxx . . $ _GdkRGBA#red. *= color->alphacxx . . $ _GdkRGBA#alpha.; |
| 83 |
result->greencxx . . $ _GdkRGBA#green. *= color->alphacxx . . $ _GdkRGBA#alpha.; |
| 84 |
result->bluecxx . . $ _GdkRGBA#blue. *= color->alphacxx . . $ _GdkRGBA#alpha.; |
| 85 |
result->alphacxx . . $ _GdkRGBA#alpha. = 1.0f; |
| 86 |
} |
| 87 |
|
| 88 |
static void |
| 89 |
color_make_graycxx . . $ color_make_gray(c36953b5cda1334b). (GdkRGBAcxx . . $ GdkRGBA# *result, |
| 90 |
const GdkRGBAcxx . . $ GdkRGBA# *color) |
| 91 |
{ |
| 92 |
result->redcxx . . $ _GdkRGBA#red. = (color->redcxx . . $ _GdkRGBA#red. + color->greencxx . . $ _GdkRGBA#green. + color->bluecxx . . $ _GdkRGBA#blue.) / 3.0f; |
| 93 |
result->greencxx . . $ _GdkRGBA#green. = result->redcxx . . $ _GdkRGBA#red.; |
| 94 |
result->bluecxx . . $ _GdkRGBA#blue. = result->redcxx . . $ _GdkRGBA#red.; |
| 95 |
result->alphacxx . . $ _GdkRGBA#alpha. = color->alphacxx . . $ _GdkRGBA#alpha.; |
| 96 |
} |
| 97 |
|
| 98 |
static void |
| 99 |
color_make_whitecxx . . $ color_make_white(c36953b5cda1334b). (GdkRGBAcxx . . $ GdkRGBA# *result, |
| 100 |
const GdkRGBAcxx . . $ GdkRGBA# *color) |
| 101 |
{ |
| 102 |
result->redcxx . . $ _GdkRGBA#red. = 1.0f; |
| 103 |
result->greencxx . . $ _GdkRGBA#green. = 1.0f; |
| 104 |
result->bluecxx . . $ _GdkRGBA#blue. = 1.0f; |
| 105 |
result->alphacxx . . $ _GdkRGBA#alpha. = color->alphacxx . . $ _GdkRGBA#alpha.; |
| 106 |
} |
| 107 |
|
| 108 |
/* Generate colors so that premultiplying will result in values in steps of 1/15th. |
| 109 |
* Also make sure that an averaged gray value fits in that range. */ |
| 110 |
static void |
| 111 |
create_random_colorcxx . . $ create_random_color(3f3ea8ff31dcaa39). (GdkRGBAcxx . . $ GdkRGBA# *color) |
| 112 |
{ |
| 113 |
int r, g, b; |
| 114 |
do |
| 115 |
{ |
| 116 |
r = g_test_rand_int_rangecxx . . $ g_test_rand_int_range(9b79fb6aee4c0440). (0, 6); |
| 117 |
g = g_test_rand_int_rangecxx . . $ g_test_rand_int_range(9b79fb6aee4c0440). (0, 6); |
| 118 |
b = g_test_rand_int_rangecxx . . $ g_test_rand_int_range(9b79fb6aee4c0440). (0, 6); |
| 119 |
} |
| 120 |
while ((r + g + b) % 3 != 0); |
| 121 |
color->redcxx . . $ _GdkRGBA#red. = r / 5.f; |
| 122 |
color->greencxx . . $ _GdkRGBA#green. = g / 5.f; |
| 123 |
color->bluecxx . . $ _GdkRGBA#blue. = b / 5.f; |
| 124 |
color->alphacxx . . $ _GdkRGBA#alpha. = g_test_rand_int_rangecxx . . $ g_test_rand_int_range(9b79fb6aee4c0440). (0, 4) / 3.f; |
| 125 |
} |
| 126 |
|
| 127 |
static void |
| 128 |
create_random_color_for_formatcxx . . $ create_random_color_for_format(6da2e7437fb51849). (GdkRGBAcxx . . $ GdkRGBA# *color, |
| 129 |
GdkMemoryFormatcxx . . $ GdkMemoryFormat# format) |
| 130 |
{ |
| 131 |
/* non-premultiplied can represet GdkRGBA (1, 1, 1, 0) |
| 132 |
* but premultiplied cannot. |
| 133 |
* Premultiplied will always represent this as (0, 0, 0, 0) |
| 134 |
*/ |
| 135 |
do |
| 136 |
{ |
| 137 |
create_random_colorcxx . . $ create_random_color(3f3ea8ff31dcaa39). (color); |
| 138 |
} |
| 139 |
while (color->alphacxx . . $ _GdkRGBA#alpha. == 0 && |
| 140 |
gdk_memory_format_alphacxx . . $ gdk_memory_format_alpha(f49b74239c5d66df). (format) == GDK_MEMORY_ALPHA_PREMULTIPLIEDcxx . . $ GDK_MEMORY_ALPHA_PREMULTIPLIED.); |
| 141 |
|
| 142 |
/* If the format can't handle alpha, make things opaque |
| 143 |
*/ |
| 144 |
if (gdk_memory_format_alphacxx . . $ gdk_memory_format_alpha(f49b74239c5d66df). (format) == GDK_MEMORY_ALPHA_OPAQUEcxx . . $ GDK_MEMORY_ALPHA_OPAQUE.) |
| 145 |
color_make_opaquecxx . . $ color_make_opaque(c36953b5cda1334b). (color, color); |
| 146 |
|
| 147 |
/* If the format has fewer color channels than the |
| 148 |
* target, make sure the colors get adjusted. |
| 149 |
*/ |
| 150 |
if (gdk_memory_format_n_colorscxx . . $ gdk_memory_format_n_colors(a3ba24a75bc20aa0). (format) == 1) |
| 151 |
color_make_graycxx . . $ color_make_gray(c36953b5cda1334b). (color, color); |
| 152 |
else if (gdk_memory_format_n_colorscxx . . $ gdk_memory_format_n_colors(a3ba24a75bc20aa0). (format) == 0) |
| 153 |
color_make_whitecxx . . $ color_make_white(c36953b5cda1334b). (color, color); |
| 154 |
} |
| 155 |
|
| 156 |
static GdkTexturecxx . . $ GdkTexture# * |
| 157 |
create_solid_color_texturecxx . . $ create_solid_color_texture(9bedc66873061b55). (GdkMemoryFormatcxx . . $ GdkMemoryFormat# format, |
| 158 |
int width, |
| 159 |
int height, |
| 160 |
const GdkRGBAcxx . . $ GdkRGBA# *color) |
| 161 |
{ |
| 162 |
TextureBuildercxx . . $ TextureBuilder# builder; |
| 163 |
|
| 164 |
texture_builder_initcxx . . $ texture_builder_init(d6d89a6c05bc5c6f). (&builder, format, width, height); |
| 165 |
texture_builder_fillcxx . . $ texture_builder_fill(bfe222fc4f488e46). (&builder, color); |
| 166 |
|
| 167 |
return texture_builder_finishcxx . . $ texture_builder_finish(6837a9f6687475f5). (&builder); |
| 168 |
} |
| 169 |
|
| 170 |
/* randomly creates 4 colors with values that are multiples |
| 171 |
* of 8, so that averaging the colors works without rounding |
| 172 |
* errors, and then creates a stipple pattern like this: |
| 173 |
* |
| 174 |
* 1 2 1 2 1 2 ... |
| 175 |
* 3 4 3 4 3 4 |
| 176 |
* 1 2 1 2 1 2 |
| 177 |
* 3 4 3 4 3 4 |
| 178 |
* 1 2 1 2 1 2 |
| 179 |
* 3 4 3 4 3 4 |
| 180 |
* ⋮ |
| 181 |
*/ |
| 182 |
static GdkTexturecxx . . $ GdkTexture# * |
| 183 |
create_stipple_texturecxx . . $ create_stipple_texture(27af413a17b0f2bc). (GdkMemoryFormatcxx . . $ GdkMemoryFormat# format, |
| 184 |
gsizecxx . . $ gsize# width, |
| 185 |
gsizecxx . . $ gsize# height, |
| 186 |
float scale, |
| 187 |
GdkRGBAcxx . . $ GdkRGBA# colors[2][2], |
| 188 |
GdkRGBAcxx . . $ GdkRGBA# *average) |
| 189 |
{ |
| 190 |
TextureBuildercxx . . $ TextureBuilder# builder; |
| 191 |
GdkTexturecxx . . $ GdkTexture# *texture; |
| 192 |
int x, y; |
| 193 |
/* large enough */ |
| 194 |
float data[4 * 4 * 4]; |
| 195 |
GdkMemoryLayoutcxx . . $ GdkMemoryLayout# layout; |
| 196 |
|
| 197 |
*average = (GdkRGBAcxx . . $ GdkRGBA#) { 0, 0, 0, 0 }; |
| 198 |
|
| 199 |
for (y = 0; y < 2; y++) |
| 200 |
{ |
| 201 |
for (x = 0; x < 2; x++) |
| 202 |
{ |
| 203 |
create_random_color_for_formatcxx . . $ create_random_color_for_format(6da2e7437fb51849). (&colors[x][y], format); |
| 204 |
if (gdk_memory_format_alphacxx . . $ gdk_memory_format_alpha(f49b74239c5d66df). (format) != GDK_MEMORY_ALPHA_OPAQUEcxx . . $ GDK_MEMORY_ALPHA_OPAQUE.) |
| 205 |
colors[x][y].alphacxx . . $ _GdkRGBA#alpha. *= scale * 16.f/17.f; |
| 206 |
else |
| 207 |
{ |
| 208 |
colors[x][y].redcxx . . $ _GdkRGBA#red. *= scale * 16.f/17.f; |
| 209 |
colors[x][y].greencxx . . $ _GdkRGBA#green. *= scale * 16.f/17.f; |
| 210 |
colors[x][y].bluecxx . . $ _GdkRGBA#blue. *= scale *16.f/17.f; |
| 211 |
} |
| 212 |
|
| 213 |
average->redcxx . . $ _GdkRGBA#red. += colors[x][y].redcxx . . $ _GdkRGBA#red. * colors[x][y].alphacxx . . $ _GdkRGBA#alpha.; |
| 214 |
average->greencxx . . $ _GdkRGBA#green. += colors[x][y].greencxx . . $ _GdkRGBA#green. * colors[x][y].alphacxx . . $ _GdkRGBA#alpha.; |
| 215 |
average->bluecxx . . $ _GdkRGBA#blue. += colors[x][y].bluecxx . . $ _GdkRGBA#blue. * colors[x][y].alphacxx . . $ _GdkRGBA#alpha.; |
| 216 |
average->alphacxx . . $ _GdkRGBA#alpha. += colors[x][y].alphacxx . . $ _GdkRGBA#alpha.; |
| 217 |
} |
| 218 |
} |
| 219 |
|
| 220 |
if (average->alphacxx . . $ _GdkRGBA#alpha. != 0.0f) |
| 221 |
{ |
| 222 |
average->redcxx . . $ _GdkRGBA#red. /= average->alphacxx . . $ _GdkRGBA#alpha.; |
| 223 |
average->greencxx . . $ _GdkRGBA#green. /= average->alphacxx . . $ _GdkRGBA#alpha.; |
| 224 |
average->bluecxx . . $ _GdkRGBA#blue. /= average->alphacxx . . $ _GdkRGBA#alpha.; |
| 225 |
average->alphacxx . . $ _GdkRGBA#alpha. /= 4.0f; |
| 226 |
} |
| 227 |
else |
| 228 |
{ |
| 229 |
/* Each component of the average has been multiplied by the alpha |
| 230 |
* already, so if the alpha is zero, all components should also |
| 231 |
* be zero */ |
| 232 |
g_assert_cmpfloatcxx . . $ `<external>/15287032793271088244/gtestutils.h:91:9`! (average->red, ==, 0.0f); |
| 233 |
g_assert_cmpfloatcxx . . $ `<external>/15287032793271088244/gtestutils.h:91:9`! (average->green, ==, 0.0f); |
| 234 |
g_assert_cmpfloatcxx . . $ `<external>/15287032793271088244/gtestutils.h:91:9`! (average->blue, ==, 0.0f); |
| 235 |
} |
| 236 |
|
| 237 |
for (y = 0; y < 4; y++) |
| 238 |
{ |
| 239 |
for (x = 0; x < 4; x++) |
| 240 |
{ |
| 241 |
data[4 * (4 * y + x) + 0] = colors[x % 2][y % 2].redcxx . . $ _GdkRGBA#red.; |
| 242 |
data[4 * (4 * y + x) + 1] = colors[x % 2][y % 2].greencxx . . $ _GdkRGBA#green.; |
| 243 |
data[4 * (4 * y + x) + 2] = colors[x % 2][y % 2].bluecxx . . $ _GdkRGBA#blue.; |
| 244 |
data[4 * (4 * y + x) + 3] = colors[x % 2][y % 2].alphacxx . . $ _GdkRGBA#alpha.; |
| 245 |
} |
| 246 |
} |
| 247 |
gdk_memory_layout_initcxx . . $ gdk_memory_layout_init(1e27e7aacb34810a). (&layout, |
| 248 |
GDK_MEMORY_R32G32B32A32_FLOATcxx . . $ GDK_MEMORY_R32G32B32A32_FLOAT., |
| 249 |
4, |
| 250 |
4, |
| 251 |
1); |
| 252 |
layout.widthcxx . . $ _GdkMemoryLayout#width. = MINcxx . . $ `<external>/12741050725406041920/gmacros.h:978:9`! (width, layout.width); |
| 253 |
layout.heightcxx . . $ _GdkMemoryLayout#height. = MINcxx . . $ `<external>/12741050725406041920/gmacros.h:978:9`! (height, layout.height); |
| 254 |
|
| 255 |
texture_builder_initcxx . . $ texture_builder_init(d6d89a6c05bc5c6f). (&builder, format, width, height); |
| 256 |
for (y = 0; y < height; y += layout.heightcxx . . $ _GdkMemoryLayout#height.) |
| 257 |
{ |
| 258 |
for (x = 0; x < width; x += layout.widthcxx . . $ _GdkMemoryLayout#width.) |
| 259 |
{ |
| 260 |
texture_builder_draw_datacxx . . $ texture_builder_draw_data(17cacedce54aec24). (&builder, |
| 261 |
x, y, |
| 262 |
(gucharcxx . . $ guchar# *) data, |
| 263 |
&layout); |
| 264 |
} |
| 265 |
} |
| 266 |
texture = texture_builder_finishcxx . . $ texture_builder_finish(6837a9f6687475f5). (&builder); |
| 267 |
|
| 268 |
return texture; |
| 269 |
} |
| 270 |
|
| 271 |
static void |
| 272 |
dump_scaling_inputcxx . . $ dump_scaling_input(8c8f5adafc11bf4a). (const GdkRGBAcxx . . $ GdkRGBA# colors[2][2], |
| 273 |
const GdkRGBAcxx . . $ GdkRGBA# *average) |
| 274 |
{ |
| 275 |
int x, y; |
| 276 |
|
| 277 |
for (y = 0; y < 2; y++) |
| 278 |
{ |
| 279 |
for (x = 0; x < 2; x++) |
| 280 |
g_test_messagecxx . . $ g_test_message(326aeb464d16410c). ("input stipple texture (%d,%d) r=%f g=%f b=%f a=%f", |
| 281 |
x, y, |
| 282 |
colors[x][y].redcxx . . $ _GdkRGBA#red., |
| 283 |
colors[x][y].greencxx . . $ _GdkRGBA#green., |
| 284 |
colors[x][y].bluecxx . . $ _GdkRGBA#blue., |
| 285 |
colors[x][y].alphacxx . . $ _GdkRGBA#alpha.); |
| 286 |
} |
| 287 |
|
| 288 |
g_test_messagecxx . . $ g_test_message(326aeb464d16410c). ("expected average r=%f g=%f b=%f a=%f", |
| 289 |
average->redcxx . . $ _GdkRGBA#red., average->greencxx . . $ _GdkRGBA#green., average->bluecxx . . $ _GdkRGBA#blue., average->alphacxx . . $ _GdkRGBA#alpha.); |
| 290 |
} |
| 291 |
|
| 292 |
static void |
| 293 |
test_linear_filteringcxx . . $ test_linear_filtering(4b6474a8e98cb88e). (gconstpointercxx . . $ gconstpointer# data, |
| 294 |
gsizecxx . . $ gsize# width, |
| 295 |
gsizecxx . . $ gsize# height) |
| 296 |
{ |
| 297 |
GdkMemoryFormatcxx . . $ GdkMemoryFormat# format; |
| 298 |
GskRenderercxx . . $ GskRenderer# *renderer; |
| 299 |
GdkTexturecxx . . $ GdkTexture# *input, *output, *expected; |
| 300 |
GskRenderNodecxx . . $ GskRenderNode# *node; |
| 301 |
GdkRGBAcxx . . $ GdkRGBA# colors[2][2]; |
| 302 |
GdkRGBAcxx . . $ GdkRGBA# average_color; |
| 303 |
gbooleancxx . . $ gboolean# cant_math; |
| 304 |
|
| 305 |
decode_renderer_formatcxx . . $ decode_renderer_format(e73ad8afbbd80754). (data, &renderer, &format); |
| 306 |
|
| •307 |
/* Cairo/Pixman and GTK/GL/Vulkan disagree on how to convert 241/256 |
| 308 |
* from floating-point to 8bpp (Cairo says 0xf1, GTK says 0xf0) */ |
| 309 |
if (GSK_IS_CAIRO_RENDERERcxx . . $ `gsk/gskcairorenderer.h:35:9`! (renderer) && |
| 310 |
(gdk_memory_format_get_channel_typecxx . . $ gdk_memory_format_get_channel_type(95b97cafb530af33). (format) == CHANNEL_FLOAT_16cxx . . $ CHANNEL_FLOAT_16. || |
| 311 |
gdk_memory_format_get_channel_typecxx . . $ gdk_memory_format_get_channel_type(95b97cafb530af33). (format) == CHANNEL_FLOAT_32cxx . . $ CHANNEL_FLOAT_32.)) |
| 312 |
{ |
| 313 |
g_test_skipcxx . . $ g_test_skip(85c52e162fed56f9). ("https://gitlab.gnome.org/GNOME/gtk/-/issues/6978"); |
| 314 |
return; |
| 315 |
} |
| 316 |
|
| 317 |
width = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (width, gdk_memory_format_get_block_width (format)); |
| 318 |
height = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (height, gdk_memory_format_get_block_height (format)); |
| 319 |
|
| 320 |
cant_math = GSK_IS_CAIRO_RENDERERcxx . . $ `gsk/gskcairorenderer.h:35:9`! (renderer); |
| 321 |
input = create_stipple_texturecxx . . $ create_stipple_texture(27af413a17b0f2bc). (format, width, height, cant_math ? 0.5 : 1, colors, &average_color); |
| 322 |
node = gsk_texture_scale_node_newcxx . . $ gsk_texture_scale_node_new(c5f951f75095ff15). (input, &GRAPHENE_RECT_INITcxx . . $ `<external>/7539008420172022992/graphene-rect.h:50:9`! (0, 0, width / 2, height / 2), GSK_SCALING_FILTER_LINEARcxx . . $ GSK_SCALING_FILTER_LINEAR.); |
| 323 |
output = gsk_renderer_render_texturecxx . . $ gsk_renderer_render_texture(344db4dcc522b590). (renderer, node, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 324 |
expected = create_solid_color_texturecxx . . $ create_solid_color_texture(9bedc66873061b55). (gdk_texture_get_formatcxx . . $ gdk_texture_get_format(1cda2554811ccb0b). (output), width / 2, height / 2, &average_color); |
| 325 |
|
| 326 |
compare_texturescxx . . $ compare_textures(97075a2255d03275). (expected, output, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 327 |
|
| 328 |
if (g_test_failedcxx . . $ g_test_failed(b126dc7c1de90089). ()) |
| 329 |
dump_scaling_inputcxx . . $ dump_scaling_input(8c8f5adafc11bf4a). (colors, &average_color); |
| 330 |
|
| 331 |
g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (expected); |
| 332 |
g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (output); |
| 333 |
gsk_render_node_unrefcxx . . $ gsk_render_node_unref(8a7ac56c05ee882). (node); |
| 334 |
g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (input); |
| 335 |
} |
| 336 |
|
| 337 |
static void |
| 338 |
test_mipmapscxx . . $ test_mipmaps(e4289f82fef2c2f9). (gconstpointercxx . . $ gconstpointer# data) |
| 339 |
{ |
| 340 |
GdkMemoryFormatcxx . . $ GdkMemoryFormat# format; |
| 341 |
GskRenderercxx . . $ GskRenderer# *renderer; |
| 342 |
GdkTexturecxx . . $ GdkTexture# *input, *output, *expected; |
| 343 |
GskRenderNodecxx . . $ GskRenderNode# *node; |
| 344 |
GdkRGBAcxx . . $ GdkRGBA# colors[2][2]; |
| 345 |
GdkRGBAcxx . . $ GdkRGBA# average_color; |
| 346 |
gsizecxx . . $ gsize# width, height; |
| 347 |
|
| 348 |
decode_renderer_formatcxx . . $ decode_renderer_format(e73ad8afbbd80754). (data, &renderer, &format); |
| 349 |
|
| •350 |
/* Cairo/Pixman and GTK/GL/Vulkan disagree on how to convert 241/256 |
| 351 |
* from floating-point to 8bpp (Cairo says 0xf1, GTK says 0xf0) */ |
| 352 |
if (GSK_IS_CAIRO_RENDERERcxx . . $ `gsk/gskcairorenderer.h:35:9`! (renderer) && |
| 353 |
(gdk_memory_format_get_channel_typecxx . . $ gdk_memory_format_get_channel_type(95b97cafb530af33). (format) == CHANNEL_FLOAT_16cxx . . $ CHANNEL_FLOAT_16. || |
| 354 |
gdk_memory_format_get_channel_typecxx . . $ gdk_memory_format_get_channel_type(95b97cafb530af33). (format) == CHANNEL_FLOAT_32cxx . . $ CHANNEL_FLOAT_32.)) |
| 355 |
{ |
| 356 |
g_test_skipcxx . . $ g_test_skip(85c52e162fed56f9). ("https://gitlab.gnome.org/GNOME/gtk/-/issues/6978"); |
| 357 |
return; |
| 358 |
} |
| 359 |
|
| 360 |
width = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (2, gdk_memory_format_get_block_width (format)); |
| 361 |
height = MAXcxx . . $ `<external>/12741050725406041920/gmacros.h:975:9`! (2, gdk_memory_format_get_block_height (format)); |
| 362 |
|
| 363 |
input = create_stipple_texturecxx . . $ create_stipple_texture(27af413a17b0f2bc). (format, width, height, 1.0, colors, &average_color); |
| 364 |
node = gsk_texture_scale_node_newcxx . . $ gsk_texture_scale_node_new(c5f951f75095ff15). (input, &GRAPHENE_RECT_INITcxx . . $ `<external>/7539008420172022992/graphene-rect.h:50:9`! (0, 0, 1, 1), GSK_SCALING_FILTER_TRILINEARcxx . . $ GSK_SCALING_FILTER_TRILINEAR.); |
| 365 |
output = gsk_renderer_render_texturecxx . . $ gsk_renderer_render_texture(344db4dcc522b590). (renderer, node, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 366 |
expected = create_solid_color_texturecxx . . $ create_solid_color_texture(9bedc66873061b55). (gdk_texture_get_formatcxx . . $ gdk_texture_get_format(1cda2554811ccb0b). (output), 1, 1, &average_color); |
| 367 |
|
| 368 |
compare_texturescxx . . $ compare_textures(97075a2255d03275). (expected, output, FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!); |
| 369 |
|
| 370 |
if (g_test_failedcxx . . $ g_test_failed(b126dc7c1de90089). ()) |
| 371 |
dump_scaling_inputcxx . . $ dump_scaling_input(8c8f5adafc11bf4a). (colors, &average_color); |
| 372 |
|
| 373 |
g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (expected); |
| 374 |
g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (output); |
| 375 |
gsk_render_node_unrefcxx . . $ gsk_render_node_unref(8a7ac56c05ee882). (node); |
| 376 |
g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (input); |
| 377 |
} |
| 378 |
|
| 379 |
static void |
| 380 |
test_linear_filtering_2x2cxx . . $ test_linear_filtering_2x2(e4289f82fef2c2f9). (gconstpointercxx . . $ gconstpointer# data) |
| 381 |
{ |
| 382 |
test_linear_filteringcxx . . $ test_linear_filtering(4b6474a8e98cb88e). (data, 2, 2); |
| 383 |
} |
| 384 |
|
| 385 |
static void |
| 386 |
test_linear_filtering_512x512cxx . . $ test_linear_filtering_512x512(e4289f82fef2c2f9). (gconstpointercxx . . $ gconstpointer# data) |
| 387 |
{ |
| 388 |
test_linear_filteringcxx . . $ test_linear_filtering(4b6474a8e98cb88e). (data, 512, 512); |
| 389 |
} |
| 390 |
|
| 391 |
static void |
| 392 |
add_format_testcxx . . $ add_format_test(81bd98722778c6c3). (const char *name, |
| 393 |
GTestDataFunccxx . . $ GTestDataFunc# func) |
| 394 |
{ |
| 395 |
GdkMemoryFormatcxx . . $ GdkMemoryFormat# format; |
| 396 |
gsizecxx . . $ gsize# renderer; |
| 397 |
GEnumClasscxx . . $ GEnumClass# *enum_class; |
| 398 |
|
| 399 |
enum_class = g_type_class_refcxx . . $ g_type_class_ref(bfcfa4d6b7f7ef64). (GDK_TYPE_MEMORY_FORMATcxx . . $ `build/gdk/gdkenumtypes.h:89:9`!); |
| 400 |
|
| 401 |
for (renderer = 0; renderer < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (renderers); renderer++) |
| 402 |
{ |
| 403 |
if (rendererscxx . . $ renderers.[renderer].renderercxx . . $ $anonymous_type_5d06d3f3e959c38d_0#renderer. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 404 |
continue; |
| 405 |
|
| 406 |
for (format = 0; format < GDK_MEMORY_N_FORMATScxx . . $ GDK_MEMORY_N_FORMATS.; format++) |
| 407 |
{ |
| 408 |
char *test_name = g_strdup_printfcxx . . $ g_strdup_printf(a849077ff1b8d812). ("%s/%s/%s", |
| 409 |
name, |
| 410 |
rendererscxx . . $ renderers.[renderer].namecxx . . $ $anonymous_type_5d06d3f3e959c38d_0#name., |
| 411 |
g_enum_get_valuecxx . . $ g_enum_get_value(d91cd515990c3d81). (enum_class, format)->value_nickcxx . . $ _GEnumValue#value_nick.); |
| 412 |
g_test_add_data_func_fullcxx . . $ g_test_add_data_func_full(2b60da2de2229e7c). (test_name, encode_renderer_formatcxx . . $ encode_renderer_format(924a4541844b4683). (renderer, format), func, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 413 |
g_freecxx . . $ g_free(5d22bdacc48458e8). (test_name); |
| 414 |
} |
| 415 |
} |
| 416 |
} |
| 417 |
|
| 418 |
static void |
| 419 |
create_rendererscxx . . $ create_renderers(49f6e7a06ebc5aa8). (void) |
| 420 |
{ |
| 421 |
GErrorcxx . . $ GError# *error = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 422 |
gsizecxx . . $ gsize# i; |
| 423 |
|
| 424 |
for (i = 0; i < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (renderers); i++) |
| 425 |
{ |
| 426 |
rendererscxx . . $ renderers.[i].renderercxx . . $ $anonymous_type_5d06d3f3e959c38d_0#renderer. = rendererscxx . . $ renderers.[i].create_funccxx . . $ $anonymous_type_5d06d3f3e959c38d_0#create_func. (); |
| 427 |
if (!gsk_renderer_realize_for_displaycxx . . $ gsk_renderer_realize_for_display(c187be717ed7c4e0). (rendererscxx . . $ renderers.[i].renderercxx . . $ $anonymous_type_5d06d3f3e959c38d_0#renderer., gdk_display_get_defaultcxx . . $ gdk_display_get_default(b31d93ef98fc5572). (), &error)) |
| 428 |
{ |
| 429 |
g_test_messagecxx . . $ g_test_message(326aeb464d16410c). ("Could not realize %s renderer: %s", rendererscxx . . $ renderers.[i].namecxx . . $ $anonymous_type_5d06d3f3e959c38d_0#name., error->messagecxx . . $ _GError#message.); |
| 430 |
g_clear_errorcxx . . $ g_clear_error(19f343512d040fc2). (&error); |
| 431 |
g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&renderers[i].renderer); |
| 432 |
} |
| 433 |
} |
| 434 |
} |
| 435 |
|
| 436 |
static void |
| 437 |
destroy_rendererscxx . . $ destroy_renderers(49f6e7a06ebc5aa8). (void) |
| 438 |
{ |
| 439 |
gsizecxx . . $ gsize# i; |
| 440 |
|
| 441 |
for (i = 0; i < G_N_ELEMENTScxx . . $ `<external>/12741050725406041920/gmacros.h:993:9`! (renderers); i++) |
| 442 |
{ |
| 443 |
if (rendererscxx . . $ renderers.[i].renderercxx . . $ $anonymous_type_5d06d3f3e959c38d_0#renderer. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 444 |
continue; |
| 445 |
|
| 446 |
gsk_renderer_unrealizecxx . . $ gsk_renderer_unrealize(bccb4b42e053dc6c). (rendererscxx . . $ renderers.[i].renderercxx . . $ $anonymous_type_5d06d3f3e959c38d_0#renderer.); |
| 447 |
g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&renderers[i].renderer); |
| 448 |
} |
| 449 |
} |
| 450 |
|
| 451 |
int |
| 452 |
maincxx . . $ main(afcd3168fc1188a4). (int argc, char *argv[]) |
| 453 |
{ |
| 454 |
int result; |
| 455 |
|
| 456 |
gtk_test_initcxx . . $ gtk_test_init(b91bcc5cc1349d78). (&argc, &argv, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 457 |
create_rendererscxx . . $ create_renderers(49f6e7a06ebc5aa8). (); |
| 458 |
|
| 459 |
add_format_testcxx . . $ add_format_test(81bd98722778c6c3). ("/scaling/linear-filtering", test_linear_filtering_2x2cxx . . $ test_linear_filtering_2x2(e4289f82fef2c2f9).); |
| 460 |
add_format_testcxx . . $ add_format_test(81bd98722778c6c3). ("/scaling/linear-filtering-large", test_linear_filtering_512x512cxx . . $ test_linear_filtering_512x512(e4289f82fef2c2f9).); |
| 461 |
add_format_testcxx . . $ add_format_test(81bd98722778c6c3). ("/scaling/mipmap", test_mipmapscxx . . $ test_mipmaps(e4289f82fef2c2f9).); |
| 462 |
|
| 463 |
result = g_test_runcxx . . $ g_test_run(b126dc7c1de90089). (); |
| 464 |
|
| 465 |
/* So the context gets actually destroyed */ |
| 466 |
gdk_gl_context_clear_currentcxx . . $ gdk_gl_context_clear_current(49f6e7a06ebc5aa8). (); |
| 467 |
|
| 468 |
destroy_rendererscxx . . $ destroy_renderers(49f6e7a06ebc5aa8). (); |
| 469 |
|
| 470 |
return result; |
| 471 |
} |