summaryrefslogtreecommitdiff
path: root/src/benchmarks/evas/evas_bench_saver.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@samsung.com>2014-03-14 18:38:30 +0900
committerCedric BAIL <cedric.bail@free.fr>2014-04-01 22:00:14 +0900
commitb56d7bba605d2bd156f438d6dd2da6818474bde3 (patch)
treefc82343be246427bb83260135cb0fcffb9e59d74 /src/benchmarks/evas/evas_bench_saver.c
parent52a36461b8c47099cc9a59e9b4182d8ba79d349e (diff)
evas: add benchmark for TGV loader and saver.
Diffstat (limited to '')
-rw-r--r--src/benchmarks/evas/evas_bench_saver.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/benchmarks/evas/evas_bench_saver.c b/src/benchmarks/evas/evas_bench_saver.c
new file mode 100644
index 0000000000..c278b843e2
--- /dev/null
+++ b/src/benchmarks/evas/evas_bench_saver.c
@@ -0,0 +1,74 @@
1#ifdef HAVE_CONFIG_H
2# include "config.h"
3#endif
4
5#include <fcntl.h>
6#include <unistd.h>
7
8#include "Evas.h"
9#include "Evas_Engine_Buffer.h"
10#include "evas_bench.h"
11
12static const char *
13_test_image_get(const char *name)
14{
15 static char filename[PATH_MAX];
16
17 snprintf(filename, PATH_MAX, TESTS_SRC_DIR"/images/%s", name);
18
19 return filename;
20}
21
22static Evas *
23_setup_evas()
24{
25 Evas *evas;
26 Evas_Engine_Info_Buffer *einfo;
27
28 evas = evas_new();
29
30 evas_output_method_set(evas, evas_render_method_lookup("buffer"));
31 einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(evas);
32
33 einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_RGB32;
34 einfo->info.dest_buffer = malloc(sizeof (char) * 500 * 500 * 4);
35 einfo->info.dest_buffer_row_bytes = 500 * sizeof (char) * 4;
36
37 evas_engine_info_set(evas, (Evas_Engine_Info *)einfo);
38
39 evas_output_size_set(evas, 500, 500);
40 evas_output_viewport_set(evas, 0, 0, 500, 500);
41
42 return evas;
43}
44
45static void
46evas_bench_saver_tgv(int request)
47{
48 Evas *e = _setup_evas();
49 const char *source;
50 Eina_Tmpstr *dest;
51 Evas_Object *o;
52 int i;
53
54 source = _test_image_get("mars_rover_panorama_half-size.jpg");
55 eina_file_mkstemp("evas_saver_benchXXXXXX", &dest);
56
57 o = evas_object_image_add(e);
58 evas_object_image_file_set(o, source, NULL);
59
60 for (i = 0; i < request; i++)
61 {
62 evas_object_image_save(o, dest, NULL, "compress=1 quality=50");
63 }
64
65 unlink(dest);
66 eina_tmpstr_del(dest);
67
68 evas_free(e);
69}
70
71void evas_bench_saver(Eina_Benchmark *bench)
72{
73 eina_benchmark_register(bench, "tgv-saver", EINA_BENCHMARK(evas_bench_saver_tgv), 20, 2000, 100);
74}