diff options
author | Savio Sena <savio.sena@acm.org> | 2014-08-24 07:48:21 -0300 |
---|---|---|
committer | Savio Sena <savio.sena@acm.org> | 2014-08-24 07:49:32 -0300 |
commit | bebe73caa4076763313678d40223946fc0dde857 (patch) | |
tree | c7cedf8a48a47c0ecc84b0bbaf55d559f8e9e2f5 | |
parent | 8682064e4ce4c152a12875ac73e863aa88a12212 (diff) |
expedite++: First C++ test.
-rw-r--r-- | configure.ac | 8 | ||||
-rw-r--r-- | src/bin/Makefile.am | 5 | ||||
-rw-r--r-- | src/bin/about.h | 8 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_border.cc | 92 | ||||
-rw-r--r-- | src/bin/cxx/image_blend_border_cxx.c | 25 | ||||
-rw-r--r-- | src/bin/main.hh | 38 | ||||
-rw-r--r-- | src/bin/tests.h | 13 | ||||
-rw-r--r-- | src/bin/ui.h | 8 |
8 files changed, 192 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac index 009be02..5a26d97 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -10,7 +10,7 @@ AC_CONFIG_HEADERS([config.h]) | |||
10 | AC_CANONICAL_BUILD | 10 | AC_CANONICAL_BUILD |
11 | AC_CANONICAL_HOST | 11 | AC_CANONICAL_HOST |
12 | 12 | ||
13 | AM_INIT_AUTOMAKE([1.6 dist-bzip2]) | 13 | AM_INIT_AUTOMAKE([1.6 dist-bzip2 subdir-objects]) |
14 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) | 14 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
15 | 15 | ||
16 | PKG_PROG_PKG_CONFIG | 16 | PKG_PROG_PKG_CONFIG |
@@ -59,7 +59,7 @@ EFL_ENABLE_BETA_API_SUPPORT | |||
59 | 59 | ||
60 | # EFL++ dependencies | 60 | # EFL++ dependencies |
61 | 61 | ||
62 | PKG_CHECK_MODULES([EFL_CXX], eina-cxx >= 1.11.0 eo-cxx >= 1.11.0 evas-cxx >= 1.11.0 eet-cxx >= 1.11.0) | 62 | PKG_CHECK_MODULES([EFL_CXX], efl-cxx >= 1.11.99 eina-cxx >= 1.11.99 eo-cxx >= 1.11.99 evas-cxx >= 1.11.99 eet-cxx >= 1.11.99) |
63 | 63 | ||
64 | ### Checks for header files | 64 | ### Checks for header files |
65 | 65 | ||
@@ -97,9 +97,9 @@ AC_MSG_CHECKING([whether the compiler supports -fno-rtti -fno-exceptions]) | |||
97 | AC_MSG_RESULT([${have_cxx_flags}]) | 97 | AC_MSG_RESULT([${have_cxx_flags}]) |
98 | CXXFLAGS="${CXXFLAGS_save}" | 98 | CXXFLAGS="${CXXFLAGS_save}" |
99 | if test "x${have_cxx_flags}" = "xyes" ; then | 99 | if test "x${have_cxx_flags}" = "xyes" ; then |
100 | EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions -std=c++11" | 100 | EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions" |
101 | fi | 101 | fi |
102 | CXXFLAGS="{CXXFLAGS} -std=c++11" | 102 | CXXFLAGS="${CXXFLAGS} -std=c++11" |
103 | 103 | ||
104 | AC_LANG_POP([C++]) | 104 | AC_LANG_POP([C++]) |
105 | AC_SUBST(EXPEDITE_CXXFLAGS) | 105 | AC_SUBST(EXPEDITE_CXXFLAGS) |
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 68680ab..edb9e2a 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am | |||
@@ -7,6 +7,7 @@ AM_CPPFLAGS = \ | |||
7 | -DPACKAGE_LIB_DIR=\"$(libdir)\" \ | 7 | -DPACKAGE_LIB_DIR=\"$(libdir)\" \ |
8 | -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ | 8 | -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ |
9 | @EFL_CFLAGS@ \ | 9 | @EFL_CFLAGS@ \ |
10 | @EFL_CXX_CFLAGS@ \ | ||
10 | @EVIL_CFLAGS@ | 11 | @EVIL_CFLAGS@ |
11 | 12 | ||
12 | bin_PROGRAMS = expedite | 13 | bin_PROGRAMS = expedite |
@@ -48,6 +49,8 @@ image_blend_nearest_solid_same_scaled.c \ | |||
48 | image_blend_smooth_same_scaled.c \ | 49 | image_blend_smooth_same_scaled.c \ |
49 | image_blend_smooth_solid_same_scaled.c \ | 50 | image_blend_smooth_solid_same_scaled.c \ |
50 | image_blend_border.c \ | 51 | image_blend_border.c \ |
52 | cxx/image_blend_border.cc \ | ||
53 | cxx/image_blend_border_cxx.c \ | ||
51 | image_blend_solid_middle_border.c \ | 54 | image_blend_solid_middle_border.c \ |
52 | image_blend_solid_border.c \ | 55 | image_blend_solid_border.c \ |
53 | image_blend_border_recolor.c \ | 56 | image_blend_border_recolor.c \ |
@@ -131,7 +134,7 @@ font_effect_blur_color.c | |||
131 | 134 | ||
132 | expedite_CFLAGS = @WIN32_CFLAGS@ | 135 | expedite_CFLAGS = @WIN32_CFLAGS@ |
133 | expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@ | 136 | expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@ |
134 | expedite_LDADD = @EFL_LIBS@ @EVIL_LIBS@ -lm | 137 | expedite_LDADD = @EFL_LIBS@ @EFL_CXX_LIBS@ @EVIL_LIBS@ -lm |
135 | expedite_LDFLAGS = @lt_enable_auto_import@ | 138 | expedite_LDFLAGS = @lt_enable_auto_import@ |
136 | 139 | ||
137 | .rc.lo: | 140 | .rc.lo: |
diff --git a/src/bin/about.h b/src/bin/about.h index 04e4ea2..3e730a4 100644 --- a/src/bin/about.h +++ b/src/bin/about.h | |||
@@ -1,6 +1,14 @@ | |||
1 | #ifndef ABOUT_H | 1 | #ifndef ABOUT_H |
2 | #define ABOUT_H | 2 | #define ABOUT_H |
3 | 3 | ||
4 | #ifdef __cplusplus | ||
5 | extern "C" { | ||
6 | #endif | ||
7 | |||
4 | void about_start(void); | 8 | void about_start(void); |
5 | 9 | ||
10 | #ifdef __cplusplus | ||
11 | } | ||
12 | #endif | ||
13 | |||
6 | #endif | 14 | #endif |
diff --git a/src/bin/cxx/image_blend_border.cc b/src/bin/cxx/image_blend_border.cc new file mode 100644 index 0000000..cf4970c --- /dev/null +++ b/src/bin/cxx/image_blend_border.cc | |||
@@ -0,0 +1,92 @@ | |||
1 | |||
2 | #ifdef HAVE_CONFIG_H | ||
3 | # include <config.h> | ||
4 | #endif | ||
5 | |||
6 | #undef FNAME | ||
7 | #undef NAME | ||
8 | #undef ICON | ||
9 | |||
10 | /* metadata */ | ||
11 | #define FNAME image_blend_border_start_cxx | ||
12 | #define NAME "Image Blend Border (C++)" | ||
13 | #define ICON "blend.png" | ||
14 | |||
15 | #include "Eo.h" | ||
16 | #include "Evas.h" | ||
17 | |||
18 | #include "main.hh" | ||
19 | |||
20 | #include "Eo.hh" | ||
21 | #include "Eina.hh" | ||
22 | #include "Evas.hh" | ||
23 | |||
24 | namespace _ctx { | ||
25 | evas::canvas evas; | ||
26 | efl::eina::list<evas::image> images; | ||
27 | } | ||
28 | |||
29 | /* standard var */ | ||
30 | static int done = 0; | ||
31 | |||
32 | /* setup */ | ||
33 | static void _setup() | ||
34 | { | ||
35 | int i; | ||
36 | Evas_Object *o; | ||
37 | for (i = 0; i < OBNUM; i++) | ||
38 | { | ||
39 | evas::image o(efl::eo::parent = _ctx::evas); | ||
40 | _ctx::images.push_back(o); | ||
41 | o.file_set(::build_path("bar.png"), ""); // XXX | ||
42 | o.border_set(6, 6, 6, 6); | ||
43 | o.visibility_set(true); | ||
44 | } | ||
45 | done = 0; | ||
46 | } | ||
47 | |||
48 | /* cleanup */ | ||
49 | static void _cleanup() | ||
50 | { | ||
51 | _ctx::images.clear(); | ||
52 | } | ||
53 | |||
54 | /* loop - do things */ | ||
55 | static void _loop(double t, int f) | ||
56 | { | ||
57 | int i = 0; | ||
58 | Evas_Coord x, y, w, h, w0, h0; | ||
59 | |||
60 | for (auto it = _ctx::images.begin(), end = _ctx::images.end(); it != end; it++, i++) | ||
61 | { | ||
62 | w0 = 80; | ||
63 | h0 = 80; | ||
64 | w = 5 + ((1.0 + cos((double)(f + (i * 10)) / (7.4 * SLOW) )) * w0 * 2); | ||
65 | h = 5 + ((1.0 + sin((double)(f + (i * 19)) / (12.6 * SLOW) )) * h0 * 2); | ||
66 | x = (win_w / 2) - (w / 2); | ||
67 | x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2); | ||
68 | y = (win_h / 2) - (h / 2); | ||
69 | y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2); | ||
70 | (*it).position_set(x, y); | ||
71 | (*it).size_set(w, h); | ||
72 | (*it).fill_set(0, 0, w, h); | ||
73 | } | ||
74 | |||
75 | FPS_STD(NAME); | ||
76 | } | ||
77 | |||
78 | /* prepend special key handlers if interactive (before STD) */ | ||
79 | static void _key(char *key) | ||
80 | { | ||
81 | KEY_STD; | ||
82 | } | ||
83 | |||
84 | extern "C" void FNAME(void) | ||
85 | { | ||
86 | ui_func_set(_key, _loop); | ||
87 | _setup(); | ||
88 | } | ||
89 | |||
90 | #undef FNAME | ||
91 | #undef NAME | ||
92 | #undef ICON | ||
diff --git a/src/bin/cxx/image_blend_border_cxx.c b/src/bin/cxx/image_blend_border_cxx.c new file mode 100644 index 0000000..73bb9ec --- /dev/null +++ b/src/bin/cxx/image_blend_border_cxx.c | |||
@@ -0,0 +1,25 @@ | |||
1 | |||
2 | #ifdef HAVE_CONFIG_H | ||
3 | # include <config.h> | ||
4 | #endif | ||
5 | |||
6 | #undef FNAME | ||
7 | #undef NAME | ||
8 | #undef ICON | ||
9 | |||
10 | /* metadata */ | ||
11 | #define FNAME image_blend_border_start | ||
12 | #define NAME "Image Blend Border" | ||
13 | #define ICON "blend.png" | ||
14 | |||
15 | #ifdef UI | ||
16 | _ui_menu_item_add(ICON, NAME, FNAME); | ||
17 | #endif | ||
18 | |||
19 | #ifdef PROTO | ||
20 | void FNAME(void); | ||
21 | #endif | ||
22 | |||
23 | #undef FNAME | ||
24 | #undef NAME | ||
25 | #undef ICON | ||
diff --git a/src/bin/main.hh b/src/bin/main.hh new file mode 100644 index 0000000..b10d0c8 --- /dev/null +++ b/src/bin/main.hh | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef MAIN_HH | ||
2 | #define MAIN_HH | ||
3 | |||
4 | #define OBNUM 128 | ||
5 | #define LOOPS 128 | ||
6 | |||
7 | extern "C" | ||
8 | { | ||
9 | #include "ui.h" | ||
10 | const char *build_path(const char *filename); | ||
11 | } | ||
12 | |||
13 | #define SLOW 5.0 | ||
14 | |||
15 | extern int win_w, win_h; | ||
16 | extern int loops; | ||
17 | extern const char *choosen_engine; | ||
18 | extern Eina_Bool fullscreen; | ||
19 | extern Eina_Bool cmp_report; | ||
20 | |||
21 | #define KEY_STD \ | ||
22 | if ((!strcmp(key, "Escape")) || (!strcmp(key, "q")) || (!strcmp(key, "Q")) || (!strcmp(key, "Return"))) \ | ||
23 | { \ | ||
24 | _cleanup(); \ | ||
25 | ui_menu(); \ | ||
26 | } | ||
27 | |||
28 | #define FPS_STD(x) \ | ||
29 | if ((f >= loops) && (!done)) \ | ||
30 | { \ | ||
31 | double fps; \ | ||
32 | fps = (double)f / t; \ | ||
33 | ui_fps(fps); \ | ||
34 | printf("%4.2f , %s\n", fps, x); \ | ||
35 | done = 1; \ | ||
36 | } | ||
37 | |||
38 | #endif // MAIN_HH | ||
diff --git a/src/bin/tests.h b/src/bin/tests.h index 998b0e5..b293486 100644 --- a/src/bin/tests.h +++ b/src/bin/tests.h | |||
@@ -1,3 +1,12 @@ | |||
1 | |||
2 | #ifdef __cplusplus | ||
3 | extern "C" { | ||
4 | #endif | ||
5 | |||
6 | // C++ tests | ||
7 | #include "cxx/image_blend_border_cxx.c" | ||
8 | |||
9 | // C tests | ||
1 | #include "widgets_file_icons.c" | 10 | #include "widgets_file_icons.c" |
2 | #include "widgets_file_icons_2.c" | 11 | #include "widgets_file_icons_2.c" |
3 | #include "widgets_file_icons_2_grouped.c" | 12 | #include "widgets_file_icons_2_grouped.c" |
@@ -122,3 +131,7 @@ | |||
122 | #include "filter_object_blur.c" | 131 | #include "filter_object_blur.c" |
123 | #include "filter_object_blur_solid.c" | 132 | #include "filter_object_blur_solid.c" |
124 | #endif | 133 | #endif |
134 | |||
135 | #ifdef __cplusplus | ||
136 | } | ||
137 | #endif | ||
diff --git a/src/bin/ui.h b/src/bin/ui.h index 3f5a2b2..a9bda48 100644 --- a/src/bin/ui.h +++ b/src/bin/ui.h | |||
@@ -1,6 +1,10 @@ | |||
1 | #ifndef UI_H | 1 | #ifndef UI_H |
2 | #define UI_H | 2 | #define UI_H |
3 | 3 | ||
4 | #ifdef __cplusplus | ||
5 | extern "C" { | ||
6 | #endif | ||
7 | |||
4 | typedef struct _Menu_Item Menu_Item; | 8 | typedef struct _Menu_Item Menu_Item; |
5 | struct _Menu_Item | 9 | struct _Menu_Item |
6 | { | 10 | { |
@@ -24,4 +28,8 @@ void ui_fps(double fps); | |||
24 | void ui_num(int n); | 28 | void ui_num(int n); |
25 | void ui_all(void); | 29 | void ui_all(void); |
26 | 30 | ||
31 | #ifdef __cplusplus | ||
32 | } | ||
33 | #endif | ||
34 | |||
27 | #endif | 35 | #endif |