Summary: | New setBlurRegion() API gives blocky/aliased blur region corners on Wayland HiDPI | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | Paul McAuley <kde> |
Component: | decorations | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | mrostd, mvourlakos, nate, notmart |
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Screenshot of ClassiK window decoration with 20% opacity titlebars/borders and blur on, corner radius=4, shadows disabled to emphasise bug. The corners exhibit very blocky aliasing.
X11 by contrast. Screenshot of ClassiK window decoration with 20% opacity titlebars/borders and blur on, corner radius=4, shadows disabled to emphasise bug. The corners are very smooth. floating panel |
Description
Paul McAuley
2022-04-30 13:01:25 UTC
Created attachment 148475 [details]
X11 by contrast. Screenshot of ClassiK window decoration with 20% opacity titlebars/borders and blur on, corner radius=4, shadows disabled to emphasise bug. The corners are very smooth.
By contrast here is a similar screenshot on X11. It results in very smooth corners to the blur region.
I should also mention that the above 2 screenshots are at 250% scaling. I was looking into this more, and guessing this is probably because in Wayland scaled rendering is done relative to a smaller 100% scaled grid (e.g. at 250% scaling with a 2840x2160 display, rendering is done relative to 1536x864), so on Wayland you probably need to use floating point values for more precise shapes on screens with scaling > 100%. You can, however, only construct a QRegion using integers (QRect and QPolygon; not QRectF and QPolygonF). In my own window decoration ( https://github.com/paulmcauley/classik/commit/fe48c052f529e889706214c9af3db200fbfdb2a8#diff-1c44374ff8b2c6b8bea9596fe31ea4878a23bea2f62d2ce01dcbdf119dc98474R1319 ) I convert from a QPainterPath (in the shape of the window) to a QPolygonF to a QPolygon and finally to a QRegion. If my assumption about the cause of this problem is correct, I would then propose extending the setBlurRegion() API in the decoration to accept a QPainterPath or a QPolygonF. A QPolygonF can then be easily converted to a QPolygon (just converts qreal to int) and then to a QRegion at the last minute after scaling and directly before the effect is applied to the actual pixels on screen. Created attachment 149902 [details]
floating panel
The problem still exists in the floating panel.
(In reply to Mohammad from comment #3) > Created attachment 149902 [details] > floating panel > > The problem still exists in the floating panel. The setBlurRegion() function is only for window decorations, so this bug wouldn't cover that. That said, the KWindowEffects::enableBlurBehind function used for blurring regions in applications only accepts QRegions as well, so I suspect if they were ever used properly, that under Wayland you would not have smooth corners on HiDPI Wayland with KWindowEffects::enableBlurBehind either. |