There was inconsistency between the rects of:
- Raster images in Zoom to Fit
- Raster images in arbitrary zoom
- SVG images
- The selection rectangle drawn in DocumentView
This inconsistency was only apparent when drawing the selection rect
in View compare mode, resulting in it being drawn 1 pixel off at
some zoom levels/modes but not all.
The cause of this inconsistency was due to how the original QRectF of
the image was rounded to a QRect. Calling QRectF::toRect takes both
the point and the size into account, meaning the size will be rounded up
or down based on how the point was rounded.
The solution was to keep consistent rounding in RasterImageView,
SvgImageView, and DocumentView. using QRectF::toRect in all places
was impossible because RasterImageView resizes mCurrentBuffer
independently to drawing it at the image offset (point and size rounded
independently). Therefore I've changed everything to match.
In effect, this patch:
- Makes the selection rect cleaner by drawing it at an integer rect
- Removes the gap between image and selection rect
- Fixes any inconsistency in the drawing of the selection rect
BEFORE
AFTER