]> git.saurik.com Git - wxWidgets.git/blob - tests/benchmarks/image.cpp
5e2b4cade99a11f2805dc7e97d8051015d6bbb8b
[wxWidgets.git] / tests / benchmarks / image.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tests/benchmarks/image.cpp
3 // Purpose: wxImage benchmarks
4 // Author: Vadim Zeitlin
5 // Created: 2013-06-30
6 // Copyright: (c) 2013 Vadim Zeitlin <vadim@wxwidgets.org>
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #include "wx/image.h"
11
12 #include "bench.h"
13
14 BENCHMARK_FUNC(LoadBMP)
15 {
16 wxImage image;
17 return image.LoadFile("horse.bmp");
18 }
19
20 BENCHMARK_FUNC(LoadJPEG)
21 {
22 static bool s_handlerAdded = false;
23 if ( !s_handlerAdded )
24 {
25 s_handlerAdded = true;
26 wxImage::AddHandler(new wxJPEGHandler);
27 }
28
29 wxImage image;
30 return image.LoadFile("horse.jpg");
31 }
32
33 BENCHMARK_FUNC(LoadPNG)
34 {
35 static bool s_handlerAdded = false;
36 if ( !s_handlerAdded )
37 {
38 s_handlerAdded = true;
39 wxImage::AddHandler(new wxPNGHandler);
40 }
41
42 wxImage image;
43 return image.LoadFile("horse.png");
44 }
45
46 BENCHMARK_FUNC(LoadTIFF)
47 {
48 static bool s_handlerAdded = false;
49 if ( !s_handlerAdded )
50 {
51 s_handlerAdded = true;
52 wxImage::AddHandler(new wxTIFFHandler);
53 }
54
55 wxImage image;
56 return image.LoadFile("horse.tif");
57 }