summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavio Sena <savio.sena@acm.org>2014-08-24 07:48:21 -0300
committerSavio Sena <savio@expertisesolutions.com.br>2014-09-16 19:35:17 -0300
commitf0dbeca426a092d88bb2fa1d434bb14f5d9875d9 (patch)
tree39c56c0344b24f6c6babe0dc9fec5b1c52e0a24e
parent1a3b5e8d7d43c5736f2ac7fb45d1d2daf69e4bd5 (diff)
expedite++: First C++ test.
-rw-r--r--configure.ac8
-rw-r--r--src/bin/Makefile.am5
-rw-r--r--src/bin/about.h8
-rw-r--r--src/bin/cxx/image_blend_border.cc92
-rw-r--r--src/bin/cxx/image_blend_border_cxx.c25
-rw-r--r--src/bin/main.hh38
-rw-r--r--src/bin/tests.h13
-rw-r--r--src/bin/ui.h8
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])
10AC_CANONICAL_BUILD 10AC_CANONICAL_BUILD
11AC_CANONICAL_HOST 11AC_CANONICAL_HOST
12 12
13AM_INIT_AUTOMAKE([1.6 dist-bzip2]) 13AM_INIT_AUTOMAKE([1.6 dist-bzip2 subdir-objects])
14m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) 14m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
15 15
16PKG_PROG_PKG_CONFIG 16PKG_PROG_PKG_CONFIG
@@ -59,7 +59,7 @@ EFL_ENABLE_BETA_API_SUPPORT
59 59
60# EFL++ dependencies 60# EFL++ dependencies
61 61
62PKG_CHECK_MODULES([EFL_CXX], eina-cxx >= 1.11.0 eo-cxx >= 1.11.0 evas-cxx >= 1.11.0 eet-cxx >= 1.11.0) 62PKG_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])
97AC_MSG_RESULT([${have_cxx_flags}]) 97AC_MSG_RESULT([${have_cxx_flags}])
98CXXFLAGS="${CXXFLAGS_save}" 98CXXFLAGS="${CXXFLAGS_save}"
99if test "x${have_cxx_flags}" = "xyes" ; then 99if test "x${have_cxx_flags}" = "xyes" ; then
100 EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions -std=c++11" 100 EXPEDITE_CXXFLAGS="-fno-rtti -fno-exceptions"
101fi 101fi
102CXXFLAGS="{CXXFLAGS} -std=c++11" 102CXXFLAGS="${CXXFLAGS} -std=c++11"
103 103
104AC_LANG_POP([C++]) 104AC_LANG_POP([C++])
105AC_SUBST(EXPEDITE_CXXFLAGS) 105AC_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
12bin_PROGRAMS = expedite 13bin_PROGRAMS = expedite
@@ -48,6 +49,8 @@ image_blend_nearest_solid_same_scaled.c \
48image_blend_smooth_same_scaled.c \ 49image_blend_smooth_same_scaled.c \
49image_blend_smooth_solid_same_scaled.c \ 50image_blend_smooth_solid_same_scaled.c \
50image_blend_border.c \ 51image_blend_border.c \
52cxx/image_blend_border.cc \
53cxx/image_blend_border_cxx.c \
51image_blend_solid_middle_border.c \ 54image_blend_solid_middle_border.c \
52image_blend_solid_border.c \ 55image_blend_solid_border.c \
53image_blend_border_recolor.c \ 56image_blend_border_recolor.c \
@@ -131,7 +134,7 @@ font_effect_blur_color.c
131 134
132expedite_CFLAGS = @WIN32_CFLAGS@ 135expedite_CFLAGS = @WIN32_CFLAGS@
133expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@ 136expedite_CXXFLAGS = @EXPEDITE_CXXFLAGS@
134expedite_LDADD = @EFL_LIBS@ @EVIL_LIBS@ -lm 137expedite_LDADD = @EFL_LIBS@ @EFL_CXX_LIBS@ @EVIL_LIBS@ -lm
135expedite_LDFLAGS = @lt_enable_auto_import@ 138expedite_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
5extern "C" {
6#endif
7
4void about_start(void); 8void 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
24namespace _ctx {
25evas::canvas evas;
26efl::eina::list<evas::image> images;
27}
28
29/* standard var */
30static int done = 0;
31
32/* setup */
33static 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 */
49static void _cleanup()
50{
51 _ctx::images.clear();
52}
53
54/* loop - do things */
55static 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) */
79static void _key(char *key)
80{
81 KEY_STD;
82}
83
84extern "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
20void 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
7extern "C"
8{
9#include "ui.h"
10const char *build_path(const char *filename);
11}
12
13#define SLOW 5.0
14
15extern int win_w, win_h;
16extern int loops;
17extern const char *choosen_engine;
18extern Eina_Bool fullscreen;
19extern 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
3extern "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
5extern "C" {
6#endif
7
4typedef struct _Menu_Item Menu_Item; 8typedef struct _Menu_Item Menu_Item;
5struct _Menu_Item 9struct _Menu_Item
6{ 10{
@@ -24,4 +28,8 @@ void ui_fps(double fps);
24void ui_num(int n); 28void ui_num(int n);
25void ui_all(void); 29void ui_all(void);
26 30
31#ifdef __cplusplus
32}
33#endif
34
27#endif 35#endif