Fix 'Fit Page' under fractional DPI scaling
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
- 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.) - 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).
- Zoom to 100%, then trigger 'Fit to Page' action (press 2).
- Observe the canvas. Trigger 'Fit to Page' action again and verify that no jump in the zoom level occurred.
- 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.