After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 746044 - background surfaces don't respect hidpi scaling
background surfaces don't respect hidpi scaling
Status: RESOLVED OBSOLETE
Product: gnome-desktop
Classification: Core
Component: libgnome-desktop
3.15.x
Other Linux
: Normal normal
: ---
Assigned To: Desktop Maintainers
Desktop Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-03-11 18:42 UTC by Sebastien Bacher
Modified: 2018-09-21 16:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
small testcase example (951 bytes, text/x-csrc)
2015-03-11 18:42 UTC, Sebastien Bacher
  Details
gnome_bg_create_surface: always honor device scale (1.60 KB, patch)
2015-03-17 12:48 UTC, Lars Karlitski
none Details | Review
gnome_bg_create_surface: always honor device scale (4.55 KB, patch)
2015-03-18 09:28 UTC, Lars Karlitski
none Details | Review

Description Sebastien Bacher 2015-03-11 18:42:34 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
Comment 1 Sebastien Bacher 2015-03-11 18:43:00 UTC
using cairo_surface_set_device_scale() in gnome_bg_create_surface() makes it work, not sure if that's the right fix though
Comment 2 Sebastien Bacher 2015-03-13 18:25:32 UTC
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...
Comment 3 Matthias Clasen 2015-03-13 18:56:21 UTC
gdk_screen_get_width/height return 'application pixels', not 'device pixels'.
Load the image at screen_width * scale
Comment 4 Lars Karlitski 2015-03-17 12:48:21 UTC
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.
Comment 5 Lars Karlitski 2015-03-18 09:28:59 UTC
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.
Comment 6 Sebastien Bacher 2015-03-18 16:35:51 UTC
the patch makes the testcase works fine here
Comment 7 Matthias Clasen 2015-03-18 19:28:42 UTC
thanks for working that out. Looks like a nice patch to pick up for 3.16.1
Comment 8 Bastien Nocera 2015-04-21 15:16:27 UTC
(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.
Comment 9 GNOME Infrastructure Team 2018-09-21 16:42:23 UTC
-- 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.