From df32a5c6a6f8e204a757f68f0a61ea6f4843c569 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 29 Feb 2020 12:01:23 +0100 Subject: Benchmark test alpha vs. no-alpha with both partial inner and edge alpha and stretched vs. no stretched. --- test/uitests/Makefile.am | 10 +++ test/uitests/benchmarktest.cc | 93 +++++++++++++++++++-- .../benchmarktest_resources/image_edge_alpha.png | Bin 0 -> 2196 bytes .../benchmarktest_resources/image_full_alpha.png | Bin 0 -> 740 bytes .../benchmarktest_resources/image_inner_alpha.png | Bin 0 -> 2712 bytes .../benchmarktest_resources/image_no_alpha.png | Bin 0 -> 643 bytes 6 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 test/uitests/benchmarktest_resources/image_edge_alpha.png create mode 100644 test/uitests/benchmarktest_resources/image_full_alpha.png create mode 100644 test/uitests/benchmarktest_resources/image_inner_alpha.png create mode 100644 test/uitests/benchmarktest_resources/image_no_alpha.png (limited to 'test/uitests') 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 Binary files /dev/null and b/test/uitests/benchmarktest_resources/image_edge_alpha.png 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 Binary files /dev/null and b/test/uitests/benchmarktest_resources/image_full_alpha.png 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 Binary files /dev/null and b/test/uitests/benchmarktest_resources/image_inner_alpha.png 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 Binary files /dev/null and b/test/uitests/benchmarktest_resources/image_no_alpha.png differ -- cgit v1.2.3