summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Aguirre <aguirre.nicolas@gmail.com>2015-08-06 19:05:14 +0200
committerCedric BAIL <cedric@osg.samsung.com>2015-10-13 15:40:00 -0700
commite9c2d076965e60349e69eb7e6d842eb711d62f52 (patch)
treef4468615dc38a94390a5bfe2fe10d86c22e01873
parent86030d308cbd3febc3d68a2dc92aee24f8184ec3 (diff)
ecore_evas_cocoa: use the same render function as ecore_evas_x
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c122
1 files changed, 95 insertions, 27 deletions
diff --git a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
index 21f4e3ba15..5fe7a7335c 100644
--- a/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
+++ b/src/modules/ecore_evas/engines/cocoa/ecore_evas_cocoa.c
@@ -42,13 +42,71 @@ static int _ecore_evas_init_count = 0;
42// like a rbtree or a dictionnary-based container 42// like a rbtree or a dictionnary-based container
43static Eina_List *ecore_evases = NULL; 43static Eina_List *ecore_evases = NULL;
44static Ecore_Event_Handler *ecore_evas_event_handlers[5] = { 44static Ecore_Event_Handler *ecore_evas_event_handlers[5] = {
45 NULL, NULL, NULL, NULL 45 0
46}; 46};
47static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; 47static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL;
48 48
49//static const char *ecore_evas_cocoa_default = "EFL Cocoa"; 49//static const char *ecore_evas_cocoa_default = "EFL Cocoa";
50 50
51static int 51static int
52_render_updates_process(Ecore_Evas *ee, Eina_List *updates)
53{
54 int rend = 0;
55
56 if (ee->prop.avoid_damage)
57 {
58 if (updates)
59 {
60 _ecore_evas_idle_timeout_update(ee);
61 rend = 1;
62 }
63
64 }
65 else if (((ee->visible) && (ee->draw_ok)) ||
66 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
67 ((ee->should_be_visible) && (ee->prop.override)))
68 {
69 if (updates)
70 {
71 if (ee->shaped)
72 {
73 //TODO
74 }
75 if (ee->alpha)
76 {
77 //TODO
78 }
79 _ecore_evas_idle_timeout_update(ee);
80 rend = 1;
81 }
82 }
83 else
84 evas_norender(ee->evas);
85
86 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
87
88
89 if (rend)
90 {
91 static int frames = 0;
92 static double t0 = 0.0;
93 double t, td;
94
95 t = ecore_time_get();
96 frames++;
97 if ((t - t0) > 1.0)
98 {
99 td = t - t0;
100 printf("FPS: %3.3f\n", (double)frames / td);
101 frames = 0;
102 t0 = t;
103 }
104 }
105
106 return rend;
107}
108
109static int
52_ecore_evas_render(Ecore_Evas *ee) 110_ecore_evas_render(Ecore_Evas *ee)
53{ 111{
54 Eina_List *updates; 112 Eina_List *updates;
@@ -69,8 +127,16 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee)
69 Eina_List *updates = NULL; 127 Eina_List *updates = NULL;
70 Eina_List *ll; 128 Eina_List *ll;
71 Ecore_Evas *ee2; 129 Ecore_Evas *ee2;
130 static int render2 = -1;
72 131
73 DBG("Render"); 132 if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))
133 return 0;
134
135 if (ee->in_async_render)
136 {
137 //EDBG("ee=%p is rendering asynchronously, skip.", ee);
138 return 0;
139 }
74 140
75 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) 141 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
76 { 142 {
@@ -81,40 +147,42 @@ _ecore_evas_cocoa_render(Ecore_Evas *ee)
81 } 147 }
82 148
83 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); 149 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
84 150 if (render2 == -1)
85 if (ee->prop.avoid_damage)
86 { 151 {
87 rend = _ecore_evas_render(ee); 152 if (getenv("RENDER2")) render2 = 1;
153 else render2 = 0;
88 } 154 }
89 else if ((ee->visible) || 155 if (render2)
90 ((ee->should_be_visible) && (ee->prop.fullscreen)) ||
91 ((ee->should_be_visible) && (ee->prop.override)))
92 { 156 {
93 rend |= _ecore_evas_render(ee); 157 if (!ee->can_async_render)
158 {
159 Eina_List *updates = evas_render2_updates(ee->evas);
160 rend = _render_updates_process(ee, updates);
161 evas_render_updates_free(updates);
162 }
163 else
164 {
165 ee->in_async_render = EINA_TRUE;
166 if (evas_render2(ee->evas)) rend = 1;
167 else ee->in_async_render = EINA_FALSE;
168 }
94 } 169 }
95 else 170 else
96 evas_norender(ee->evas);
97
98 if (updates) rend = 1;
99 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
100
101 if (rend)
102 { 171 {
103 static int frames = 0; 172 if (!ee->can_async_render)
104 static double t0 = 0.0;
105 double t, td;
106
107 t = ecore_time_get();
108 frames++;
109 if ((t - t0) > 1.0)
110 { 173 {
111 td = t - t0; 174 Eina_List *updates = evas_render_updates(ee->evas);
112 DBG("FPS: %3.3f\n", (double)frames / td); 175 rend = _render_updates_process(ee, updates);
113 frames = 0; 176 evas_render_updates_free(updates);
114 t0 = t; 177 }
178 else if (evas_render_async(ee->evas))
179 {
180 //EDBG("ee=%p started asynchronous render.", ee);
181 ee->in_async_render = EINA_TRUE;
182 rend = 1;
115 } 183 }
184 else if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
116 } 185 }
117
118 return rend; 186 return rend;
119} 187}
120 188