Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.5.0
-
None
Description
On a pixmap, ::drawPolygon() with a pen of size 1 do not draw all pixels.
For example, drawing a line with drawPolygon() is not the same as drawing with drawLine().
Here is the test to reproduce the issue:
#include <QtTest/QtTest>
#include <QPainter>
#include <QPixmap>
class Test : public QObject{
Q_OBJECT
private slots:
void testLineSize_data()
void testLineSize(){
QPixmap pixmap(20, 1);
pixmap.fill();
QPainter painter(&pixmap);
QPen pen(Qt::black);
QFETCH(int, penSize);
pen.setWidth(penSize);
painter.setPen(pen);
QPolygon polygon;
polygon.putPoints(0, 2, 2, 0, 17, 0);
painter.drawPolygon(polygon);
// painter.drawLine(2, 0, 17, 0); < drawLine is Ok
painter.end();
QImage image = pixmap.toImage();
int nb_pixels = 0;
for(int i=0; i<20; ++i)
QCOMPARE(nb_pixels, 16);
}
};
QTEST_MAIN(Test)
#include "test.moc"