Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
4.5.0
-
None
-
603c423fc2ee2b9393e3c288e76354de0e0c1cc7
Description
If certain dash dot lines are painted, the result is either garbled, or a crash occurs if the paint device is too small to contain the lines.
This is a regression from Qt 4.4.
The following example reproduces the garbled painting and crash:
#include <QtGui>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QPainter p;
QPen pen;
QColor colorNoAlpha(0,0,0);
colorNoAlpha.setAlpha(255);
pen.setColor(colorNoAlpha);
pen.setWidth(2);
pen.setStyle(Qt::DashDotLine);
QPointF point[4];
point[0] = QPointF(182.50868749707968,347.78457234212630);
point[1] = QPointF(182.50868749707968,107.22501998401277);
point[2] = QPointF(182.50868749707968,107.22501998401277);
point[3] = QPointF(520.46600762283651,107.22501998401277);
QImage badImage(QSize(1000, 1000), QImage::Format_ARGB32_Premultiplied);
p.begin(&badImage);
p.setPen(pen);
p.drawLines(point, 2);
p.end();
badImage.save(QString("%0.png").arg(QT_VERSION_STR));
QImage crashImage(QSize(1000, 120), QImage::Format_ARGB32_Premultiplied);
p.begin(&crashImage);
p.setPen(pen);
p.drawLines(point, 2);
p.end();
return 0;
}