GNOME Bugzilla – Bug 746044
background surfaces don't respect hidpi scaling
Last modified: 2018-09-21 16:42:23 UTC
Created attachment 299122 [details] small testcase example Trying to set the bg with a scaling factor set results in only a part of the bg to render small testcase attached to compile: $ gcc -o background background.c `pkg-config --cflags --libs glib-2.0 gdk-3.0 gdk-x11-3.0 gio-2.0 gnome-desktop-3.0` to try - stop other things to render the bg - run GDK_SCALE=2 ./background - look at the result example image https://launchpadlibrarian.net/199725021/1747574623.jpg
using cairo_surface_set_device_scale() in gnome_bg_create_surface() makes it work, not sure if that's the right fix though
hum, get_scaled_pixbuf() doesn't seem to scale the pixbuf, maybe it should? not sure what part of the stack is supposed to do the scaling in those cases, gdk returns monitor geometry info which are half the real resolution and those are the value used to get the pixbuf, which is too small then...
gdk_screen_get_width/height return 'application pixels', not 'device pixels'. Load the image at screen_width * scale
Created attachment 299588 [details] [review] gnome_bg_create_surface: always honor device scale > gdk_screen_get_width/height return 'application pixels', not 'device pixels'. > Load the image at screen_width * scale That still leaves the device scale of the returned surface to be different than the one on the passed-in window. The attached patch fixes that. Note that this still has a bug: we actually want to paint the image into the surface at ×1, regardless of what scale the target surface has. Right now we don't do that, which results in loading full-size backgrounds at one quarter of the size and scaling them up on ×2 hidpi screens.
Created attachment 299687 [details] [review] gnome_bg_create_surface: always honor device scale Update the patch to make sure the image is drawn at native resolution even when a scale factor is set.
the patch makes the testcase works fine here
thanks for working that out. Looks like a nice patch to pick up for 3.16.1
(In reply to Lars Uebernickel from comment #5) > Created attachment 299687 [details] [review] [review] > gnome_bg_create_surface: always honor device scale > > Update the patch to make sure the image is drawn at native resolution even > when > a scale factor is set. Does that one fix the bug mentioned in comment 4? If so, looks fine to commit now.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-desktop/issues/59.