From 3663d7579b252dde77e1cebc9779a59912ef2a5b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Mon, 22 Feb 2010 11:23:39 +1000 Subject: Add cached path rounded rect painting benchmark. --- .../declarative/painting/paintbenchmark.cpp | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 #include #include +#include #include #include #include @@ -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 }, -- cgit v0.12