Rendering a MemoryTexture creates blurry edges

I have a Gdk.MemoryTexture that contains a rendering with sharp edges.

But when rendering it inside a Gtk.Picture, the edges become blurry (see attached screenshot). Presumably, this is due to the texture being resized when the snapshot function is called?

I would like to control the exact pixels of the picture. The texture always has the correct size for the widget, so it shouldn’t even need to be resized.

The actual issue is inside a larger rust project, but this small C Code has the same blurryness:


I can post the rust code too if required.

Here’s an example of what my texture might look like vs what is being rendered (imgur link because I’m not allowed to attach more images to this post)
https://imgur.com/a/zcdFq4t

I also tried using gtk_snapshot_append_scaled_texture with GskScalingFilter::Nearest, but that changes nothing :confused:

Turned out to be an issue of ignoring Gtk.Widget.get_scale_factor