Details
Description
Tested on CentOS7 Qt-5.12, but it seems that the same code ( drawBitmap(), scanLine(), qRound() ) appears in current Qt versions, too.
There is partial back-trace in gdb:
...
#3 0x00007f9ef2007f4b in QMessageLogger::fatal (this=this@entry=0x7ffd14334260, msg=msg@entry=0x7f9ef22c7788 "ASSERT: \"%s\" in file %s, line %d") at global/qlogging.cpp:887
#4 0x00007f9ef2001493 in qt_assert (assertion=assertion@entry=0x7f9eee25cd86 "i >= 0 && i < height()", file=file@entry=0x7f9eee25cd64 "image/qimage.cpp", line=line@entry=1587) at global/qglobal.cpp:3201
#5 0x00007f9eedeec4cd in QImage::scanLine (this=this@entry=0x277d4e0, i=19) at image/qimage.cpp:1587
#6 0x00007f9eee0a372e in QRasterPaintEngine::drawBitmap (this=this@entry=0x101745a0, pos=..., image=..., fg=fg@entry=0x2fe9480) at painting/qpaintengine_raster.cpp:3492
#7 0x00007f9eee0af83f in QRasterPaintEngine::drawPixmap (this=0x101745a0, pos=..., pixmap=...) at painting/qpaintengine_raster.cpp:2129
#8 0x00007f9eee0c5b23 in QPainter::drawPixmap (this=0x7ffd14335270, p=..., pm=...) at painting/qpainter.cpp:5078
#6 0x00007f9eee0a372e in QRasterPaintEngine::drawBitmap (this=this@entry=0x101745a0, pos=..., image=..., fg=fg@entry=0x2fe9480) at painting/qpaintengine_raster.cpp:3492
...
(gdb) frame 6
#6 0x00007f9eee0a372e in QRasterPaintEngine::drawBitmap (this=this@entry=0x101745a0, pos=..., image=..., fg=fg@entry=0x2fe9480) at painting/qpaintengine_raster.cpp:3492
3492 const uchar *src = image.scanLine(y - qRound(pos.y()));
(gdb) p w
$4 = 24
(gdb) p h
$5 = <optimized out> <- But it is 19
(gdb) p ymax
$6 = 46
(gdb) p pos
$8 = (const QPointF &) @0x7ffd14334b80: {xp = 110.89918919389669, yp = 26.499999999999996}
(gdb) p y
$9 = 45
(gdb) frame 5
#5 0x00007f9eedeec4cd in QImage::scanLine (this=this@entry=0x277d4e0, i=19) at image/qimage.cpp:1587
1587 Q_ASSERT(i >= 0 && i < height());
(gdb) p i
$1 = 19
The result for scanLine() is 19, so there is an assertion error inside:
"i >= 0 && i < height()"
I think that mixing floating point calculations for iterating together with strict scanLine() (without additional checks before), is not a good idea. Probably, the function drawBitmap() should iterate via existing image lines, but not via the calculated screen Y coordinate.
Attachments
For Gerrit Dashboard: QTBUG-122451 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
541511,2 | QPainter: fix assert when drawing bitmaps at very near to .5 coord | dev | qt/qtbase | Status: MERGED | +2 | 0 |
541713,2 | QPainter: fix assert when drawing bitmaps at very near to .5 coord | 6.7 | qt/qtbase | Status: MERGED | +2 | 0 |
541781,2 | QPainter: fix assert when drawing bitmaps at very near to .5 coord | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |
541935,2 | QPainter: fix assert when drawing bitmaps at very near to .5 coord | tqtc/lts-6.5 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
542108,2 | QPainter: fix assert when drawing bitmaps at very near to .5 coord | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
542170,2 | QPainter: fix assert when drawing bitmaps at very near to .5 coord | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |