Skip to content

Draw reference images in high res on 4k display

Before this commit, reference images would be stored in a buffer which size was not determined by the actual size of the area in pixels which was available for the QPainter, but that size scaled down by devicePixelRatioF(). Hence on high resolution displays all reference images would look blurry and low-res.

This commit fixes this behaviour by introducing high-res buffer and making sure that it takes the reference image from the mipmap which size is the closest to the actual new size instead of the one that is scaled down because of the UI scaling (devicePixelRatioF()).

I also changed the way the pixel art images (or any images that are being enlarged) are drawn: now they use FastTransformation instead of SmoothTransformation. They look nicer that way.

BUG:411118

Test Plan

This file shows that the rotation of a pixel art image can be a bit ugly, but I think it's still an improvement. In all other cases this version is better than the old one. pixel_art_ref_with_rotation.kra

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

Merge request reports