Edit: I found out that setting the
gicon property of cell renderer instead of the
pixbuf property, solves the issue completely - icons are now nice and crisp in HighDPI environments. Of course, I’m still curious why the GdkPixbuf approach didn’t work and it could be documented here for others as well, if someone knows why.
I’m using the
GtkCellRendererPixbuf in a
GtkTreeView and the
GdkPixbuf's are fetched with
GdkPixbuf * gtk_icon_theme_load_icon (GtkIconTheme *icon_theme, const gchar *icon_name, gint size, GtkIconLookupFlags flags, GError **error);
size is always constant at 24.
When I launch my application with
GDK_SCALE=2 the dimensions of the image are correct, but it’s an upscaled version, hence blurry:
In order to fix this I tried to use
GdkPixbuf * gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme, const gchar *icon_name, gint size, gint scale, GtkIconLookupFlags flags, GError **error);
size to 24 and
scale to 2 results to both wrong dimensions and and an upscaled/blurrry version. It’s basically the same image quality as before, just with doubled width and height.
I also tried to set
size to 12 and
scale to 2, which also doesn’t work, the dimensions are fine but it’s even blurrier than before.
Is there anything I’m missing or doing wrong to get the
GtkCellRendererPixbuf to correctly render on HiDPI displays?