This is a separation of one of the issues in
As you can see in the gif by pklaffert, the off by one artifacts are not completely consistent. I managed to figure out where it goes wrong but not quite why:
Using this rectangle as a test case:
With the scaling value 1.5.
When running QBackingStore::beginPaint we transform the paint region with QHighDpi::toNativeLocalRegion which rounds the scaled values to integers resulting in:
The width value was rounded up as per qRound policy 773 * 1.5 = 1159.5 -> 1160
Later when setting the systemClip region in QPaintEngine::updateSystemClip the region is transformed again, but this time using QTransform::map which was updated recently to use the QRectF::toRect rounding. This however results in:
Stepping through the map calculation and this line:
Everything looks good, until toRect retuns and suddenly width is 1159 instead of 1160 that the debugger showed me inside toRect... I would assume that I need to train my asm skills to actually understand whats going wrong here. Maybe it is a bug in msvc? Update: The natvis for QRect and that I forgot QRects width is -1 got me confused, its doing the correct thing, just differently than the highdpiscaling.
To reduce the very glaring issues as seen in the gif, even though the painting is not always updating all pxels, I tried changing the highdpi QRect scaling method to use the same rounding through QRectF::toRect, see attached patch.