Bug 390639 - Application Icon in decoration shown at standard resolution on high DPI screen
Summary: Application Icon in decoration shown at standard resolution on high DPI screen
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: decorations (show other bugs)
Version: 5.12.1
Platform: Neon Linux
: NOR minor
Target Milestone: ---
Assignee: David Edmundson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-17 21:28 UTC by Miroslav Spehar
Modified: 2018-02-23 06:53 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
phone taken picture shows font rendering with Kate on both monitors (left monitor is normaldpi, right is hidpi) (3.71 MB, image/jpeg)
2018-02-17 21:28 UTC, Miroslav Spehar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miroslav Spehar 2018-02-17 21:28:44 UTC
Created attachment 110760 [details]
phone taken picture shows font rendering with Kate on both monitors (left monitor is normaldpi, right is hidpi)

having two monitors, where one is hidpi and the other one is not, the picture on the hidpi monitor is quite worse when compared to the normal-dpi monitor.

scaling on hidpi monitor: 2
scaling on normaldpi monitor: 1
Comment 1 Miroslav Spehar 2018-02-17 21:33:26 UTC
here are two pictures that show also how application icon is rendered (so not only fonts are affected)

https://imgur.com/a/xrkYS
Comment 2 Kai Uwe Broulik 2018-02-20 11:11:53 UTC
It can't split the window in half, it renders at whatever largest scale and then downscales for the other monitor.

What it will eventually do (Qt does not yet support that) is rerender at proper scale once it moves to the other screen.
Comment 3 Miroslav Spehar 2018-02-20 11:31:03 UTC
The point was not on the splitting the window. 

The split i provided just to show how the same window is rendered on different hidpi. If i move the complete window to the hidpi monitor, it is rendered in the same 'bad' manner as in the picture.
Comment 4 Miroslav Spehar 2018-02-20 11:35:55 UTC
Plus, this happens when whole window is on hidpi monitor:
- window titlebar fonts are rendered ok
- window titlebar icon is not rendered ok
- application menu bar is not rendered ok
Comment 5 David Edmundson 2018-02-21 13:23:12 UTC
Decorations are all done properly with the right DPR on the paint device.
QIcon::pixmap() is scaled by the qApp->devicePixelRatio rather than the current paint device.
This works in system settings, and everything looks spot-on.

In kwin  qApp->devicePixelRatio doesn't work, so we get a standard res icon.
Comment 6 Martin Flöser 2018-02-21 16:30:36 UTC
Is this on X11 or Wayland?
Comment 7 Miroslav Spehar 2018-02-21 17:01:36 UTC
Wayland
Comment 8 David Edmundson 2018-02-21 17:13:23 UTC
Fixed with c32eb41292752fd9a82fa258fb93f538f712cb91

Don't know why this didn't auto-close
Comment 9 Miroslav Spehar 2018-02-21 17:52:09 UTC
This only fixes the icon (since bug got categorized as decorations)? Or also the menu bar and the content...?
Comment 10 David Edmundson 2018-02-22 08:39:56 UTC
Git commit c32eb41292752fd9a82fa258fb93f538f712cb91 by David Edmundson.
Committed on 21/02/2018 at 13:35.
Pushed by davidedmundson into branch 'Plasma/5.12'.

Render application icon at paintdevice DPR

Summary:
QIcon::pixmap doesn't know anything about the paint device currently
being used so uses qApp->devicePixelRatio.
This works in systemsettings, but not in kwin and we get a standard
resolution pixmap returned.

We can't manually multiply by painter->device->dpr because then system
settings would get scaled twice.

QIcon::paint solves that in a way that won't break should kwin's
qApp->dpr change. Also it's IMHO cleaner as it does the alignment
internally.

Test Plan:
System settings look the same
Icon in kwin deco is crisper than before

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10713

M  +2    -2    kdecoration/breezebutton.cpp

https://commits.kde.org/breeze/c32eb41292752fd9a82fa258fb93f538f712cb91
Comment 11 David Edmundson 2018-02-22 13:43:26 UTC
>This only fixes the icon (since bug got categorized as decorations)?

Yes.

> Or also the menu bar and the content...?

Is it just icons? If so, they should get fixed with Qt5.11.
Comment 12 Miroslav Spehar 2018-02-22 22:07:34 UTC
It is also menu bar and content that have rendering issue. The pictures show how it looks like (disregard that the window is split between standard and hidpi monitor).

Do i need to open another bug to cover menu bar and content or this can be all done through this one?
Comment 13 Andrew Crouthamel 2018-02-23 05:30:17 UTC
(In reply to David Edmundson from comment #11)
> Is it just icons? If so, they should get fixed with Qt5.11.
Could you elaborate on that?
Comment 14 David Edmundson 2018-02-23 05:36:49 UTC
What's wrong with the menubar?
Comment 15 Andrew Crouthamel 2018-02-23 05:39:07 UTC
(In reply to David Edmundson from comment #14)
> What's wrong with the menubar?

The AppMenu in Kwin is pixelated when scaling on HiDPI. I was curious if Qt 5.11 as you mentioned might resolve that.
Comment 16 Miroslav Spehar 2018-02-23 06:53:59 UTC
Exactly, menu bar and window content are pixelated. If you check the attachment, you'll see the extent of it. 

Most severe effect is seen on '/'. It looks lika a saw.