summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-02-29 12:01:23 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2020-02-29 12:51:26 +0100
commitdf32a5c6a6f8e204a757f68f0a61ea6f4843c569 (patch)
tree3c8de6b28649e0860d67cdb83562baaeffcd80f3 /test
parente7430f3750cbfeb1bfab96273db7798cb64f7aca (diff)
Benchmark test alpha vs. no-alpha with both partial inner and edge alpha and stretched vs. no
stretched.
Diffstat (limited to 'test')
-rw-r--r--test/uitests/Makefile.am10
-rw-r--r--test/uitests/benchmarktest.cc93
-rw-r--r--test/uitests/benchmarktest_resources/image_edge_alpha.pngbin0 -> 2196 bytes
-rw-r--r--test/uitests/benchmarktest_resources/image_full_alpha.pngbin0 -> 740 bytes
-rw-r--r--test/uitests/benchmarktest_resources/image_inner_alpha.pngbin0 -> 2712 bytes
-rw-r--r--test/uitests/benchmarktest_resources/image_no_alpha.pngbin0 -> 643 bytes
6 files changed, 94 insertions, 9 deletions
diff --git a/test/uitests/Makefile.am b/test/uitests/Makefile.am
index e85190f..c47af23 100644
--- a/test/uitests/Makefile.am
+++ b/test/uitests/Makefile.am
@@ -37,6 +37,15 @@ framewidgettest_SOURCES = \
framewidgettest.cc \
$(top_srcdir)/hugin/hugin.c
+RES = \
+ benchmarktest_resources/image_no_alpha.png \
+ benchmarktest_resources/image_full_alpha.png \
+ benchmarktest_resources/image_edge_alpha.png \
+ benchmarktest_resources/image_inner_alpha.png
+
+benchmarktest_resource_data.cc : $(top_srcdir)/plugingui/rcgen $(RES)
+ $(top_srcdir)/plugingui/rcgen $(RES) > benchmarktest_resource_data.cc
+
benchmarktest_LDADD = \
$(top_srcdir)/plugingui/libdggui.la $(top_srcdir)/src/libdg.la
benchmarktest_CXXFLAGS = \
@@ -45,4 +54,5 @@ benchmarktest_CXXFLAGS = \
-I$(top_srcdir)/hugin
benchmarktest_SOURCES = \
benchmarktest.cc \
+ benchmarktest_resource_data.cc \
$(top_srcdir)/hugin/hugin.c
diff --git a/test/uitests/benchmarktest.cc b/test/uitests/benchmarktest.cc
index c304877..b240388 100644
--- a/test/uitests/benchmarktest.cc
+++ b/test/uitests/benchmarktest.cc
@@ -78,29 +78,104 @@ int main()
{
TimedCanvas canvas;
GUI::Painter painter(canvas);
- GUI::Image image(":resources/bg.png");
+ GUI::Image image_no_alpha(":benchmarktest_resources/image_no_alpha.png");
+ GUI::Image image_full_alpha(":benchmarktest_resources/image_full_alpha.png");
+ GUI::Image image_edge_alpha(":benchmarktest_resources/image_edge_alpha.png");
+ GUI::Image image_inner_alpha(":benchmarktest_resources/image_inner_alpha.png");
{
- TimedScope timed("No scale", 10000);
- for(int i = 0; i < 10000; ++i)
+ TimedScope timed("No scale, no alpha", 100000);
+ for(int i = 0; i < 100000; ++i)
{
- painter.drawImage(0, 0, image);
+ painter.drawImage(0, 0, image_no_alpha);
}
}
{
- TimedScope timed("Scaled 1:1", 2000);
- for(int i = 0; i < 2000; ++i)
+ TimedScope timed("No scale, full alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImage(0, 0, image_full_alpha);
+ }
+ }
+
+ {
+ TimedScope timed("No scale, edge alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImage(0, 0, image_edge_alpha);
+ }
+ }
+
+ {
+ TimedScope timed("No scale, inner alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImage(0, 0, image_inner_alpha);
+ }
+ }
+
+ {
+ TimedScope timed("Scaled 1:1 no alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImageStretched(0, 0, image_no_alpha, 370, 330);
+ }
+ }
+
+ {
+ TimedScope timed("Scaled 1:1 full alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImageStretched(0, 0, image_full_alpha, 370, 330);
+ }
+ }
+
+ {
+ TimedScope timed("Scaled 1:1 edge alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImageStretched(0, 0, image_edge_alpha, 370, 330);
+ }
+ }
+
+ {
+ TimedScope timed("Scaled 1:1 inner alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImageStretched(0, 0, image_inner_alpha, 370, 330);
+ }
+ }
+
+ {
+ TimedScope timed("Scaled to window, no alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImageStretched(0, 0, image_no_alpha, 800, 600);
+ }
+ }
+
+ {
+ TimedScope timed("Scaled to window, full alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
+ {
+ painter.drawImageStretched(0, 0, image_full_alpha, 800, 600);
+ }
+ }
+
+ {
+ TimedScope timed("Scaled to window, edge alpha", 1000);
+ for(int i = 0; i < 1000; ++i)
{
- painter.drawImageStretched(0, 0, image, 370, 330);
+ painter.drawImageStretched(0, 0, image_edge_alpha, 800, 600);
}
}
{
- TimedScope timed("Scaled to window", 1000);
+ TimedScope timed("Scaled to window, inner alpha", 1000);
for(int i = 0; i < 1000; ++i)
{
- painter.drawImageStretched(0, 0, image, 800, 6000);
+ painter.drawImageStretched(0, 0, image_inner_alpha, 800, 600);
}
}
diff --git a/test/uitests/benchmarktest_resources/image_edge_alpha.png b/test/uitests/benchmarktest_resources/image_edge_alpha.png
new file mode 100644
index 0000000..c8ee0fc
--- /dev/null
+++ b/test/uitests/benchmarktest_resources/image_edge_alpha.png
Binary files differ
diff --git a/test/uitests/benchmarktest_resources/image_full_alpha.png b/test/uitests/benchmarktest_resources/image_full_alpha.png
new file mode 100644
index 0000000..84bd697
--- /dev/null
+++ b/test/uitests/benchmarktest_resources/image_full_alpha.png
Binary files differ
diff --git a/test/uitests/benchmarktest_resources/image_inner_alpha.png b/test/uitests/benchmarktest_resources/image_inner_alpha.png
new file mode 100644
index 0000000..9392653
--- /dev/null
+++ b/test/uitests/benchmarktest_resources/image_inner_alpha.png
Binary files differ
diff --git a/test/uitests/benchmarktest_resources/image_no_alpha.png b/test/uitests/benchmarktest_resources/image_no_alpha.png
new file mode 100644
index 0000000..4995156
--- /dev/null
+++ b/test/uitests/benchmarktest_resources/image_no_alpha.png
Binary files differ