Skip to content

Fix 'Fit Page' under fractional DPI scaling

Alvin Wong requested to merge alvinwong/krita:fit-page-zoom-fix into master

This fixes the 'Fit Page' zoom mode under fractional DPI scaling. Before this fix, the canvas would not properly fit the canvas widget.

Test Plan

  1. Set the scale factor of the monitor to 150% (or other non-integral scales). (It appears that using QT_SCREEN_SCALE_FACTORS to override the scaling doesn't work properly.)
  2. Open a file (a relatively small image, e.g. 256x256, with a 1px coloured border works best) in Krita (with high DPI and fractional DPI scaling enabled).
  3. Zoom to 100%, then trigger 'Fit to Page' action (press 2).
  4. Observe the canvas. Trigger 'Fit to Page' action again and verify that no jump in the zoom level occurred.
  5. Using the Windows magnifier program or by zooming in a screenshot, verify the top+bottom (or left+right) edges are coincident with the edges of the canvas widget.

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