summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-02-22 01:23:39 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-02-22 01:23:39 (GMT)
commit3663d7579b252dde77e1cebc9779a59912ef2a5b (patch)
treec6c7e207566ebdba600b438e9605473689a19bfe /tests/benchmarks
parent7c56bb7beda9d64737f0446f3a661c2ce146c741 (diff)
downloadQt-3663d7579b252dde77e1cebc9779a59912ef2a5b.zip
Qt-3663d7579b252dde77e1cebc9779a59912ef2a5b.tar.gz
Qt-3663d7579b252dde77e1cebc9779a59912ef2a5b.tar.bz2
Add cached path rounded rect painting benchmark.
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/declarative/painting/paintbenchmark.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/benchmarks/declarative/painting/paintbenchmark.cpp b/tests/benchmarks/declarative/painting/paintbenchmark.cpp
index 9231b67..073e14e 100644
--- a/tests/benchmarks/declarative/painting/paintbenchmark.cpp
+++ b/tests/benchmarks/declarative/painting/paintbenchmark.cpp
@@ -43,6 +43,7 @@
#include <QPixmap>
#include <QImage>
#include <QPainter>
+#include <QPainterPath>
#include <QGLWidget>
#include <QTextLayout>
#include <QVBoxLayout>
@@ -218,6 +219,28 @@ void paint_QPixmapCachedRoundedRect(QPainter &p)
}
}
+void paint_pathCacheRoundedRect(QPainter &p)
+{
+ static bool first = true;
+ static QPainterPath path[lines];
+ if (first) {
+ for (int j = 0; j < lines; ++j) {
+ path[j].addRoundedRect(QRectF(0,0,(j+1)*50, spacing-1), 8, 8);
+ }
+ first = false;
+ }
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.setPen(Qt::black);
+ p.setBrush(Qt::red);
+ for (int i = 0; i < count; i++) {
+ for (int j = 0; j < lines; ++j) {
+ p.translate(0,j*spacing);
+ p.drawPath(path[j]);
+ p.translate(0,-j*spacing);
+ }
+ }
+}
+
void paint_QPixmap63x63_opaque(QPainter &p)
{
static bool first = true;
@@ -290,6 +313,7 @@ struct {
{ "CachedText", &paint_QPixmapCachedText },
{ "RoundedRect", &paint_RoundedRect },
{ "CachedRoundedRect", &paint_QPixmapCachedRoundedRect },
+ { "PathCacheRoundedRect", &paint_pathCacheRoundedRect },
{ "QPixmap63x63_opaque", &paint_QPixmap63x63_opaque },
{ "QPixmap64x64_opaque", &paint_QPixmap64x64_opaque },
{ "QPixmap63x63", &paint_QPixmap63x63 },