Skip to content
Verified Commit cdaba58a authored by snooxx 💤's avatar snooxx 💤
Browse files

Fix HiDPI rendering in game views

Although HiDPI rendering of various UI elements in KSudoku was mostly
fixed over the last years (e.g. via 2293c8c5 in KSudoku and through
patches to various libraries), the main game canvas would still show
pixelated in HiDPI mode.

While QGraphicsScene already uses `qreal` for its coordinate system,
`QPixmap` dimensions and offsets used for rendering sprites as well as
functions passing `int` sizes around were still missing HiDPI
enablement. By implementing the necessary changes, rendering quality can
be improved substantially.

Notes:
  - In selected places rounding is employed strategically to avoid gaps
  with some themes.
  - `setDevicePixelRatio()` for 3D scenes is only needed so sprite
  positioning does not get broken due to HiDPI changes in other
  rendering functions. The general fuzziness when zooming 3D content is
  still there and not specific to HiDPI.

Test Plan:
  - Run KSudoku in HiDPI mode, e.g. with `QT_SCALE_FACTOR=1.9 ksudoku`.
  - Check all themes, as each can highlight different rendering issues.
  - Test every game variant, since lots of them have custom rendering of
  elements.
  - Try cell markers too (Shift + number/letter key or right click).
  - Watch out for hover remnants and rendering gaps, in particular for
  slightly differing fractional scaling factors and when slowly
  increasing window size.
parent 4c38a1b4
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment