The canvas wasn't pixel-perfect even at 100% zoom when the
devicePixelRatio is non-integral. This change fixes the issue by
teaching Krita to perceive the widget/viewport size in the same manner
as Qt sets up the viewport, and to align the documentOffset to device
pixels.
The canvas image tends to be blurred or contains missing lines, depending on the widget size and document offset. The effect is best observed by using pixel art or images with 1px lines, like {F3961863}. Wraparound mode can make the issue more observable.
What this patch fixes (under fractional DPI scaling):
- The OpenGL canvas and coordinates converter now rounds the widget/viewport size to device pixel which matches the viewport set up by Qt.
- The document offset always snaps to device pixels.
- Observable result: The image is now always rendered pixel-perfect under 100% zoom and with square rotation angles.
- (The leaking checkers issue that I mentioned on IRC is fixed in this patch.)
What this patch does not fix (High DPI issues specific to fractional DPI scaling):
- The ruler is slightly off at certain documentOffset
What this patch does not fix (High DPI issues in general, non-exhaustive):
- Mouse input (unsure about tablet input) for some operations (e.g. colour-picking, painting) are snapped to logical pixels, i.e. some pixels are inaccessible at 100% zoom.
- (Minor) Document offset when panning is snapped to logical pixels, i.e. moving one px when panning may pan the canvas by 0, 1 or 2px depending on the current offset.