Add QPainter benchmark case re clipping primitives exceeding device
Task-number: QTBUG-123054 Change-Id: I7f3af505245817ea7030ff29d6244e4d5ce78e6c Reviewed-by: Hatem ElKharashy <hatem.elkharashy@qt.io>
This commit is contained in:
parent
900d17263d
commit
b05ea7279e
@ -197,6 +197,9 @@ private slots:
|
||||
void drawTransformedSemiTransparentImage();
|
||||
void drawTransformedFilledImage();
|
||||
|
||||
void drawPathExceedingDevice_data();
|
||||
void drawPathExceedingDevice();
|
||||
|
||||
private:
|
||||
void setupBrushes();
|
||||
void createPrimitives();
|
||||
@ -1661,6 +1664,56 @@ void tst_QPainter::drawTransformedFilledImage()
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QPainter::drawPathExceedingDevice_data()
|
||||
{
|
||||
QTest::addColumn<int>("dim");
|
||||
QTest::addColumn<QPainterPath>("path");
|
||||
|
||||
const int dim = 512;
|
||||
QPainterPath p;
|
||||
const int ext = 10 * dim;
|
||||
for (int i = 0; i < ext; i += (ext / 50)) {
|
||||
p.lineTo(ext, i);
|
||||
p.lineTo(0, dim);
|
||||
p.moveTo(0, 0);
|
||||
}
|
||||
|
||||
{
|
||||
QPainterPath preClip;
|
||||
preClip.addRect(0, 0, dim, dim);
|
||||
QTest::newRow("devicesize") << dim << p.intersected(preClip);
|
||||
}
|
||||
|
||||
{
|
||||
QPainterPath preClip;
|
||||
preClip.addRect(0, 0, 2*dim, 2*dim);
|
||||
QTest::newRow("devicesizex2") << dim << p.intersected(preClip);
|
||||
}
|
||||
|
||||
{
|
||||
QPainterPath preClip;
|
||||
preClip.addRect(0, 0, 5*dim, 5*dim);
|
||||
QTest::newRow("devicesizex5") << dim << p.intersected(preClip);
|
||||
}
|
||||
|
||||
QTest::newRow("devicesizex10") << dim << p;
|
||||
}
|
||||
|
||||
void tst_QPainter::drawPathExceedingDevice()
|
||||
{
|
||||
QFETCH(int, dim);
|
||||
QFETCH(QPainterPath, path);
|
||||
|
||||
QImage img(dim, dim, QImage::Format_RGB32);
|
||||
QPainter p(&img);
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
p.setPen(QPen(Qt::black, 3));
|
||||
p.setBrush(Qt::NoBrush);
|
||||
|
||||
QBENCHMARK {
|
||||
p.drawPath(path);
|
||||
}
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QPainter)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user