QPainter: add a benchmark for setPen/setBrush
For the simple case of setting a solid style pen or brush with a color, which is what we do most in Qt. Change-Id: Ie90a842ee9638f04941855dfd2e9211235db6cce Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
parent
cf45ae08bc
commit
97ca5fd859
@ -200,6 +200,9 @@ private slots:
|
||||
void drawPathExceedingDevice_data();
|
||||
void drawPathExceedingDevice();
|
||||
|
||||
void setPen();
|
||||
void setBrush();
|
||||
|
||||
private:
|
||||
void setupBrushes();
|
||||
void createPrimitives();
|
||||
@ -1715,6 +1718,29 @@ void tst_QPainter::drawPathExceedingDevice()
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QPainter::setPen()
|
||||
{
|
||||
QImage img(20, 20, QImage::Format_RGB32);
|
||||
QPainter p(&img);
|
||||
|
||||
QBENCHMARK {
|
||||
p.setPen(Qt::black);
|
||||
p.setPen(Qt::red);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QPainter::setBrush()
|
||||
{
|
||||
QImage img(20, 20, QImage::Format_RGB32);
|
||||
QPainter p(&img);
|
||||
|
||||
QBENCHMARK {
|
||||
p.setBrush(Qt::black);
|
||||
p.setBrush(Qt::red);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN(tst_QPainter)
|
||||
|
||||
#include "tst_qpainter.moc"
|
||||
|
Loading…
x
Reference in New Issue
Block a user