diff options
| author | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-02-29 12:01:23 +0100 | 
|---|---|---|
| committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2020-02-29 12:51:26 +0100 | 
| commit | df32a5c6a6f8e204a757f68f0a61ea6f4843c569 (patch) | |
| tree | 3c8de6b28649e0860d67cdb83562baaeffcd80f3 /test/uitests/benchmarktest.cc | |
| parent | e7430f3750cbfeb1bfab96273db7798cb64f7aca (diff) | |
Benchmark test alpha vs. no-alpha with both partial inner and edge alpha and stretched vs. no
stretched.
Diffstat (limited to 'test/uitests/benchmarktest.cc')
| -rw-r--r-- | test/uitests/benchmarktest.cc | 93 | 
1 files changed, 84 insertions, 9 deletions
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);  		}  	}  | 
