summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks
diff options
context:
space:
mode:
authorBenjamin Poulain <benjamin.poulain@nokia.com>2010-08-04 09:46:40 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2010-08-04 11:00:26 (GMT)
commita214bb99775e898fd9233b932f08ff91a57fc053 (patch)
tree24b8142db51ee55ccb0716e16a12b27c00b513b4 /tests/benchmarks
parentc1bac607f3f3889d367e20c128acf30dc9537ddc (diff)
downloadQt-a214bb99775e898fd9233b932f08ff91a57fc053.zip
Qt-a214bb99775e898fd9233b932f08ff91a57fc053.tar.gz
Qt-a214bb99775e898fd9233b932f08ff91a57fc053.tar.bz2
Implement comp_Source with SSE2 when there is a const alpha
On Atom, comp_Source is 280% faster with the SSE2 implementation. Reviewed-by: Andreas Kling
Diffstat (limited to 'tests/benchmarks')
-rw-r--r--tests/benchmarks/gui/image/blendbench/main.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/benchmarks/gui/image/blendbench/main.cpp b/tests/benchmarks/gui/image/blendbench/main.cpp
index 92d1633..f53654b 100644
--- a/tests/benchmarks/gui/image/blendbench/main.cpp
+++ b/tests/benchmarks/gui/image/blendbench/main.cpp
@@ -103,6 +103,9 @@ class BlendBench : public QObject
private slots:
void blendBench_data();
void blendBench();
+
+ void blendBenchAlpha_data();
+ void blendBenchAlpha();
};
void BlendBench::blendBench_data()
@@ -147,6 +150,35 @@ void BlendBench::blendBench()
}
}
+void BlendBench::blendBenchAlpha_data()
+{
+ blendBench_data();
+}
+
+void BlendBench::blendBenchAlpha()
+{
+ QFETCH(int, brushType);
+ QFETCH(int, compositionMode);
+
+ QImage img(512, 512, QImage::Format_ARGB32_Premultiplied);
+ QImage src(512, 512, QImage::Format_ARGB32_Premultiplied);
+ paint(&src);
+ QPainter p(&img);
+ p.setPen(Qt::NoPen);
+
+ p.setCompositionMode(QPainter::CompositionMode(compositionMode));
+ if (brushType == ImageBrush) {
+ p.setBrush(QBrush(src));
+ } else if (brushType == SolidBrush) {
+ p.setBrush(QColor(127, 127, 127, 127));
+ }
+ p.setOpacity(0.7f);
+
+ QBENCHMARK {
+ p.drawRect(0, 0, 512, 512);
+ }
+}
+
QTEST_MAIN(BlendBench)
#include "main.moc"