Skip to content

[Gtk4] Fix blurry images on widgets at HiDPI#3397

Open
akurtakov wants to merge 1 commit into
eclipse-platform:masterfrom
akurtakov:blurry
Open

[Gtk4] Fix blurry images on widgets at HiDPI#3397
akurtakov wants to merge 1 commit into
eclipse-platform:masterfrom
akurtakov:blurry

Conversation

@akurtakov

Copy link
Copy Markdown
Member

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.

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.
@github-actions

Copy link
Copy Markdown
Contributor

Test Results (linux)

  103 files  ±0    103 suites  ±0   14m 58s ⏱️ -9s
4 606 tests ±0  4 382 ✅ ±0  224 💤 ±0  0 ❌ ±0 
3 410 runs  ±0  3 335 ✅ ±0   75 💤 ±0  0 ❌ ±0 

Results for commit 00df2f6. ± Comparison against base commit cb31ff9.

@jonahgraham jonahgraham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

https://gitlab.gnome.org/GNOME/gtk/-/blob/eddff506651609ff02c641066f51f1c32f1b2fd6/demos/gtk-demo/paintable_emblem.c#L115-121

I am not sure this is wrong as we tend to have the paintables (texture) be rather static and recreated when changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants