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 742395 - Default user avatar icon looks fuzzy on HiDPI screen
Default user avatar icon looks fuzzy on HiDPI screen
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: User Accounts
3.14.x
Other Linux
: Normal normal
: ---
Assigned To: Ondrej Holy
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-01-05 16:29 UTC by Andreas Nilsson
Modified: 2015-01-20 16:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
screenshot (87.62 KB, image/png)
2015-01-05 16:29 UTC, Andreas Nilsson
  Details
support hidpi for user's avatar (1.54 KB, patch)
2015-01-07 14:58 UTC, Ondrej Holy
needs-work Details | Review
support hidpi for user's avatar (13.91 KB, patch)
2015-01-13 11:54 UTC, Ondrej Holy
needs-work Details | Review
screenshot with patch (112.01 KB, image/png)
2015-01-13 11:55 UTC, Ondrej Holy
  Details
user-accounts: render user's icons as surface with scale (11.58 KB, patch)
2015-01-14 13:49 UTC, Ondrej Holy
committed Details | Review
user-accounts: hidpi support for user's icons (10.23 KB, patch)
2015-01-14 13:50 UTC, Ondrej Holy
committed Details | Review
user-accounts: hidpi support for user's icons in tree view (13.75 KB, patch)
2015-01-14 13:51 UTC, Ondrej Holy
committed Details | Review

Description Andreas Nilsson 2015-01-05 16:29:44 UTC
Created attachment 293840 [details]
screenshot

On a 13" inch laptop with 3200x1800 screen.

The avatar icon looks fuzzy and pixelated.
Comment 1 Ondrej Holy 2015-01-07 14:58:44 UTC
Created attachment 294036 [details] [review]
support hidpi for user's avatar

Attached patch fixes it only for GtkImage. It is achieved using cairo surface and scale factor. Not sure if there isn't better way how to do that...

However I'm quite afraid it isn't possible to fix it for tree view, is it?
Comment 2 Ondrej Holy 2015-01-09 18:12:57 UTC
Comment on attachment 294036 [details] [review]
support hidpi for user's avatar

Working on a fix for the Tree View also (alex gave me help)...
Comment 3 Ondrej Holy 2015-01-13 11:54:10 UTC
Created attachment 294419 [details] [review]
support hidpi for user's avatar

There is modified patch which adds hidpi support also for avatars in treeview and tracks scale-factor changes...

It can be easily tested using GtkInspector -> Visual -> Window scaling.
Comment 4 Ondrej Holy 2015-01-13 11:55:14 UTC
Created attachment 294420 [details]
screenshot with patch
Comment 5 Bastien Nocera 2015-01-13 12:38:15 UTC
Review of attachment 294419 [details] [review]:

::: panels/user-accounts/um-user-panel.c
@@ +878,3 @@
+/* Update pixbufs according current scale factor */
+static void
+scale_changed (GObject    *object,

This needs to be split up, and handled individually by each widget instead.

@@ +931,1 @@
         image = get_widget (d, "user-icon-image");

I would make user-icon-image and user-icon-image2 a GtkImage subclass, and handle the scale-factor change there.

@@ +1645,2 @@
         column = gtk_tree_view_column_new ();
         cell = gtk_cell_renderer_pixbuf_new ();

Ditto, a cell renderer subclass would make it way nicer.

::: panels/user-accounts/um-utils.h
@@ +76,3 @@
 gchar *  get_smart_date                   (GDateTime *date);
 
+cairo_surface_t *render_user_icon         (ActUser         *user,

You can land this as a separate commit, and change the callers to use "scale = 1" before making the other changes.
Comment 6 Ondrej Holy 2015-01-14 13:49:23 UTC
Created attachment 294526 [details] [review]
user-accounts: render user's icons as surface with scale

There is separate commit with scale = 1.
Comment 7 Ondrej Holy 2015-01-14 13:50:23 UTC
Created attachment 294527 [details] [review]
user-accounts: hidpi support for user's icons

GtkImage subclass to handle that...
Comment 8 Ondrej Holy 2015-01-14 13:51:14 UTC
Created attachment 294528 [details] [review]
user-accounts: hidpi support for user's icons in tree view

GtkCellRendererPixbuf subclass...
Comment 9 Bastien Nocera 2015-01-20 14:26:06 UTC
Review of attachment 294526 [details] [review]:

Looks good otherwise.

::: panels/user-accounts/um-utils.c
@@ +943,3 @@
         /* Draw border */
+        cairo_set_line_width (cr, 0.9 * scale);
+        cairo_arc (cr, width - 8.5 * scale, height - 8.5 * scale, 6 * scale, 0, 2 * G_PI);

Did you mean:
(width - 8.5) * scale
or:
width - 8.5 * scale
?

Ditto with height.
Comment 10 Bastien Nocera 2015-01-20 14:28:47 UTC
Review of attachment 294527 [details] [review]:

Looks good otherwise.

::: panels/user-accounts/um-user-image.c
@@ +32,3 @@
+enum {
+        PROP_0,
+        PROP_USER

As you don't use the property anyway, just remove all the property related code in here.
Comment 11 Bastien Nocera 2015-01-20 14:30:56 UTC
Review of attachment 294528 [details] [review]:

Looks good.
Comment 12 Ondrej Holy 2015-01-20 15:40:53 UTC
Thanks for reviews, I will fix it and commit...

(In reply to comment #9)
> Review of attachment 294526 [details] [review]:
> 
> Looks good otherwise.
> 
> ::: panels/user-accounts/um-utils.c
> @@ +943,3 @@
>          /* Draw border */
> +        cairo_set_line_width (cr, 0.9 * scale);
> +        cairo_arc (cr, width - 8.5 * scale, height - 8.5 * scale, 6 * scale,
> 0, 2 * G_PI);
> 
> Did you mean:
> (width - 8.5) * scale
> or:
> width - 8.5 * scale
> ?

I mean "width - 8.5 * scale" without parenthesis, because width and height comes from the pixbuf (and the pixbuf is double sized for GDK_SCALE=2).
Comment 13 Ondrej Holy 2015-01-20 16:10:56 UTC
Comment on attachment 294526 [details] [review]
user-accounts: render user's icons as surface with scale

commit 006b5970a63c3e5df6769b61ffc3c75534e948e7
Comment 14 Ondrej Holy 2015-01-20 16:11:13 UTC
Comment on attachment 294527 [details] [review]
user-accounts: hidpi support for user's icons

commit 5c305302719a2e2cc58c09d499fe84efd942ad26
Comment 15 Ondrej Holy 2015-01-20 16:11:32 UTC
Comment on attachment 294528 [details] [review]
user-accounts: hidpi support for user's icons in tree view

commit 006b5970a63c3e5df6769b61ffc3c75534e948e7