summaryrefslogtreecommitdiff
path: root/src/lib/ecore_evas
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2017-05-08 15:00:54 -0700
committerCedric BAIL <cedric@osg.samsung.com>2017-05-08 15:00:54 -0700
commit69d45551163953ad7ceb9461541c2734d1186d91 (patch)
tree873496603952ed189e5472a32e99f135a3a72e3b /src/lib/ecore_evas
parent688013e669cd8740832c64a2cd34b041522c18bc (diff)
ecore_evas: refactor ews backend to use generic infrastructure for rendering.
Diffstat (limited to 'src/lib/ecore_evas')
-rw-r--r--src/lib/ecore_evas/ecore_evas_ews.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/src/lib/ecore_evas/ecore_evas_ews.c b/src/lib/ecore_evas/ecore_evas_ews.c
index 56dd640133..ee40f00d31 100644
--- a/src/lib/ecore_evas/ecore_evas_ews.c
+++ b/src/lib/ecore_evas/ecore_evas_ews.c
@@ -549,38 +549,42 @@ _ecore_evas_ews_transparent_set(Ecore_Evas *ee, int val)
549 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); 549 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE);
550} 550}
551 551
552static int 552static Eina_Bool
553_ecore_evas_ews_render(Ecore_Evas *ee) 553_ecore_evas_ews_prepare(Ecore_Evas *ee)
554{ 554{
555 Eina_List *updates = NULL, *l; 555 Evas_Coord w, h;
556 Eina_Rectangle *r;
557 void *pixels; 556 void *pixels;
558 int w, h, rend;
559
560 rend = ecore_evas_render_prepare(ee);
561 557
562 evas_object_image_size_get(ee->engine.ews.image, &w, &h); 558 evas_object_image_size_get(ee->engine.ews.image, &w, &h);
563 if ((w != ee->w) || (h != ee->h)) 559 if ((w != ee->w) || (h != ee->h))
564 ecore_evas_resize(ee, w, h); 560 ecore_evas_resize(ee, w, h);
565 561
566 pixels = evas_object_image_data_get(ee->engine.ews.image, 1); 562 pixels = evas_object_image_data_get(ee->engine.ews.image, 1);
567 if (pixels) 563 if (!pixels) return EINA_FALSE;
568 { 564
569 updates = evas_render_updates(ee->evas); 565 evas_object_data_set(ee->engine.ews.image, "_ews.pixels", pixels);
570 } 566
571 evas_object_image_data_set(ee->engine.ews.image, pixels); 567 return EINA_TRUE;
568}
569
570static void
571_ecore_evas_ews_update_image(void *data, Evas *e EINA_UNUSED, void *event_info)
572{
573 Evas_Event_Render_Post *post = event_info;
574 Ecore_Evas *ee = data;
575 Eina_Rectangle *r;
576 Eina_List *l;
577 void *pixels;
578
579 pixels = evas_object_data_get(ee->engine.ews.image, "_ews.pixels");
580 if (!pixels) return ;
572 581
573 EINA_LIST_FOREACH(updates, l, r) 582 evas_object_image_data_set(ee->engine.ews.image, pixels);
583 EINA_LIST_FOREACH(post->updated_area, l, r)
574 evas_object_image_data_update_add(ee->engine.ews.image, 584 evas_object_image_data_update_add(ee->engine.ews.image,
575 r->x, r->y, r->w, r->h); 585 r->x, r->y, r->w, r->h);
576 586
577 if (updates) 587 evas_object_data_set(ee->engine.ews.image, "_ews.pixels", NULL);
578 {
579 evas_render_updates_free(updates);
580 _ecore_evas_idle_timeout_update(ee);
581 }
582
583 return updates ? 1 : rend;
584} 588}
585 589
586static void 590static void
@@ -648,7 +652,7 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
648 NULL, 652 NULL,
649 NULL, 653 NULL,
650 654
651 _ecore_evas_ews_render, 655 NULL,
652 _ecore_evas_ews_screen_geometry_get, 656 _ecore_evas_ews_screen_geometry_get,
653 NULL, // screen_dpi_get 657 NULL, // screen_dpi_get
654 NULL, 658 NULL,
@@ -674,6 +678,7 @@ static const Ecore_Evas_Engine_Func _ecore_ews_engine_func =
674 NULL, //fn_callback_device_mouse_in_set 678 NULL, //fn_callback_device_mouse_in_set
675 NULL, //fn_callback_device_mouse_out_set 679 NULL, //fn_callback_device_mouse_out_set
676 NULL, //fn_pointer_device_xy_get 680 NULL, //fn_pointer_device_xy_get
681 _ecore_evas_ews_prepare,
677}; 682};
678 683
679void 684void
@@ -1153,6 +1158,7 @@ ecore_evas_ews_new(int x, int y, int w, int h)
1153 1158
1154 ee->engine.ews.image = o; 1159 ee->engine.ews.image = o;
1155 evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee); 1160 evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee);
1161 evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_POST, _ecore_evas_ews_update_image, ee);
1156 evas_object_event_callback_add(ee->engine.ews.image, 1162 evas_object_event_callback_add(ee->engine.ews.image,
1157 EVAS_CALLBACK_MOUSE_IN, 1163 EVAS_CALLBACK_MOUSE_IN,
1158 _ecore_evas_ews_cb_mouse_in, ee); 1164 _ecore_evas_ews_cb_mouse_in, ee);
@@ -1243,7 +1249,7 @@ ecore_evas_ews_new(int x, int y, int w, int h)
1243 ecore_evas_free(ee); 1249 ecore_evas_free(ee);
1244 } 1250 }
1245 1251
1246 _ews_ee->sub_ecore_evas = eina_list_append(_ews_ee->sub_ecore_evas, ee); 1252 _ecore_evas_subregister(_ews_ee, ee);
1247 _ews_children = eina_list_append(_ews_children, ee); 1253 _ews_children = eina_list_append(_ews_children, ee);
1248 1254
1249 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD); 1255 _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD);