[Gtk4] Fix blurry images on widgets at HiDPI#3397
Open
akurtakov wants to merge 1 commit into
Open
Conversation
On GTK4, GtkPicture measures a GdkTexture by its device-pixel intrinsic size, which inflated widgets at HiDPI. Introduce a custom scale-aware Gtk4-only GdkPaintable (SwtScaledPaintable) that reports the logical intrinsic size while drawing the full-resolution texture, giving crisp images at the correct widget size. Use that paintable into the GtkPicture consumers (Button, Label, ExpandItem, ToolItem) and remove the GTK4 downscale in ImageList.
Contributor
jonahgraham
approved these changes
Jun 23, 2026
jonahgraham
left a comment
Contributor
There was a problem hiding this comment.
It looks ok to me. I have an open question, which I think isn't relevant, but I thought best to check.
|
|
||
| static GdkPaintableFlags swt_scaled_paintable_get_flags (GdkPaintable* paintable) | ||
| { | ||
| return GDK_PAINTABLE_STATIC_SIZE | GDK_PAINTABLE_STATIC_CONTENTS; |
Contributor
There was a problem hiding this comment.
Can the gdk_paintable_snapshot (GDK_PAINTABLE (self->texture)... ever paint differently or need to invalidate? i.e. is the texture always static contents too?
Ref is this demo from GTK4 which checks the child paintable for static
I am not sure this is wrong as we tend to have the paintables (texture) be rather static and recreated when changed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On GTK4, GtkPicture measures a GdkTexture by its device-pixel intrinsic size, which inflated widgets at HiDPI.
Introduce a custom scale-aware Gtk4-only GdkPaintable (SwtScaledPaintable) that reports the logical intrinsic size while drawing the full-resolution texture, giving crisp images at the correct widget size.
Use that paintable into the GtkPicture consumers (Button, Label, ExpandItem, ToolItem) and remove the GTK4 downscale in ImageList.