summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/gui/image/blendbench/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/benchmarks/gui/image/blendbench/main.cpp')
-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 92d1633686..f53654b9bd 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"