To finish my description of GTK4's "GSK" renderer, I'll new describe the (GLSL) code running on the GPU to do the actual rendering.
And this starts with a handful of common input variables & utilities to output a (clipped) colour, hittest a rounded rectangle, or lookup a point in a texture. That hittest first involves hittesting the unrounded rectangle, then each corner, then combines those latter tests. Different variants are implemented for ES2, GL3, & GL2.
@Anarkat I'm sorry, I'll have to ask you to look up "GTK Scenegraph Kit" for that. All I see is code.