summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavio Sena <savio@expertisesolutions.com.br>2014-09-29 14:43:26 +0000
committerSavio Sena <savio@expertisesolutions.com.br>2014-09-29 14:43:26 +0000
commit3f1b05bd0b11e05744ba71df5401e442ea8d2848 (patch)
treee722e6c19c9fe8e7b28a304da4d1a363a4b7354d
parent9ee8b2a45b99346cc93969eaede249d84ed83db1 (diff)
expedite-cxx: image_blend_* globals as pointers, not instances.
-rw-r--r--src/bin/cxx/image_blend_border.cc27
-rw-r--r--src/bin/cxx/image_blend_many_smooth_same_scaled.cc9
2 files changed, 20 insertions, 16 deletions
diff --git a/src/bin/cxx/image_blend_border.cc b/src/bin/cxx/image_blend_border.cc
index b6c37f4..c7f192c 100644
--- a/src/bin/cxx/image_blend_border.cc
+++ b/src/bin/cxx/image_blend_border.cc
@@ -15,8 +15,7 @@
15#define EXPEDITE_CXX_TEST_IMPL 15#define EXPEDITE_CXX_TEST_IMPL
16#include "image_blend_border_capi.h" 16#include "image_blend_border_capi.h"
17 17
18 18static efl::eina::list<evas::image>* images;
19static efl::eina::list<evas::image> images;
20 19
21/* standard var */ 20/* standard var */
22static int done = 0; 21static int done = 0;
@@ -25,10 +24,11 @@ static int done = 0;
25static void _setup() 24static void _setup()
26{ 25{
27 evas::canvas canvas(::eo_ref(G_evas)); 26 evas::canvas canvas(::eo_ref(G_evas));
27 images = new efl::eina::list<evas::image>;
28 for (int i = 0; i < OBNUM; i++) 28 for (int i = 0; i < OBNUM; i++)
29 { 29 {
30 evas::image o(efl::eo::parent = canvas); 30 evas::image o(efl::eo::parent = canvas);
31 images.push_back(o); 31 images->push_back(o);
32 o.file_set(::build_path("bar.png"), ""); 32 o.file_set(::build_path("bar.png"), "");
33 o.border_set(6, 6, 6, 6); 33 o.border_set(6, 6, 6, 6);
34 o.visibility_set(true); 34 o.visibility_set(true);
@@ -39,16 +39,20 @@ static void _setup()
39/* cleanup */ 39/* cleanup */
40static void _cleanup() 40static void _cleanup()
41{ 41{
42 images.clear(); 42 if (images)
43 {
44 images->clear();
45 delete images;
46 }
43} 47}
44 48
45/* loop - do things */ 49/* loop - do things */
46static void _loop(double t, int f) 50static void _loop(double t, int f)
47{ 51{
48 int i = 0;
49 Evas_Coord x, y, w, h, w0, h0; 52 Evas_Coord x, y, w, h, w0, h0;
50 53 int i = 0;
51 for (auto it = images.begin(), end = images.end(); it != end; it++, i++) 54 if (!images) return;
55 for (evas::image img : *images)
52 { 56 {
53 w0 = 80; 57 w0 = 80;
54 h0 = 80; 58 h0 = 80;
@@ -58,12 +62,11 @@ static void _loop(double t, int f)
58 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2); 62 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (w0 / 2);
59 y = (win_h / 2) - (h / 2); 63 y = (win_h / 2) - (h / 2);
60 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2); 64 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (h0 / 2);
61 65 img.evas::object::position_set(x, y);
62 (*it).position_set(x, y); 66 img.evas::object::size_set(w, h);
63 (*it).evas::object::size_set(w, h); 67 img.fill_set(0, 0, w, h);
64 (*it).fill_set(0, 0, w, h); 68 ++i;
65 } 69 }
66
67 FPS_STD(NAME); 70 FPS_STD(NAME);
68} 71}
69 72
diff --git a/src/bin/cxx/image_blend_many_smooth_same_scaled.cc b/src/bin/cxx/image_blend_many_smooth_same_scaled.cc
index e4a02ce..c041825 100644
--- a/src/bin/cxx/image_blend_many_smooth_same_scaled.cc
+++ b/src/bin/cxx/image_blend_many_smooth_same_scaled.cc
@@ -51,16 +51,17 @@ static void _cleanup()
51/* loop - do things */ 51/* loop - do things */
52static void _loop(double t, int f) 52static void _loop(double t, int f)
53{ 53{
54 auto itr = images.begin(); 54 int i = 0;
55 for (int i = 0; i < MANYNUM; i++, ++itr) 55 for (evas::image& img : images)
56 { 56 {
57 Evas_Coord w, h; 57 Evas_Coord w, h;
58 (*itr).size_get(&w, &h); 58 img.evas::object::size_get(&w, &h);
59 Evas_Coord x = (win_w / 2) - (w / 2); 59 Evas_Coord x = (win_w / 2) - (w / 2);
60 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (win_w / 2); 60 x += sin((double)(f + (i * 13)) / (36.7 * SLOW)) * (win_w / 2);
61 Evas_Coord y = (win_h / 2) - (h / 2); 61 Evas_Coord y = (win_h / 2) - (h / 2);
62 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (win_h / 2); 62 y += cos((double)(f + (i * 28)) / (43.8 * SLOW)) * (win_h / 2);
63 (*itr).position_set(x, y); 63 img.evas::object::position_set(x, y);
64 ++i;
64 } 65 }
65 FPS_STD(NAME); 66 FPS_STD(NAME);
66} 67}