Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.9.1
-
None
-
Slackware Linux 14.1
Description
The problem was encountered using QGraphicsView when zooming in on an image; the test program appears to trigger the same issue. Depending on the scale value entered on the command line, the QPainter will either produce a red surface (the expected result) or nothing. In the test program, the scale value of 6 works, 7-12 trigger the issue, and 13 works again.
In src/gui/painting/qpaintengine_raster.cpp, the function
void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr, Qt::ImageConversionFlags)
gets called, where the test
if (s->matrix.type() > QTransform::TxTranslate || stretch_sr)
succeeds and the code block is entered. For the lower values of the scale factor, the first
if (func && (!clip || clip->hasRectClip))
test (that's a few lines below) succeeds, and eventually
template <class SrcT, class DestT, class Blender>
void qt_transform_image_rasterize(...)
in qblendfunctions_p.h is called. There, the line
int x_r = int((topRight.x + (qreal(0.5) + fromY - topRight.y) * rightSlope + qreal(0.5)) * 0x10000);
seems to overflow, causing 'x_r' to become negative, which in turn causes 'toX' to be smaller than 'fromX', and no drawing occurs.
For higher values of the scale factor, that do work again, a different code path is followed in the first function because an 'exceedsPrecision' flag becomes true.