https://bugs.kde.org/show_bug.cgi?id=526691

            Bug ID: 526691
           Summary: SVG cursor themes are blurry on scaled outputs when
                    shapes use SVG filters (QtSvg ignores
                    devicePixelRatio)
    Classification: Plasma
           Product: kwin
      Version First 6.7.5
       Reported In:
          Platform: Fedora RPMs
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: wayland-generic
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Created attachment 196853
  --> https://bugs.kde.org/attachment.cgi?id=196853&action=edit
Screenshot showing the bug (left-most) and the cursors with fix applied

DESCRIPTION
SvgCursorReader::load() renders each SVG with QSvgRenderer into a QImage that
has setDevicePixelRatio(devicePixelRatio). QtSvg rasterises everything under an
SVG filter at logical resolution in that case
(https://qt-project.atlassian.net/browse/QTBUG-151165), so cursor themes whose
shapes sit inside a drop-shadow group are upscaled 2x on a 200 % output. Breeze
is unaffected only because its filter is on the separate shadow path.

Observed with a macOS-style cursor theme (Figma drop shadows around the whole
shape): blurry over Plasma surfaces (Qt clients use cursor-shape-v1, so KWin
renders the cursor) and sharp over Chromium windows (which use the XCursor
images).


SUGGESTED WORKAROUND
Render at DPR 1 with the device pixel size and set the ratio afterwards:

```
QImage image(bounds.size() * devicePixelRatio,
QImage::Format_ARGB32_Premultiplied);
image.fill(Qt::transparent);
QPainter painter(&image);
renderer.render(&painter, QRectF(QPointF(0, 0), QSizeF(bounds.size()) *
devicePixelRatio));
painter.end();
image.setDevicePixelRatio(devicePixelRatio);
```

Measured with QtSvg 6.11.2 on the affected theme's arrow at size 30, DPR 2:
mean alpha difference to a librsvg reference drops from 8.4/255 to 0.7/255. Not
built or tested inside KWin itself.

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 44
KDE Plasma Version: 6.7.5
KDE Frameworks Version: 6.30.0
Qt Version: 6.11.2

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to