summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas/ecore_evas_buffer.c
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-05-03 16:56:40 -0700
committerCedric Bail <cedric@osg.samsung.com>2017-05-05 17:55:06 -0700
commit37f3d5095c1416defb3845588a4302a3baf18b93 (patch)
tree876b75c9027fdcc555a5e83d0f2cdc38eea4c650 /src/lib/ecore_evas/ecore_evas_buffer.c
parent696ed3e2e8f97de482e98db34997ad1848da985d (diff)
ecore_evas: use generic function for rendering ecore_evas buffer backend.
Diffstat (limited to 'src/lib/ecore_evas/ecore_evas_buffer.c')
-rw-r--r--src/lib/ecore_evas/ecore_evas_buffer.c75
1 files changed, 10 insertions, 65 deletions
diff --git a/src/lib/ecore_evas/ecore_evas_buffer.c b/src/lib/ecore_evas/ecore_evas_buffer.c
index 33594f0fe1..6d7f64b223 100644
--- a/src/lib/ecore_evas/ecore_evas_buffer.c
+++ b/src/lib/ecore_evas/ecore_evas_buffer.c
@@ -14,8 +14,6 @@
14#include "ecore_evas_buffer.h" 14#include "ecore_evas_buffer.h"
15#include "ecore_evas_private.h" 15#include "ecore_evas_private.h"
16 16
17static void _evas_evas_buffer_rendered(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED);
18
19static void 17static void
20_ecore_evas_buffer_free(Ecore_Evas *ee) 18_ecore_evas_buffer_free(Ecore_Evas *ee)
21{ 19{
@@ -140,27 +138,12 @@ _ecore_evas_buffer_name_class_set(Ecore_Evas *ee, const char *n, const char *c)
140 } 138 }
141} 139}
142 140
143static int 141static Eina_Bool
144_ecore_evas_buffer_render(Ecore_Evas *ee) 142_ecore_evas_buffer_prepare(Ecore_Evas *ee)
145{ 143{
146 Eina_List *ll;
147 Ecore_Evas_Engine_Buffer_Data *bdata; 144 Ecore_Evas_Engine_Buffer_Data *bdata;
148 Ecore_Evas *ee2;
149 int rend = 0;
150 145
151 bdata = ee->engine.data; 146 bdata = ee->engine.data;
152 if (bdata->in_render)
153 {
154 DBG("ee=%p is rendering, skip.", ee);
155 return 0;
156 }
157 EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2)
158 {
159 if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2);
160 if (ee2->engine.func->fn_render)
161 rend |= ee2->engine.func->fn_render(ee2);
162 if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2);
163 }
164 if (bdata->image) 147 if (bdata->image)
165 { 148 {
166 int w, h; 149 int w, h;
@@ -170,25 +153,8 @@ _ecore_evas_buffer_render(Ecore_Evas *ee)
170 _ecore_evas_resize(ee, w, h); 153 _ecore_evas_resize(ee, w, h);
171 bdata->pixels = evas_object_image_data_get(bdata->image, 1); 154 bdata->pixels = evas_object_image_data_get(bdata->image, 1);
172 } 155 }
173 if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee);
174 if (bdata->pixels)
175 {
176 bdata->in_render = 1;
177 if (ee->can_async_render && !ee->manual_render)
178 {
179 rend |= !!evas_render_async(ee->evas);
180 }
181 else
182 {
183 Eina_List *updates;
184
185 updates = evas_render_updates(ee->evas);
186 rend |= !!updates;
187 evas_render_updates_free(updates);
188 }
189 }
190 156
191 return rend; 157 return EINA_TRUE;
192} 158}
193 159
194static void 160static void
@@ -206,31 +172,13 @@ _ecore_evas_buffer_update_image(void *data, Evas *e EINA_UNUSED, void *event_inf
206 r->x, r->y, r->w, r->h); 172 r->x, r->y, r->w, r->h);
207} 173}
208 174
209static void
210_evas_evas_buffer_rendered(void *data, Evas *e EINA_UNUSED, void *event_info EINA_UNUSED)
211{
212 Ecore_Evas *ee = data;
213 Ecore_Evas_Engine_Buffer_Data *bdata = ee->engine.data;
214
215 _ecore_evas_idle_timeout_update(ee);
216
217 if (ee->func.fn_post_render) ee->func.fn_post_render(ee);
218 bdata->in_render = 0;
219}
220
221EAPI int 175EAPI int
222ecore_evas_buffer_render(Ecore_Evas *ee) 176ecore_evas_buffer_render(Ecore_Evas *ee)
223{ 177{
224 Ecore_Evas_Engine_Buffer_Data *bdata;
225 Eina_Bool async;
226 int r; 178 int r;
227 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, 0);
228 179
229 bdata = ee->engine.data; 180 r = ecore_evas_render(ee);
230 async = ee->can_async_render; 181 ecore_evas_render_wait(ee);
231 if (bdata->in_render) evas_sync(ee->evas);
232 r = _ecore_evas_buffer_render(ee);
233 ee->can_async_render = async;
234 return r; 182 return r;
235} 183}
236 184
@@ -718,7 +666,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
718 NULL, 666 NULL,
719 NULL, 667 NULL,
720 668
721 _ecore_evas_buffer_render, 669 NULL,
722 _ecore_evas_buffer_screen_geometry_get, 670 _ecore_evas_buffer_screen_geometry_get,
723 NULL, // screen_dpi_get 671 NULL, // screen_dpi_get
724 _ecore_evas_buffer_msg_parent_send, 672 _ecore_evas_buffer_msg_parent_send,
@@ -744,6 +692,7 @@ static Ecore_Evas_Engine_Func _ecore_buffer_engine_func =
744 NULL, //fn_callback_device_mouse_in_set 692 NULL, //fn_callback_device_mouse_in_set
745 NULL, //fn_callback_device_mouse_out_set 693 NULL, //fn_callback_device_mouse_out_set
746 NULL, //fn_pointer_device_xy_get 694 NULL, //fn_pointer_device_xy_get
695 _ecore_evas_buffer_prepare,
747}; 696};
748 697
749static void * 698static void *
@@ -875,8 +824,6 @@ ecore_evas_buffer_allocfunc_new(int w, int h,
875 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); 824 evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL);
876 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE); 825 _ecore_evas_focus_device_set(ee, NULL, EINA_TRUE);
877 826
878 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _evas_evas_buffer_rendered, ee);
879
880 return ee; 827 return ee;
881} 828}
882 829
@@ -895,7 +842,8 @@ ecore_evas_buffer_pixels_get(Ecore_Evas *ee)
895 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, NULL); 842 EINA_SAFETY_ON_NULL_RETURN_VAL(ee, NULL);
896 843
897 bdata = ee->engine.data; 844 bdata = ee->engine.data;
898 _ecore_evas_buffer_render(ee); 845 ecore_evas_render(ee);
846 ecore_evas_render_wait(ee);
899 return bdata->pixels; 847 return bdata->pixels;
900} 848}
901 849
@@ -975,7 +923,6 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target)
975 evas_output_size_set(ee->evas, w, h); 923 evas_output_size_set(ee->evas, w, h);
976 evas_output_viewport_set(ee->evas, 0, 0, w, h); 924 evas_output_viewport_set(ee->evas, 0, 0, w, h);
977 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _ecore_evas_buffer_update_image, ee); 925 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _ecore_evas_buffer_update_image, ee);
978 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _evas_evas_buffer_rendered, ee);
979 926
980 bdata->image = o; 927 bdata->image = o;
981 evas_object_data_set(bdata->image, "Ecore_Evas", ee); 928 evas_object_data_set(bdata->image, "Ecore_Evas", ee);
@@ -1069,9 +1016,7 @@ ecore_evas_object_image_new(Ecore_Evas *ee_target)
1069 ecore_evas_free(ee); 1016 ecore_evas_free(ee);
1070 return NULL; 1017 return NULL;
1071 } 1018 }
1072 _ecore_evas_register_animators(ee);
1073
1074 ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee);
1075 1019
1020 _ecore_evas_subregister(ee_target, ee);
1076 return o; 1021 return o;
1077} 1022}