summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-12-18 08:53:20 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-12-18 08:53:58 (GMT)
commitd0479bd33c7cd11e1f10de96adfaf9fabe142369 (patch)
tree4036de624cb3f6241b16b306a303743d68411088 /tests/benchmarks/declarative
parentd8c5cb56d58683575842e19a6c849ab042b9dc82 (diff)
downloadQt-d0479bd33c7cd11e1f10de96adfaf9fabe142369.zip
Qt-d0479bd33c7cd11e1f10de96adfaf9fabe142369.tar.gz
Qt-d0479bd33c7cd11e1f10de96adfaf9fabe142369.tar.bz2
Benchmark
Diffstat (limited to 'tests/benchmarks/declarative')
-rw-r--r--tests/benchmarks/declarative/text/tst_text.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/benchmarks/declarative/text/tst_text.cpp b/tests/benchmarks/declarative/text/tst_text.cpp
index 5c57633..e69ecd8 100644
--- a/tests/benchmarks/declarative/text/tst_text.cpp
+++ b/tests/benchmarks/declarative/text/tst_text.cpp
@@ -58,8 +58,10 @@ public:
private slots:
void layout();
void paintLayoutToPixmap();
+ void paintLayoutToPixmap_painterFill();
void document();
void paintDocToPixmap();
+ void paintDocToPixmap_painterFill();
private:
QString m_text;
@@ -125,6 +127,21 @@ void tst_text::paintLayoutToPixmap()
}
}
+void tst_text::paintLayoutToPixmap_painterFill()
+{
+ QTextLayout layout(m_text);
+ QSize size = setupTextLayout(&layout);
+
+ QBENCHMARK {
+ QPixmap img(size);
+ QPainter p(&img);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.fillRect(0, 0, img.width(), img.height(), Qt::transparent);
+ p.setCompositionMode(QPainter::CompositionMode_SourceOver);
+ layout.draw(&p, QPointF(0, 0));
+ }
+}
+
void tst_text::document()
{
QTextControl *control = new QTextControl(m_text);
@@ -151,5 +168,22 @@ void tst_text::paintDocToPixmap()
}
}
+void tst_text::paintDocToPixmap_painterFill()
+{
+ QTextControl *control = new QTextControl;
+ QTextDocument *doc = control->document();
+ doc->setHtml(m_text);
+ QSize size = doc->size().toSize();
+
+ QBENCHMARK {
+ QPixmap img(size);
+ QPainter p(&img);
+ p.setCompositionMode(QPainter::CompositionMode_Source);
+ p.fillRect(0, 0, img.width(), img.height(), Qt::transparent);
+ p.setCompositionMode(QPainter::CompositionMode_SourceOver);
+ control->drawContents(&p, QRectF(QPointF(0, 0), QSizeF(size)));
+ }
+}
+
QTEST_MAIN(tst_text)
#include "tst_text.moc"