[EGIT] [core/efl] master 01/01: gengrid: Fix memory leak
sanghyeonlee pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6ab86d50523c75e06948f9fe62ec6dfac96750b4 commit 6ab86d50523c75e06948f9fe62ec6dfac96750b4 Author: Subhransu Mohanty Date: Thu Jun 25 17:02:22 2020 +0900 gengrid: Fix memory leak Reviewers: SanghyeonLee Reviewed By: SanghyeonLee Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11930 --- src/lib/elementary/elm_gengrid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/elementary/elm_gengrid.c b/src/lib/elementary/elm_gengrid.c index c42f8c354a..13427ec00f 100644 --- a/src/lib/elementary/elm_gengrid.c +++ b/src/lib/elementary/elm_gengrid.c @@ -3993,7 +3993,7 @@ _item_select(Elm_Gen_Item *it) efl_access_state_changed_signal_emit(eo_it, EFL_ACCESS_STATE_TYPE_SELECTED, EINA_TRUE); } - efl_ref(eo_it); + efl_unref(eo_it); sd->walking--; if ((sd->clear_me) && (!sd->walking)) _internal_elm_gengrid_clear(WIDGET(it), EINA_TRUE); --
[EGIT] [core/efl] master 02/02: elementary/perf: reduce number of efl_isa() call. in elementary test application efl_isa() shows up as hotsport during profiling so refactored the code to reduce redund
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=18b0abf62f91fc4992ade39efb756a9f74bbe616 commit 18b0abf62f91fc4992ade39efb756a9f74bbe616 Author: Subhransu Mohanty Date: Wed Jun 17 06:28:44 2020 + elementary/perf: reduce number of efl_isa() call. in elementary test application efl_isa() shows up as hotsport during profiling so refactored the code to reduce redundant efl_isa() calls. in genlist testcase the number of calls reduced by 3. Reviewed-by: Marcel Hollerbach Reviewed-by: Hermet Park <> Reviewed-by: Youngbok Shin Differential Revision: https://phab.enlightenment.org/D11984 --- src/lib/elementary/efl_ui_widget.c | 36 +--- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index c2a0af7ce7..0b6ea105a9 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -186,8 +186,6 @@ _on_sub_obj_del(void *data, const Efl_Event *event); static void _propagate_event(void *data, const Efl_Event *eo_event); static void _elm_widget_shadow_update(Efl_Ui_Widget *obj); -EFL_CALLBACKS_ARRAY_DEFINE(elm_widget_subitems_callbacks, - { EFL_EVENT_DEL, _on_sub_obj_del }); EFL_CALLBACKS_ARRAY_DEFINE(efl_subitems_callbacks, { EFL_EVENT_DEL, _on_sub_obj_del }); EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks, @@ -198,27 +196,13 @@ EFL_CALLBACKS_ARRAY_DEFINE(focus_callbacks, static inline void _callbacks_add(Eo *widget, void *data) { - if (_elm_widget_is(widget)) - { -efl_event_callback_array_add(widget, elm_widget_subitems_callbacks(), data); - } - else - { -efl_event_callback_array_add(widget, efl_subitems_callbacks(), data); - } +efl_event_callback_array_add(widget, efl_subitems_callbacks(), data); } static inline void _callbacks_del(Eo *widget, void *data) { - if (_elm_widget_is(widget)) - { -efl_event_callback_array_del(widget, elm_widget_subitems_callbacks(), data); - } - else - { -efl_event_callback_array_del(widget, efl_subitems_callbacks(), data); - } +efl_event_callback_array_del(widget, efl_subitems_callbacks(), data); } void @@ -1532,12 +1516,14 @@ EOLIAN static Eina_Bool _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { Efl_Ui_Widget *parent; + Eina_Bool is_widget; EINA_SAFETY_ON_FALSE_RETURN_VAL(efl_isa(sobj, EFL_GFX_ENTITY_INTERFACE), EINA_FALSE); EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); + is_widget = elm_widget_is(sobj); //first make sure that we unregister the sobj from the parent - if (elm_widget_is(sobj)) + if (is_widget) parent = efl_ui_widget_parent_get(sobj); else parent = evas_object_data_get(sobj, "elm-parent"); @@ -1560,7 +1546,7 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob //and if it is a widget, please set the correct parent on the widget itself //the parent set method will take care of the property syncing etc. - if (elm_widget_is(sobj)) + if (is_widget) efl_ui_widget_parent_set(sobj, obj); return EINA_TRUE; @@ -1569,13 +1555,17 @@ _efl_ui_widget_widget_sub_object_add(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob EOLIAN static Eina_Bool _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Object *sobj) { - Evas_Object *sobj_parent; + Evas_Object *sobj_parent = NULL; + Eina_Bool is_widget; if (!sobj) return EINA_FALSE; EINA_SAFETY_ON_TRUE_RETURN_VAL(obj == sobj, EINA_FALSE); - sobj_parent = evas_object_data_del(sobj, "elm-parent"); + is_widget = _elm_widget_is(sobj); + + if (!is_widget) sobj_parent = evas_object_data_del(sobj, "elm-parent"); + if (sobj_parent && sobj_parent != obj) { static int abort_on_warn = -1; @@ -1595,7 +1585,7 @@ _efl_ui_widget_widget_sub_object_del(Eo *obj, Elm_Widget_Smart_Data *sd, Evas_Ob return EINA_FALSE; } - if (_elm_widget_is(sobj)) + if (is_widget) { if (_is_focused(sobj)) { --
[EGIT] [core/efl] master 01/02: elementary/perf:remove unnecessary elm_widget_is() check
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=95eb621c15462e54ba9b092bca6ceec2a0fb3a1a commit 95eb621c15462e54ba9b092bca6ceec2a0fb3a1a Author: Subhransu Mohanty Date: Wed Jun 17 06:36:02 2020 + elementary/perf:remove unnecessary elm_widget_is() check As we always make sure the parent is a widget class we don't have to check anymore. Reviewed-by: Marcel Hollerbach Reviewed-by: Hermet Park <> Differential Revision: https://phab.enlightenment.org/D11985 --- src/lib/elementary/efl_ui_widget.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/efl_ui_widget.c b/src/lib/elementary/efl_ui_widget.c index 4b0b8db781..c2a0af7ce7 100644 --- a/src/lib/elementary/efl_ui_widget.c +++ b/src/lib/elementary/efl_ui_widget.c @@ -2356,7 +2356,7 @@ _efl_ui_widget_efl_gfx_entity_scale_get(const Eo *obj EINA_UNUSED, Elm_Widget_Sm // FIXME: save walking up the tree by storing/caching parent scale if (EINA_DBL_EQ(sd->scale, 0.0)) { -if (sd->parent_obj && elm_widget_is(sd->parent_obj)) +if (sd->parent_obj) { return efl_gfx_entity_scale_get(sd->parent_obj); } @@ -2621,7 +2621,7 @@ elm_widget_theme_get(const Evas_Object *obj) if (!sd->theme) { -if (sd->parent_obj && elm_widget_is(sd->parent_obj)) +if (sd->parent_obj) return elm_widget_theme_get(sd->parent_obj); else return NULL; } @@ -5263,7 +5263,7 @@ elm_widget_show_region_set(Eo *obj, Eina_Rect sr, Eina_Bool forceshow) do { parent_obj = sd->parent_obj; -if ((!parent_obj) || (!_elm_widget_is(parent_obj))) break; +if ((!parent_obj)) break; sd = efl_data_scope_get(parent_obj, MY_CLASS); if (!sd) break; --
[EGIT] [core/efl] efl-1.24 16/31: svg/loader: Fix memory leak
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=5d19a932e838e4adda682bdab2f424f7d876f880 commit 5d19a932e838e4adda682bdab2f424f7d876f880 Author: Subhransu Mohanty Date: Mon Jun 1 18:53:36 2020 +0900 svg/loader: Fix memory leak Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11908 --- src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c | 5 - src/static_libs/vg_common/vg_common_svg.c | 6 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c index 313d3eed15..9151e05c15 100644 --- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c +++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c @@ -2410,6 +2410,7 @@ static Eina_Bool evas_vg_load_file_close_svg(Vg_File_Data *vfd) { if (vfd->root) efl_unref(vfd->root); + free(vfd); return EINA_TRUE; } @@ -2462,7 +2463,9 @@ evas_vg_load_file_open_svg(Eina_File *file, } free(loader.svg_parse); - return vg_common_svg_create_vg_node(loader.doc); + Vg_File_Data* result = vg_common_svg_create_vg_node(loader.doc); + vg_common_svg_node_free(loader.doc); + return result; } static Evas_Vg_Load_Func evas_vg_load_svg_func = diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c index de5477bb0e..058cdf99e0 100644 --- a/src/static_libs/vg_common/vg_common_svg.c +++ b/src/static_libs/vg_common/vg_common_svg.c @@ -536,12 +536,14 @@ vg_common_svg_node_free(Svg_Node *node) { _svg_style_gradient_free(grad); } +case SVG_NODE_CUSTOME_COMMAND: + if (node->node.command.commands) free(node->node.command.commands); + if (node->node.command.points) free(node->node.command.points); break; default: break; } - if (node->node.command.commands_count > 0) free(node->node.command.commands); - if (node->node.command.points_count > 0) free(node->node.command.points); + free(node); } --
[EGIT] [core/efl] efl-1.24 17/31: elementary: Fix memory leak in elm_list
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=8d27e70bc343d4f76faf1e954324ca66ad40fd16 commit 8d27e70bc343d4f76faf1e954324ca66ad40fd16 Author: Subhransu Mohanty Date: Mon Jun 1 18:57:24 2020 +0900 elementary: Fix memory leak in elm_list Reviewers: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11909 --- src/lib/elementary/elm_list.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index 4447ea2f05..6936cb2e85 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -1060,6 +1060,8 @@ _items_fix(Evas_Object *obj) //focus highlight in_theme is set by list item theme. _elm_widget_item_highlight_in_theme( obj, elm_list_first_item_get(obj)); + + eina_array_flush(); } static void --
[EGIT] [core/efl] efl-1.24 09/31: edje: fix memory leak by freeing the limits pointer.
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=bfb4c0a4835a1bbbe3a17672ac010d6545d3d3ea commit bfb4c0a4835a1bbbe3a17672ac010d6545d3d3ea Author: Subhransu Mohanty Date: Wed May 27 14:55:44 2020 +0900 edje: fix memory leak by freeing the limits pointer. Summary: This limit parts are only used in naviframe edc thats why it is only showing up in naviframe test app. Reviewers: Jaehyun_Cho, Hermet Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11887 --- src/lib/edje/edje_load.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index b3fa2e3d57..55ac53adf1 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2372,6 +2372,8 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec if (ec->script) embryo_program_free(ec->script); _edje_lua2_script_unload(ec); + if (ec->limits.parts) free(ec->limits.parts); + eina_hash_free(ec->alias); eina_hash_free(ec->aliased); --
[EGIT] [core/efl] efl-1.24 07/31: edje: Fix memory leak by freeing the filter data.
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=334fc6b6ee81654fc20ed293ecc02968593962c7 commit 334fc6b6ee81654fc20ed293ecc02968593962c7 Author: Subhransu Mohanty Date: Wed May 27 12:31:35 2020 +0900 edje: Fix memory leak by freeing the filter data. Reviewers: Hermet, CHAN Reviewed By: CHAN Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11879 --- src/lib/edje/edje_load.c | 16 1 file changed, 16 insertions(+) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 2fb3da0267..2888f6b291 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2172,6 +2172,22 @@ _edje_file_free(Edje_File *edf) free(edf->vibration_dir); } + if (edf->filter_dir) + { +int i; + +if (edf->free_strings) + { + for (i = 0; i < edf->filter_dir->filters_count; ++i) + { + eina_stringshare_del(edf->filter_dir->filters[i].name); + eina_stringshare_del(edf->filter_dir->filters[i].script); + } + } +free(edf->filter_dir->filters); +free(edf->filter_dir); + } + if (edf->mo_dir) { unsigned int i; --
[EGIT] [core/efl] efl-1.24 21/31: evas/engine: Fix memory leak in generic cache.
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=c904970ad3eba93aa7a59e912c54fa54bbfeb796 commit c904970ad3eba93aa7a59e912c54fa54bbfeb796 Author: Subhransu Mohanty Date: Wed Jun 3 13:03:39 2020 +0900 evas/engine: Fix memory leak in generic cache. Summary: During shutdown we used to call engine_image_free() which was causing some deadlock. as we have evas_cache which takes care of freeing all the images we just have to delete the generic cache without freeing the image during shutdown. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11915 --- src/lib/evas/common/evas_common_generic_cache.c | 13 +++-- src/modules/evas/engines/gl_generic/evas_engine.c | 3 +-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c index ddb055deb2..4fc5a8bbac 100644 --- a/src/lib/evas/common/evas_common_generic_cache.c +++ b/src/lib/evas/common/evas_common_generic_cache.c @@ -14,8 +14,17 @@ generic_cache_new(void *user_data, Generic_Cache_Free func) EAPI void generic_cache_destroy(Generic_Cache *cache) { - generic_cache_dump(cache); - eina_hash_free(cache->hash); + Generic_Cache_Entry *entry; + if (cache) + { +EINA_LIST_FREE(cache->lru_list, entry) + { + free(entry); + } + +eina_hash_free(cache->hash); +free(cache); + } } EAPI void diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index d51a8ea1c7..8b9ef94d1b 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -167,8 +167,7 @@ eng_engine_free(void *engine) Render_Engine_GL_Generic *e = engine; Render_Output_GL_Generic *output; - //@FIXME this causes some deadlock while freeing the engine image. - //generic_cache_destroy(e->software.surface_cache); + generic_cache_destroy(e->software.surface_cache); EINA_LIST_FREE(e->software.outputs, output) ERR("Output %p not properly cleaned before engine destruction.", output); --
[EGIT] [core/efl] efl-1.24 25/31: elementary/example: Fix memory leak in gengrid test
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=69bf3cd31f6006aa6e2d430718604ed04de551c7 commit 69bf3cd31f6006aa6e2d430718604ed04de551c7 Author: Subhransu Mohanty Date: Mon Jun 8 20:28:14 2020 +0900 elementary/example: Fix memory leak in gengrid test Reviewers: Hermet, SanghyeonLee Reviewed By: Hermet, SanghyeonLee Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11928 --- src/bin/elementary/test_gengrid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/elementary/test_gengrid.c b/src/bin/elementary/test_gengrid.c index e2009e0db6..83f2dd9262 100644 --- a/src/bin/elementary/test_gengrid.c +++ b/src/bin/elementary/test_gengrid.c @@ -2160,6 +2160,7 @@ test_gengrid_update(void *data EINA_UNUSED, win = elm_win_util_standard_add("gengrid-update", "Gengrid Update"); elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); api->box = bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); --
[EGIT] [core/efl] efl-1.24 24/31: ecore_ipc: Fix memory leak
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=ebbc6a3c2de2218092a78b9b1ead82750fbedb18 commit ebbc6a3c2de2218092a78b9b1ead82750fbedb18 Author: Subhransu Mohanty Date: Mon Jun 8 20:27:42 2020 +0900 ecore_ipc: Fix memory leak Summary: As delete_me flag was not updated in the delete callback it dosen't call ecore_ipc_client_del() on the client hence the leak. Reviewers: Hermet, raster, bu5hm4n, CHAN Reviewed By: Hermet, CHAN Subscribers: CHAN, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11927 --- src/lib/ecore_ipc/ecore_ipc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c index f6f7fee463..bd4d76bc65 100644 --- a/src/lib/ecore_ipc/ecore_ipc.c +++ b/src/lib/ecore_ipc/ecore_ipc.c @@ -277,6 +277,8 @@ ecore_ipc_post_event_client_del(Ecore_Ipc_Client *cl) Ecore_Ipc_Event_Client_Del *ev; if (cl->delete_me) return; + + cl->delete_me = EINA_TRUE; ev = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del)); EINA_SAFETY_ON_NULL_RETURN(ev); --
[EGIT] [core/efl] efl-1.24 20/31: eo: Fix memory leak in efl_key_wref_set() api.
stefan pushed a commit to branch efl-1.24. http://git.enlightenment.org/core/efl.git/commit/?id=709f31ebe86f24820ba6e26559d70c4106279854 commit 709f31ebe86f24820ba6e26559d70c4106279854 Author: Subhransu Mohanty Date: Wed May 27 07:39:59 2020 + eo: Fix memory leak in efl_key_wref_set() api. Testcase: elementary_test -to snapshot Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11888 --- src/lib/eo/eo_base_class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c index 44fe92cf4a..565f4805e8 100644 --- a/src/lib/eo/eo_base_class.c +++ b/src/lib/eo/eo_base_class.c @@ -415,7 +415,7 @@ _key_generic_cb_del(void *data, const Efl_Event *event EINA_UNUSED) { Eo_Generic_Data_Node *node = data; Efl_Object_Data *pd = efl_data_scope_get(node->obj, EFL_OBJECT_CLASS); - _eo_key_generic_direct_del(pd, node, EINA_FALSE); + _eo_key_generic_direct_del(pd, node, EINA_TRUE); } EOLIAN static void --
[EGIT] [core/efl] master 01/01: elementary/example: Fix memory leak in gengrid test
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=101ca2db82a476e038c08edc798aabb4ce425b84 commit 101ca2db82a476e038c08edc798aabb4ce425b84 Author: Subhransu Mohanty Date: Mon Jun 8 20:28:14 2020 +0900 elementary/example: Fix memory leak in gengrid test Reviewers: Hermet, SanghyeonLee Reviewed By: Hermet, SanghyeonLee Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11928 --- src/bin/elementary/test_gengrid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bin/elementary/test_gengrid.c b/src/bin/elementary/test_gengrid.c index e2009e0db6..83f2dd9262 100644 --- a/src/bin/elementary/test_gengrid.c +++ b/src/bin/elementary/test_gengrid.c @@ -2160,6 +2160,7 @@ test_gengrid_update(void *data EINA_UNUSED, win = elm_win_util_standard_add("gengrid-update", "Gengrid Update"); elm_win_autodel_set(win, EINA_TRUE); + evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); api->box = bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); --
[EGIT] [core/efl] master 01/01: ecore_ipc: Fix memory leak
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=a02deffad70a2841084465a3809bb2e035ccf1a0 commit a02deffad70a2841084465a3809bb2e035ccf1a0 Author: Subhransu Mohanty Date: Mon Jun 8 20:27:42 2020 +0900 ecore_ipc: Fix memory leak Summary: As delete_me flag was not updated in the delete callback it dosen't call ecore_ipc_client_del() on the client hence the leak. Reviewers: Hermet, raster, bu5hm4n, CHAN Reviewed By: Hermet, CHAN Subscribers: CHAN, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11927 --- src/lib/ecore_ipc/ecore_ipc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/ecore_ipc/ecore_ipc.c b/src/lib/ecore_ipc/ecore_ipc.c index f6f7fee463..bd4d76bc65 100644 --- a/src/lib/ecore_ipc/ecore_ipc.c +++ b/src/lib/ecore_ipc/ecore_ipc.c @@ -277,6 +277,8 @@ ecore_ipc_post_event_client_del(Ecore_Ipc_Client *cl) Ecore_Ipc_Event_Client_Del *ev; if (cl->delete_me) return; + + cl->delete_me = EINA_TRUE; ev = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del)); EINA_SAFETY_ON_NULL_RETURN(ev); --
[EGIT] [core/efl] master 02/02: evas/engine: Fix memory leak in generic cache.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=97f4f7127a653db1ad1b69ecb3a2cb788ee8c5a1 commit 97f4f7127a653db1ad1b69ecb3a2cb788ee8c5a1 Author: Subhransu Mohanty Date: Wed Jun 3 13:03:39 2020 +0900 evas/engine: Fix memory leak in generic cache. Summary: During shutdown we used to call engine_image_free() which was causing some deadlock. as we have evas_cache which takes care of freeing all the images we just have to delete the generic cache without freeing the image during shutdown. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11915 --- src/lib/evas/common/evas_common_generic_cache.c | 13 +++-- src/modules/evas/engines/gl_generic/evas_engine.c | 3 +-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c index ddb055deb2..4fc5a8bbac 100644 --- a/src/lib/evas/common/evas_common_generic_cache.c +++ b/src/lib/evas/common/evas_common_generic_cache.c @@ -14,8 +14,17 @@ generic_cache_new(void *user_data, Generic_Cache_Free func) EAPI void generic_cache_destroy(Generic_Cache *cache) { - generic_cache_dump(cache); - eina_hash_free(cache->hash); + Generic_Cache_Entry *entry; + if (cache) + { +EINA_LIST_FREE(cache->lru_list, entry) + { + free(entry); + } + +eina_hash_free(cache->hash); +free(cache); + } } EAPI void diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 414856794f..593f16954a 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -167,8 +167,7 @@ eng_engine_free(void *engine) Render_Engine_GL_Generic *e = engine; Render_Output_GL_Generic *output; - //@FIXME this causes some deadlock while freeing the engine image. - //generic_cache_destroy(e->software.surface_cache); + generic_cache_destroy(e->software.surface_cache); EINA_LIST_FREE(e->software.outputs, output) ERR("Output %p not properly cleaned before engine destruction.", output); --
[EGIT] [core/efl] master 01/02: elementary_test: Added --autoclose option to elementary_test
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c77a34402a9ea21ce18fb05c01f546f7898cc557 commit c77a34402a9ea21ce18fb05c01f546f7898cc557 Author: Subhransu Mohanty Date: Wed Jun 3 12:15:05 2020 +0900 elementary_test: Added --autoclose option to elementary_test Summary: This option will enable writing tools which will automate running the elementary test cases. Reviewers: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11910 --- src/bin/elementary/test.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index bfb505e4a3..1bcf69e9cd 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -681,14 +681,23 @@ _my_win_key_up(void *d EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Key *ev) return ECORE_CALLBACK_RENEW; } +static Eina_Bool +_auto_close(void *data EINA_UNUSED) +{ + elm_exit(); + return EINA_FALSE; +} + static void -my_win_main(const char *autorun, Eina_Bool test_win_only) +my_win_main(const char *autorun, Eina_Bool test_win_only, Eina_Bool autoclose) { Evas_Object *bg = NULL, *bx0 = NULL, *bx1 = NULL, *lb = NULL, *chk = NULL; Evas_Object *fr = NULL, *tg = NULL, *sc = NULL, *en = NULL; Eina_List *l = NULL; struct elm_test *t = NULL; + if (autoclose) ecore_timer_add(2, _auto_close, win); + if (test_win_only) goto add_tests; /* Create an elm window - It returns an evas object. This is a little * special as the object lives in the canvas that is inside the window @@ -1414,6 +1423,7 @@ efl_main(void *data EINA_UNUSED, { Efl_Loop_Arguments *arge = ev->info; Eina_Bool test_win_only = EINA_FALSE; + Eina_Bool autoclose = EINA_FALSE; char *autorun = NULL; if (arge->initialization) @@ -1454,6 +1464,7 @@ efl_main(void *data EINA_UNUSED, "$ elementary_test\n" "$ elementary_test --test-win-only [TEST_NAME]\n" "$ elementary_test -to [TEST_NAME]\n\n" + "$ elementary_test --autoclose\n\n" "Examples:\n" "$ elementary_test -to Button\n\n")); return ; @@ -1467,6 +1478,8 @@ efl_main(void *data EINA_UNUSED, } else if (eina_streq(arg, "--all") || eina_streq(arg, "-a")) all_tests = EINA_TRUE; + else if (eina_streq(arg, "--autoclose")) + autoclose = EINA_TRUE; else if ((i == eina_array_count(arge->argv) - 1) && (arg[0] != '-')) autorun = arg; @@ -1476,7 +1489,7 @@ efl_main(void *data EINA_UNUSED, { } - my_win_main(autorun, test_win_only); /* create main window */ + my_win_main(autorun, test_win_only, autoclose); /* create main window */ /* FIXME: Hum, no exit code anywhere anymore ? */ } --
[EGIT] [core/efl] master 01/01: ecore: Fix Asan stack overflow warning
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e94b5d014f42f53bbcc0e3c12693c801a78f9fcf commit e94b5d014f42f53bbcc0e3c12693c801a78f9fcf Author: Subhransu Mohanty Date: Wed Jun 3 11:17:18 2020 +0900 ecore: Fix Asan stack overflow warning Summary: As argument can be passed by register (depending on the compiler optimization) when we take the adress of the nbytes and pass it to send() function which reades 4 bytes from it ASAN flags it as a stack overflow . So just assign the value to a local variable to avoid the warning. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11914 --- src/lib/ecore/ecore_pipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/ecore/ecore_pipe.c b/src/lib/ecore/ecore_pipe.c index 4023bfa70f..e884494605 100644 --- a/src/lib/ecore/ecore_pipe.c +++ b/src/lib/ecore/ecore_pipe.c @@ -204,6 +204,7 @@ ecore_pipe_write(Ecore_Pipe *p, size_t already_written = 0; int retry = ECORE_PIPE_WRITE_RETRY; Eina_Bool ok = EINA_FALSE; + unsigned int bytes = nbytes; if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) { @@ -217,7 +218,7 @@ ecore_pipe_write(Ecore_Pipe *p, do // First write the len into the pipe { -ret = pipe_write(p->fd_write, , sizeof(nbytes)); +ret = pipe_write(p->fd_write, , sizeof(bytes)); if (ret == sizeof(nbytes)) { retry = ECORE_PIPE_WRITE_RETRY; --
[EGIT] [core/efl] master 01/04: eo: Fix memory leak in efl_key_wref_set() api.
bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5797129334789c1471bfadb640776b4a5d6e41b4 commit 5797129334789c1471bfadb640776b4a5d6e41b4 Author: Subhransu Mohanty Date: Wed May 27 07:39:59 2020 + eo: Fix memory leak in efl_key_wref_set() api. Testcase: elementary_test -to snapshot Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D11888 --- src/lib/eo/eo_base_class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c index 44fe92cf4a..565f4805e8 100644 --- a/src/lib/eo/eo_base_class.c +++ b/src/lib/eo/eo_base_class.c @@ -415,7 +415,7 @@ _key_generic_cb_del(void *data, const Efl_Event *event EINA_UNUSED) { Eo_Generic_Data_Node *node = data; Efl_Object_Data *pd = efl_data_scope_get(node->obj, EFL_OBJECT_CLASS); - _eo_key_generic_direct_del(pd, node, EINA_FALSE); + _eo_key_generic_direct_del(pd, node, EINA_TRUE); } EOLIAN static void --
[EGIT] [core/efl] master 01/01: elementary: Fix memory leak in elm_list
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=025e7238e7d8a2d190a525387e45304a82a8a6cc commit 025e7238e7d8a2d190a525387e45304a82a8a6cc Author: Subhransu Mohanty Date: Mon Jun 1 18:57:24 2020 +0900 elementary: Fix memory leak in elm_list Reviewers: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11909 --- src/lib/elementary/elm_list.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/elementary/elm_list.c b/src/lib/elementary/elm_list.c index 4447ea2f05..6936cb2e85 100644 --- a/src/lib/elementary/elm_list.c +++ b/src/lib/elementary/elm_list.c @@ -1060,6 +1060,8 @@ _items_fix(Evas_Object *obj) //focus highlight in_theme is set by list item theme. _elm_widget_item_highlight_in_theme( obj, elm_list_first_item_get(obj)); + + eina_array_flush(); } static void --
[EGIT] [core/efl] master 01/01: svg/loader: Fix memory leak
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=161e411d183f0b2d5c19a3a99b5e91e2246f5541 commit 161e411d183f0b2d5c19a3a99b5e91e2246f5541 Author: Subhransu Mohanty Date: Mon Jun 1 18:53:36 2020 +0900 svg/loader: Fix memory leak Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11908 --- src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c | 5 - src/static_libs/vg_common/vg_common_svg.c | 6 -- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c index 313d3eed15..9151e05c15 100644 --- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c +++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c @@ -2410,6 +2410,7 @@ static Eina_Bool evas_vg_load_file_close_svg(Vg_File_Data *vfd) { if (vfd->root) efl_unref(vfd->root); + free(vfd); return EINA_TRUE; } @@ -2462,7 +2463,9 @@ evas_vg_load_file_open_svg(Eina_File *file, } free(loader.svg_parse); - return vg_common_svg_create_vg_node(loader.doc); + Vg_File_Data* result = vg_common_svg_create_vg_node(loader.doc); + vg_common_svg_node_free(loader.doc); + return result; } static Evas_Vg_Load_Func evas_vg_load_svg_func = diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c index de5477bb0e..058cdf99e0 100644 --- a/src/static_libs/vg_common/vg_common_svg.c +++ b/src/static_libs/vg_common/vg_common_svg.c @@ -536,12 +536,14 @@ vg_common_svg_node_free(Svg_Node *node) { _svg_style_gradient_free(grad); } +case SVG_NODE_CUSTOME_COMMAND: + if (node->node.command.commands) free(node->node.command.commands); + if (node->node.command.points) free(node->node.command.points); break; default: break; } - if (node->node.command.commands_count > 0) free(node->node.command.commands); - if (node->node.command.points_count > 0) free(node->node.command.points); + free(node); } --
[EGIT] [core/efl] master 01/01: edje: fix memory leak by freeing the limits pointer.
jaehyun pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=11cbb5ae9352d08221a52ffe0271aa97305fe75a commit 11cbb5ae9352d08221a52ffe0271aa97305fe75a Author: Subhransu Mohanty Date: Wed May 27 14:55:44 2020 +0900 edje: fix memory leak by freeing the limits pointer. Summary: This limit parts are only used in naviframe edc thats why it is only showing up in naviframe test app. Reviewers: Jaehyun_Cho, Hermet Reviewed By: Jaehyun_Cho Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11887 --- src/lib/edje/edje_load.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index b3fa2e3d57..55ac53adf1 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2372,6 +2372,8 @@ _edje_collection_free(Edje_File *edf, Edje_Part_Collection *ec, Edje_Part_Collec if (ec->script) embryo_program_free(ec->script); _edje_lua2_script_unload(ec); + if (ec->limits.parts) free(ec->limits.parts); + eina_hash_free(ec->alias); eina_hash_free(ec->aliased); --
[EGIT] [core/efl] master 01/01: edje: Fix memory leak by freeing the filter data.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ed167716b6dcbad567e94930d838af13adac720f commit ed167716b6dcbad567e94930d838af13adac720f Author: Subhransu Mohanty Date: Wed May 27 12:31:35 2020 +0900 edje: Fix memory leak by freeing the filter data. Reviewers: Hermet, CHAN Reviewed By: CHAN Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D11879 --- src/lib/edje/edje_load.c | 16 1 file changed, 16 insertions(+) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 2fb3da0267..2888f6b291 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2172,6 +2172,22 @@ _edje_file_free(Edje_File *edf) free(edf->vibration_dir); } + if (edf->filter_dir) + { +int i; + +if (edf->free_strings) + { + for (i = 0; i < edf->filter_dir->filters_count; ++i) + { + eina_stringshare_del(edf->filter_dir->filters[i].name); + eina_stringshare_del(edf->filter_dir->filters[i].script); + } + } +free(edf->filter_dir->filters); +free(edf->filter_dir); + } + if (edf->mo_dir) { unsigned int i; --
[EGIT] [core/efl] master 01/01: meson: Changed meson build to support address sanitizer build
stefan pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f9a108c51a6a7f013df8dfd8c7735e1fa6d7dacc commit f9a108c51a6a7f013df8dfd8c7735e1fa6d7dacc Author: Subhransu Mohanty Date: Tue Jan 21 02:06:17 2020 + meson: Changed meson build to support address sanitizer build As we run some intermediate binary like edje_cc during efl build , and due to those binary has some memory leaks the address sanitizer build of efl fails. This Patch runs those binary with 'ASAN_OPTIONS=detect_leak=false' to disable the memory leak check for those binaries. Reviewed-by: Stefan Schmidt Differential Revision: https://phab.enlightenment.org/D11137 --- src/bin/edje/meson.build | 9 +++-- src/bin/elementary/meson.build | 9 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/bin/edje/meson.build b/src/bin/edje/meson.build index 0fff2cd6dc..fa059ca4b7 100644 --- a/src/bin/edje/meson.build +++ b/src/bin/edje/meson.build @@ -30,6 +30,11 @@ edje_cc = executable('edje_cc', link_args : bin_linker_args ) +asan_option =[] +if get_option('b_sanitize') == 'address' + asan_option= 'ASAN_OPTIONS=detect_leaks=0' +endif + if meson.is_cross_build() _edje_cc = find_program('edje_cc', native: true) edje_cc_path = _edje_cc.path() @@ -40,7 +45,7 @@ else edje_cc_exe = [edje_cc.full_path()] else env = find_program('env', native: true) -edje_cc_exe = [env, 'EFL_RUN_IN_TREE=1', edje_cc.full_path()] +edje_cc_exe = [env, asan_option, 'EFL_RUN_IN_TREE=1', edje_cc.full_path()] endif edje_depends = [edje_cc, epp, evas_engine_buffer_mod, embryo_cc] endif @@ -93,7 +98,7 @@ if meson.is_cross_build() edje_codegen_exe = [_edje_codegen] else env = find_program('env', native: true) - edje_codegen_exe = [env, 'EFL_RUN_IN_TREE=1', edje_codegen.full_path()] + edje_codegen_exe = [env, asan_option, 'EFL_RUN_IN_TREE=1', edje_codegen.full_path()] endif edje_pick = executable('edje_pick', diff --git a/src/bin/elementary/meson.build b/src/bin/elementary/meson.build index 0f8d79322d..ef5d3ded60 100644 --- a/src/bin/elementary/meson.build +++ b/src/bin/elementary/meson.build @@ -237,11 +237,16 @@ elementary_codegen = executable('elementary_codegen', link_args: link_args ) +asan_option =[] +if get_option('b_sanitize') == 'address' + asan_option= 'ASAN_OPTIONS=detect_leaks=0' +endif + if meson.is_cross_build() elementary_codegen_exe = [find_program('elementary_codegen', native: true)] else env = find_program('env', native: true) - elementary_codegen_exe = [env, 'EFL_RUN_IN_TREE=1', elementary_codegen.full_path()] + elementary_codegen_exe = [env, asan_option, 'EFL_RUN_IN_TREE=1', elementary_codegen.full_path()] endif elm_prefs_cc_src = [ @@ -267,7 +272,7 @@ if meson.is_cross_build() elm_prefs_cc_exe = [_elm_prefs_cc] else env = find_program('env', native: true) - elm_prefs_cc_exe = [env, 'EFL_RUN_IN_TREE=1', elm_prefs_cc.full_path()] + elm_prefs_cc_exe = [env, asan_option, 'EFL_RUN_IN_TREE=1', elm_prefs_cc.full_path()] endif if sys_windows == false --
[EGIT] [core/efl] master 01/01: eina/bezier: use FLT_EQ marcro for float equal comparison.
sanghyeonlee pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2bad5fffce2474a80a1173448b1be10c9c7b1949 commit 2bad5fffce2474a80a1173448b1be10c9c7b1949 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Wed Feb 28 15:15:20 2018 +0900 eina/bezier: use FLT_EQ marcro for float equal comparison. Reviewers: SanghyeonLee, jpeg, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5828 --- src/lib/eina/eina_bezier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/eina/eina_bezier.c b/src/lib/eina/eina_bezier.c index aade9af4cb..7d9b6d03ed 100644 --- a/src/lib/eina/eina_bezier.c +++ b/src/lib/eina/eina_bezier.c @@ -95,7 +95,7 @@ _eina_bezier_length_helper(const Eina_Bezier *b) chord = _line_length(b->start.x, b->start.y, b->end.x, b->end.y); - if (fabsf(len - chord) > FLT_MIN) { + if (!EINA_FLT_EQ(len, chord)) { _eina_bezier_split(b, , ); /* split in two */ length = _eina_bezier_length_helper() + /* try left side */ --
[EGIT] [core/efl] master 03/10: evas/vg: reset the path data in destructor.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=44c23ddec3f0997c2bcedce41d3cfcbf188a342f commit 44c23ddec3f0997c2bcedce41d3cfcbf188a342f Author: subhransu mohanty <sub.moha...@samsung.com> Date: Wed Feb 14 11:31:41 2018 -0800 evas/vg: reset the path data in destructor. Summary: As the gfx_path mixin class destructor is not called hence explicit call of reset. Reviewers: jpeg, SanghyeonLee Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5803 Signed-off-by: Cedric Bail <ced...@osg.samsung.com> --- src/lib/evas/canvas/evas_vg_shape.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c index d6ec51cf97..be04ee3b05 100644 --- a/src/lib/evas/canvas/evas_vg_shape.c +++ b/src/lib/evas/canvas/evas_vg_shape.c @@ -139,6 +139,7 @@ _efl_vg_shape_efl_object_constructor(Eo *obj, Efl_VG_Shape_Data *pd) static void _efl_vg_shape_efl_object_destructor(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED) { + efl_gfx_path_reset(obj); efl_destructor(efl_super(obj, MY_CLASS)); } --
[EGIT] [core/efl] master 01/02: ector: Updated the ector_buffer_pixels_set() api with stride info
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=48433efc43de9eeaf353e3da18c7109e434902da commit 48433efc43de9eeaf353e3da18c7109e434902da Author: subhransu mohanty <sub.moha...@samsung.com> Date: Thu Feb 8 14:27:15 2018 +0900 ector: Updated the ector_buffer_pixels_set() api with stride info Reviewers: jypark, jpeg Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5795 --- src/lib/ector/cairo/ector_cairo_software_surface.c | 4 ++-- src/lib/ector/ector_buffer.eo | 1 + src/lib/ector/software/ector_software_buffer.c | 10 +++--- src/modules/evas/engines/gl_generic/evas_engine.c | 4 ++-- .../evas/engines/software_generic/evas_ector_software_buffer.c | 2 +- src/modules/evas/engines/software_generic/evas_engine.c| 6 +++--- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/lib/ector/cairo/ector_cairo_software_surface.c b/src/lib/ector/cairo/ector_cairo_software_surface.c index 98dd8e0a4f..96bf1c1081 100644 --- a/src/lib/ector/cairo/ector_cairo_software_surface.c +++ b/src/lib/ector/cairo/ector_cairo_software_surface.c @@ -51,7 +51,7 @@ struct _Ector_Cairo_Software_Surface_Data EOLIAN static Eina_Bool _ector_cairo_software_surface_ector_buffer_pixels_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, - void *pixels, int width, int height, + void *pixels, int width, int height, int stride, Efl_Gfx_Colorspace cspace, Eina_Bool writable) { cairo_t *ctx = NULL; @@ -72,7 +72,7 @@ _ector_cairo_software_surface_ector_buffer_pixels_set(Eo *obj, Ector_Cairo_Softw cairo_surface_destroy(pd->surface); pd->surface = NULL; - ok = ector_buffer_pixels_set(efl_super(obj, MY_CLASS), pixels, width, height, cspace, writable); + ok = ector_buffer_pixels_set(efl_super(obj, MY_CLASS), pixels, width, height, stride, cspace, writable); if (ok && pixels) { diff --git a/src/lib/ector/ector_buffer.eo b/src/lib/ector/ector_buffer.eo index 143dcbb846..58d5409f37 100644 --- a/src/lib/ector/ector_buffer.eo +++ b/src/lib/ector/ector_buffer.eo @@ -77,6 +77,7 @@ mixin Ector.Buffer @in pixels: void_ptr; [[If $null, allocates an empty buffer]] @in width: int; [[Buffer width]] @in height: int; [[Buffer height]] +@in stride: int; [[Buffer stride (in bytes). If 0 then calculated based on $cspace and $width]] @in cspace: Efl.Gfx.Colorspace; [[Buffer colorspace]] @in writable: bool; [[Buffer is writable]] } diff --git a/src/lib/ector/software/ector_software_buffer.c b/src/lib/ector/software/ector_software_buffer.c index d44962bbec..8afe6c85c4 100644 --- a/src/lib/ector/software/ector_software_buffer.c +++ b/src/lib/ector/software/ector_software_buffer.c @@ -71,10 +71,10 @@ on_fail: EOLIAN static Eina_Bool _ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buffer_Base_Data *pd, -void *pixels, int width, int height, +void *pixels, int width, int height, int stride, Efl_Gfx_Colorspace cspace, Eina_Bool writable) { - unsigned pxs, stride; + unsigned pxs; if (pd->generic->immutable) fail("This buffer is immutable."); @@ -92,7 +92,11 @@ _ector_software_buffer_base_ector_buffer_pixels_set(Eo *obj, Ector_Software_Buff if (((unsigned long long)(uintptr_t)pixels) & (pxs - 1)) fail ("Pixel data is not aligned to %u bytes!", pxs); - stride = width * pxs; + if (stride == 0) + stride = width * pxs; + else if (stride < (int)(width * pxs)) + fail ("Stride is less than minimum stride: provided %u bytes, minimum %u bytes!", stride, (width * pxs)); + if (pd->pixels.u8 && (pd->pixels.u8 != pixels)) _ector_software_buffer_base_pixels_clear(obj, pd); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index b0edce0255..623e96aea4 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -2657,7 +2657,7 @@ eng_ector_begin(void *engine, void *output, memset(pixels, 0, stride * h); // it just uses the software backend to draw for now -ector_buffer_pixels_set(ector, pixels, w, h, EFL_GFX_COLORSPACE_ARGB, EINA_TRUE); +ector_buffer_pixels_set(ector, pixels, w, h, stride, EFL_GFX_COLORSPACE_ARGB, EINA_TRUE); ector_surface_reference_point_set(ector, x, y);
[EGIT] [core/efl] master 01/01: efl/vg: Refactor the svg path handling and interpolation.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2a31883f5a53b15128a49aee17b737ec0ee1d9c2 commit 2a31883f5a53b15128a49aee17b737ec0ee1d9c2 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Wed Jan 17 14:20:15 2018 +0900 efl/vg: Refactor the svg path handling and interpolation. Summary: This patch is taken from the tizen branch 1. Take care when the locale is different than POSIX. See: strtod, strtol 2. Interpolate all the property of a shape. Reviewers: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5740 --- src/lib/efl/interfaces/efl_gfx_path.c | 858 +- 1 file changed, 424 insertions(+), 434 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_path.c b/src/lib/efl/interfaces/efl_gfx_path.c index 2901373ddc..4d8ed3c6ca 100644 --- a/src/lib/efl/interfaces/efl_gfx_path.c +++ b/src/lib/efl/interfaces/efl_gfx_path.c @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -21,6 +22,7 @@ struct _Efl_Gfx_Path_Data unsigned int commands_count; unsigned int points_count; + char *path_data; Eina_Bool convex; }; @@ -273,6 +275,48 @@ interpolate(double from, double to, double pos_map) return (from * (1.0 - pos_map)) + (to * pos_map); } +static inline int +interpolatei(int from, int to, double pos_map) +{ + return (from * (1.0 - pos_map)) + (to * pos_map); +} + +typedef struct _Efl_Gfx_Property Efl_Gfx_Property; +struct _Efl_Gfx_Property +{ + double scale; + double w; + double centered; + + Efl_Gfx_Cap c; + Efl_Gfx_Join j; + + const Efl_Gfx_Dash *dash; + unsigned int dash_length; + + int r, g, b, a; + int fr, fg, fb, fa; +}; + +static inline void +_efl_gfx_property_get(const Eo *obj, Efl_Gfx_Property *property) +{ + + property->scale = efl_gfx_shape_stroke_scale_get(obj); + efl_gfx_shape_stroke_color_get(obj, >r, >g, >b, >a); + efl_gfx_color_get(obj, >fr, >fg, >fb, >fa); + property->w = efl_gfx_shape_stroke_width_get(obj); + property->centered = efl_gfx_shape_stroke_location_get(obj); + efl_gfx_shape_stroke_dash_get(obj, >dash, >dash_length); + property->c = efl_gfx_shape_stroke_cap_get(obj); + property->j = efl_gfx_shape_stroke_join_get(obj); +} + + + +static void _path_interpolation(Eo *obj, Efl_Gfx_Path_Data *pd, char *from, char *to, double pos); +static void _efl_gfx_path_reset(Eo *obj, Efl_Gfx_Path_Data *pd); + EOLIAN static Eina_Bool _efl_gfx_path_interpolate(Eo *obj, Efl_Gfx_Path_Data *pd, const Eo *from, const Eo *to, double pos_map) @@ -280,68 +324,112 @@ _efl_gfx_path_interpolate(Eo *obj, Efl_Gfx_Path_Data *pd, Efl_Gfx_Path_Change_Event ev = { EFL_GFX_CHANGE_FLAG_PATH }; Efl_Gfx_Path_Data *from_pd, *to_pd; Efl_Gfx_Path_Command *cmds; + Efl_Gfx_Property property_from, property_to; + Efl_Gfx_Dash *dash = NULL; double *pts; unsigned int i, j; from_pd = efl_data_scope_get(from, EFL_GFX_PATH_MIXIN); to_pd = efl_data_scope_get(to, EFL_GFX_PATH_MIXIN); - if (!efl_isa(from, EFL_GFX_PATH_MIXIN) || !efl_isa(to, EFL_GFX_PATH_MIXIN)) return EINA_FALSE; - if (pd == from_pd || pd == to_pd) return EINA_FALSE; - if (!_efl_gfx_path_equal_commands_internal(from_pd, to_pd)) - return EINA_FALSE; - cmds = realloc(pd->commands, - sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count); - if (!cmds && from_pd->commands_count) return EINA_FALSE; + _efl_gfx_property_get(from, _from); + _efl_gfx_property_get(to, _to); + + if (property_from.dash_length != property_to.dash_length) return EINA_FALSE; - pts = realloc(pd->points, sizeof (double) * from_pd->points_count); - if (!pts && from_pd->points_count) + if (from_pd->path_data && to_pd->path_data) { -free(cmds); -return EINA_FALSE; +_efl_gfx_path_reset(obj, pd); +_path_interpolation(obj, pd, from_pd->path_data, to_pd->path_data, pos_map); } - - pd->commands = cmds; - pd->points = pts; - - if (cmds) + else { -memcpy(cmds, from_pd->commands, - sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count); +if (!_efl_gfx_path_equal_commands_internal(from_pd, to_pd)) + return EINA_FALSE; +cmds = realloc(pd->commands, + sizeof (Efl_Gfx_Path_Command) * from_pd->commands_count); +if (!cmds && from_pd->commands_count) return EINA_FALSE; +pd->commands = cmds; -if (pts) +pts = realloc(pd->points, + sizeof (double) * from_pd->points_count); +if (!pts && from_pd->points_count) return EINA_FALSE; +pd->points = pts; + +if (cm
[EGIT] [core/efl] master 01/01: evas/vg: Use always blending op while drawing the vector.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d838220d5671875eaef1dcea9dd024cc126360e0 commit d838220d5671875eaef1dcea9dd024cc126360e0 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Mon Jan 8 19:16:59 2018 +0900 evas/vg: Use always blending op while drawing the vector. Summary: The default backend overrides this operation depending on the fill color but the cairo backend dosen't hence cairo will always use bled mode while drwaing the vector. Reviewers: jpeg Subscribers: vtorri, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5724 --- src/modules/evas/engines/gl_generic/evas_engine.c | 16 +--- .../evas/engines/software_generic/evas_engine.c | 19 ++- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 0829e7a0b4..d5c8544fda 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -2546,20 +2546,6 @@ eng_ector_buffer_new(void *engine, Evas *evas, int w, int h, evas_ector_gl_buffer_prepare(efl_added, engine, w, h, cspace, flags)); } -static Efl_Gfx_Render_Op -_evas_render_op_to_ector_rop(Evas_Render_Op op) -{ - switch (op) - { - case EVAS_RENDER_BLEND: - return EFL_GFX_RENDER_OP_BLEND; - case EVAS_RENDER_COPY: - return EFL_GFX_RENDER_OP_COPY; - default: - return EFL_GFX_RENDER_OP_BLEND; - } -} - static void eng_ector_renderer_draw(void *engine EINA_UNUSED, void *output, void *context EINA_UNUSED, void *surface EINA_UNUSED, @@ -2575,7 +2561,7 @@ eng_ector_renderer_draw(void *engine EINA_UNUSED, void *output, eng_image_size_get(engine, glimg, , ); eina_array_push(c, eina_rectangle_new(0, 0, w, h)); -ector_renderer_draw(renderer, _evas_render_op_to_ector_rop(EVAS_RENDER_COPY), c, 0x); +ector_renderer_draw(renderer, EFL_GFX_RENDER_OP_BLEND, c, 0x); while ((r = eina_array_pop(c))) eina_rectangle_free(r); diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index 016179da2f..139ccc1a1c 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c @@ -4420,20 +4420,6 @@ eng_ector_buffer_new(void *data EINA_UNUSED, Evas *evas, int width, int height, return buf; } -static Efl_Gfx_Render_Op -_evas_render_op_to_ector_rop(Evas_Render_Op op) -{ - switch (op) - { - case EVAS_RENDER_BLEND: - return EFL_GFX_RENDER_OP_BLEND; - case EVAS_RENDER_COPY: - return EFL_GFX_RENDER_OP_COPY; - default: - return EFL_GFX_RENDER_OP_BLEND; - } -} - static void _draw_thread_ector_cleanup(Evas_Thread_Command_Ector *ector) { @@ -4518,9 +4504,8 @@ eng_ector_renderer_draw(void *engine EINA_UNUSED, void *surface, ector.r = renderer; // This has already been refcounted by Evas_Object_VG ector.clips = c; - ector.render_op = _evas_render_op_to_ector_rop(dc->render_op); - ector.mul_col = ector_color_multiply(dc->mul.use ? dc->mul.col : 0x, -dc->col.col);; + ector.render_op = EFL_GFX_RENDER_OP_BLEND; + ector.mul_col = 0x; ector.free_it = EINA_FALSE; if (do_async) --
[EGIT] [core/efl] master 01/07: triangulator:Added stroke_set api to the triangulator_stroker.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5f9c54a1b2724abcb02ba0a70640a927a1f67ccc commit 5f9c54a1b2724abcb02ba0a70640a927a1f67ccc Author: subhransu mohanty <sub.moha...@samsung.com> Date: Thu Oct 26 10:59:16 2017 +0900 triangulator:Added stroke_set api to the triangulator_stroker. --- src/static_libs/triangulator/triangulator_stroker.c | 14 ++ src/static_libs/triangulator/triangulator_stroker.h | 5 - 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/static_libs/triangulator/triangulator_stroker.c b/src/static_libs/triangulator/triangulator_stroker.c index a1d06657f0..cf07bec5a3 100644 --- a/src/static_libs/triangulator/triangulator_stroker.c +++ b/src/static_libs/triangulator/triangulator_stroker.c @@ -21,6 +21,20 @@ triangulator_stroker_free(Triangulator_Stroker *stroker) eina_inarray_free(stroker->arc_pts); } +void triangulator_stroker_stroke_set(Triangulator_Stroker *stroker, float width, + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, Eina_Matrix3 *m) +{ + float scale_factor = 1.0; + if (m) + { +// get the minimum scale factor from matrix +scale_factor = m->xx < m->yy ? m->xx : m->yy; + } + stroker->width = (width * scale_factor)/2; + stroker->join_style = join_style; + stroker->cap_style = cap_style; +} + // calculate the normal vector static void normal_vector(float x1, float y1, float x2, float y2, float width, diff --git a/src/static_libs/triangulator/triangulator_stroker.h b/src/static_libs/triangulator/triangulator_stroker.h index 2dee4290e4..4cb0f3e2a4 100644 --- a/src/static_libs/triangulator/triangulator_stroker.h +++ b/src/static_libs/triangulator/triangulator_stroker.h @@ -38,6 +38,9 @@ Triangulator_Stroker *triangulator_stroker_new(void); */ void triangulator_stroker_free(Triangulator_Stroker *stroker); +void triangulator_stroker_stroke_set(Triangulator_Stroker *stroker, float width, + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, Eina_Matrix3 *m); + /** * Process the command list to generate triangle strips. * The alogrithm handles multiple contour by adding invisible triangles. @@ -48,7 +51,7 @@ void triangulator_stroker_free(Triangulator_Stroker *stroker); * pt_count : number of points. * * output : It generates the outline in the form of triangle strips store in vertices array. - * The array can be used to copy the data to a VBO and draw the data using TRIANGLE_STRIP. + * The array can be used to copy the data to a VBO and draw the data using TRIANGLE_STRIP. */ void triangulator_stroker_process(Triangulator_Stroker *stroker, const Efl_Gfx_Path_Command *cmds, const double *pts, int cmd_count, int pt_count); --
[EGIT] [core/efl] master 05/07: evas/engine: added new engine api for ector
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=befb7701a71e45e9c76fb3873f3056b74d62527c commit befb7701a71e45e9c76fb3873f3056b74d62527c Author: subhransu mohanty <sub.moha...@samsung.com> Date: Fri Oct 27 13:42:01 2017 +0900 evas/engine: added new engine api for ector --- src/lib/evas/common/evas_common_generic_cache.c| 6 +- src/lib/evas/include/evas_private.h| 6 ++ src/modules/evas/engines/gl_generic/evas_engine.c | 65 +- .../evas/engines/software_generic/evas_engine.c| 53 ++ 4 files changed, 126 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c index 55fd6e06b2..55bcf725d6 100644 --- a/src/lib/evas/common/evas_common_generic_cache.c +++ b/src/lib/evas/common/evas_common_generic_cache.c @@ -34,7 +34,7 @@ generic_cache_dump(Generic_Cache *cache) } EAPI void -generic_cache_set(Generic_Cache *cache, void *key, void *surface) +generic_cache_data_set(Generic_Cache *cache, void *key, void *surface) { Generic_Cache_Entry *entry = NULL; int count; @@ -59,7 +59,7 @@ generic_cache_set(Generic_Cache *cache, void *key, void *surface) } EAPI void * -generic_cache_get(Generic_Cache *cache, void *key) +generic_cache_data_get(Generic_Cache *cache, void *key) { Generic_Cache_Entry *entry = NULL, *lru_data; Eina_List *l; @@ -84,7 +84,7 @@ generic_cache_get(Generic_Cache *cache, void *key) } EAPI void -generic_cache_drop(Generic_Cache *cache, void *key) +generic_cache_data_drop(Generic_Cache *cache, void *key) { Generic_Cache_Entry *entry = NULL; diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 7ec4095692..2fac91e094 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -1513,6 +1513,12 @@ struct _Evas_Func void* (*ector_new)(void *engine, void *context, Ector_Surface *ector, void *surface); void (*ector_free) (void *engine_data); + void *(*ector_surface_create) (void *engine, int w, int h, int *error); + void (*ector_surface_destroy)(void *engine, void *surface); + void (*ector_surface_cache_set) (void *engine, void *key, void *surface); + void *(*ector_surface_cache_get) (void *engine, void *key); + void (*ector_surface_cache_drop) (void *engine, void *key); + Evas_Filter_Support (*gfx_filter_supports) (void *engine, Evas_Filter_Command *cmd); Eina_Bool (*gfx_filter_process) (void *engine, Evas_Filter_Command *cmd); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 62f1a38290..6e6d6a9082 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -2623,6 +2623,65 @@ eng_ector_renderer_draw(void *engine EINA_UNUSED, void *data, void *context, voi eina_array_free(c); } +// Ector functions start +static void* +eng_ector_surface_create(void *engine, int width, int height, int *error) +{ + void *surface; + + *error = EINA_FALSE; + + if (use_gl) + { +surface = evas_gl_common_image_surface_new(gl_generic_context_get(engine, EINA_TRUE), + width, height, EINA_TRUE, EINA_FALSE); +if (!surface) *error = EINA_TRUE; + } + else + { +surface = eng_image_new_from_copied_data(engine, width, height, NULL, EINA_TRUE, EVAS_COLORSPACE_ARGB); +if (!surface) + *error = EINA_TRUE; +else //Use this hint for ZERO COPY texture upload. + eng_image_content_hint_set(engine, surface, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); + } + + return surface; +} + +static void +eng_ector_surface_destroy(void *engine, void *surface) +{ + if (!surface) return; + eng_image_free(engine, surface); +} + +static void +eng_ector_surface_cache_set(void *engine, void *key , void *surface) +{ + Render_Engine_GL_Generic *e = engine; + + generic_cache_data_set(e->software.surface_cache, key, surface); + +} + +static void * +eng_ector_surface_cache_get(void *engine, void *key) +{ + Render_Engine_GL_Generic *e = engine; + + return generic_cache_data_get(e->software.surface_cache, key); +} + +static void +eng_ector_surface_cache_drop(void *engine, void *key) +{ + Render_Engine_GL_Generic *e = engine; + + generic_cache_data_drop(e->software.surface_cache, key); +} + + typedef struct _Evas_GL_Ector Evas_GL_Ector; struct _Evas_GL_Ector { @@ -3305,7 +3364,11 @@ module_open(Evas_Module *em) ORD(ector_end); ORD(ector_new); ORD(ector_free); - + ORD(ector_surface_create); + ORD(ector_surface_destroy); + ORD(ector_surface_cache_set); + ORD(ector_surface_cache_get); + ORD(ector_surface_cache_drop); ORD(gfx_
[EGIT] [core/efl] master 03/07: evas/common: added a generic cache in evas common.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d4a2b2025bd1e7396de74c0becb09d4ecbf3b6b9 commit d4a2b2025bd1e7396de74c0becb09d4ecbf3b6b9 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Thu Nov 9 10:34:01 2017 +0900 evas/common: added a generic cache in evas common. --- src/Makefile_Evas.am| 4 +- src/lib/evas/common/evas_common_generic_cache.c | 104 2 files changed, 107 insertions(+), 1 deletion(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index f1d0148667..408c0c7583 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -494,7 +494,9 @@ lib/evas/common/language/evas_language_utils.h \ lib/evas/common/language/evas_script_table.h \ lib/evas/common/evas_text_utils.h \ lib/evas/common/evas_font_ot.h \ -lib/evas/common/evas_font_draw.h +lib/evas/common/evas_font_draw.h \ +lib/evas/common/evas_common_generic_cache.c + lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/canvas \ diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c new file mode 100644 index 00..55fd6e06b2 --- /dev/null +++ b/src/lib/evas/common/evas_common_generic_cache.c @@ -0,0 +1,104 @@ +#include "evas_common_private.h" + +EAPI Generic_Cache* +generic_cache_new(void *user_data, Generic_Cache_Free func) +{ + Generic_Cache *cache; + cache = calloc(1, sizeof(Generic_Cache)); + cache->hash = eina_hash_int32_new(NULL); + cache->user_data = user_data; + cache->free_func = func; + return cache; +} + +EAPI void +generic_cache_destroy(Generic_Cache *cache) +{ + generic_cache_dump(cache); + eina_hash_free(cache->hash); +} + +EAPI void +generic_cache_dump(Generic_Cache *cache) +{ + Generic_Cache_Entry *entry; + if (cache) + { +eina_hash_free_buckets(cache->hash); +EINA_LIST_FREE(cache->lru_list, entry) + { + cache->free_func(cache->user_data, entry->data); + free(entry); + } + } +} + +EAPI void +generic_cache_set(Generic_Cache *cache, void *key, void *surface) +{ + Generic_Cache_Entry *entry = NULL; + int count; + + entry = calloc(1, sizeof(Generic_Cache_Entry)); + entry->key = key; + entry->data = surface; + entry->ref = 1; + eina_hash_add(cache->hash, , entry); + cache->lru_list = eina_list_prepend(cache->lru_list, entry); + count = eina_list_count(cache->lru_list); + if (count > 50) + { + entry = eina_list_data_get(eina_list_last(cache->lru_list)); + // if its still being ref. + if (entry->ref) return; + eina_hash_del(cache->hash, >key, entry); + cache->lru_list = eina_list_remove_list(cache->lru_list, eina_list_last(cache->lru_list)); + cache->free_func(cache->user_data, entry->data); + free(entry); + } +} + +EAPI void * +generic_cache_get(Generic_Cache *cache, void *key) +{ + Generic_Cache_Entry *entry = NULL, *lru_data; + Eina_List *l; + + entry = eina_hash_find(cache->hash, ); + if (entry) + { +// update the ref +entry->ref += 1; +// promote in lru +EINA_LIST_FOREACH(cache->lru_list, l, lru_data) + { +if (lru_data == entry) + { + cache->lru_list = eina_list_promote_list(cache->lru_list, l); + break; + } + } +return entry->data; + } + return NULL; +} + +EAPI void +generic_cache_drop(Generic_Cache *cache, void *key) +{ + Generic_Cache_Entry *entry = NULL; + + entry = eina_hash_find(cache->hash, ); + if (entry) + { +entry->ref -= 1; +// if its still being ref. +if (entry->ref) return; +eina_hash_del(cache->hash, >key, entry); +// find and remove from lru list +cache->lru_list = eina_list_remove(cache->lru_list, entry); +cache->free_func(cache->user_data, entry->data); +free(entry); + } +} + --
[EGIT] [core/efl] master 07/07: evas/vg: use surface cache for efl vg canvas
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=41062cb15d2fecf57d3e649eabdb373f909ca53c commit 41062cb15d2fecf57d3e649eabdb373f909ca53c Author: subhransu mohanty <sub.moha...@samsung.com> Date: Thu Nov 9 16:57:00 2017 +0900 evas/vg: use surface cache for efl vg canvas --- src/lib/evas/canvas/efl_canvas_vg.c| 257 + src/lib/evas/canvas/evas_vg_private.h | 9 +- src/modules/evas/engines/gl_sdl/evas_engine.c | 1 + .../evas/engines/software_generic/evas_engine.c| 1 - 4 files changed, 225 insertions(+), 43 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg.c b/src/lib/evas/canvas/efl_canvas_vg.c index a869308651..4d204edd41 100644 --- a/src/lib/evas/canvas/efl_canvas_vg.c +++ b/src/lib/evas/canvas/efl_canvas_vg.c @@ -135,18 +135,21 @@ evas_object_vg_add(Evas *e) EOLIAN static Efl_VG * _efl_canvas_vg_root_node_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd) { + Efl_VG *root = NULL; + if (pd->vg_entry) - { -return evas_cache_vg_tree_get(pd->vg_entry); - } - return pd->vg_tree; + root = evas_cache_vg_tree_get(pd->vg_entry); + else if (pd->user_entry) + root = pd->user_entry->root; + + return root; } EOLIAN static void -_efl_canvas_vg_root_node_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_VG *root_node) +_efl_canvas_vg_root_node_set(Eo *obj, Efl_Canvas_Vg_Data *pd, Efl_VG *root_node) { // if the same root is already set - if (pd->vg_tree == root_node) + if (pd->user_entry && pd->user_entry->root == root_node) return; // check if a file has been already set @@ -157,15 +160,26 @@ _efl_canvas_vg_root_node_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_VG } // detach/free the old root_node - if (pd->vg_tree) - efl_parent_set(pd->vg_tree, NULL); + if (pd->user_entry && pd->user_entry->root) + efl_parent_set(pd->user_entry->root, NULL); - pd->vg_tree = root_node; - - if (pd->vg_tree) + if (root_node) { +pd->user_entry = calloc(1, sizeof(User_Vg_Entry)); +pd->user_entry->root = root_node; // set the parent so that vg canvas can render it. -efl_parent_set(pd->vg_tree, pd->root); +efl_parent_set(pd->user_entry->root, pd->root); + } + else + { +if (pd->user_entry) + { + // drop any surface cache attached to it. + Evas_Object_Protected_Data *eobj = efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS); + eobj->layer->evas->engine.func->ector_surface_cache_drop(_evas_engine_context(eobj->layer->evas), pd->user_entry); + free(pd->user_entry); + } +pd->user_entry = NULL; } // force a redraw @@ -304,13 +318,8 @@ _cleanup_reference(void *data, const Efl_Event *event EINA_UNUSED) EOLIAN static void _efl_canvas_vg_efl_object_destructor(Eo *eo_obj, Efl_Canvas_Vg_Data *pd) { - Evas_Object_Protected_Data *obj; Evas *e = evas_object_evas_get(eo_obj); - obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS); - if (pd->engine_data) - obj->layer->evas->engine.func->ector_free(pd->engine_data); - efl_event_callback_del(e, EFL_CANVAS_EVENT_RENDER_POST, _cleanup_reference, pd); efl_del(pd->root); @@ -376,13 +385,193 @@ _evas_vg_render(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Data *vd, nd = efl_data_scope_get(n, EFL_VG_CLASS); -obj->layer->evas->engine.func->ector_renderer_draw(engine, output, context, surface, vd->engine_data, nd->renderer, clips, do_async); +obj->layer->evas->engine.func->ector_renderer_draw(engine, output, context, surface, nd->renderer, clips, do_async); if (do_async) eina_array_push(>cleanup, efl_ref(nd->renderer)); } } +// renders a vg_tree to an offscreen buffer +// and push it to the cache. +static void * +_render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Data *vd, + void *engine, void *surface, + Efl_VG *root, int w, int h, void *key, + void *buffer, Eina_Bool do_async) +{ + Ector_Surface *ector; + RGBA_Draw_Context *context; + int error = 0; + Eina_Bool buffer_created = EINA_FALSE; + + ector = evas_ector_get(obj->layer->evas); + if (!ector) return NULL; + + if (!buffer) + { +// 2. create a buffer +buffer = obj->layer->evas->engine.func->ector_surface_create(engine, + w, h, + ); +if (error) + return NULL; // surface creation error +buffer_created = E
[EGIT] [core/efl] master 02/07: ector: move gradient generation api to draw library for reuse.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=76e75dc105ce98b29d5fd9026a0bc2fd18e41acd commit 76e75dc105ce98b29d5fd9026a0bc2fd18e41acd Author: subhransu mohanty <sub.moha...@samsung.com> Date: Thu Oct 26 11:12:42 2017 +0900 ector: move gradient generation api to draw library for reuse. --- src/lib/ector/software/ector_software_gradient.c | 63 +--- src/static_libs/draw/draw.h | 2 + src/static_libs/draw/draw_main.c | 58 ++ 3 files changed, 62 insertions(+), 61 deletions(-) diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c index 2656a1da5f..7f4e916511 100644 --- a/src/lib/ector/software/ector_software_gradient.c +++ b/src/lib/ector/software/ector_software_gradient.c @@ -280,73 +280,14 @@ _linear_helper_sse3(uint32_t *buffer, int length, Ector_Renderer_Software_Gradie #endif -static inline double -_ease_linear(double t) -{ - return t; -} - -static Eina_Bool -_generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_count, uint32_t *color_table, int size) -{ - int dist, idist, pos = 0, i; - Eina_Bool alpha = EINA_FALSE; - Efl_Gfx_Gradient_Stop *curr, *next; - uint32_t current_color, next_color; - double delta, t, incr, fpos; - - assert(stop_count > 0); - - curr = gradient_stops; - if (curr->a != 255) alpha = EINA_TRUE; - current_color = DRAW_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b); - incr = 1.0 / (double)size; - fpos = 1.5 * incr; - - color_table[pos++] = current_color; - - while (fpos <= curr->offset) - { -color_table[pos] = color_table[pos - 1]; -pos++; -fpos += incr; - } - - for (i = 0; i < stop_count - 1; ++i) - { -curr = (gradient_stops + i); -next = (gradient_stops + i + 1); -delta = 1/(next->offset - curr->offset); -if (next->a != 255) alpha = EINA_TRUE; -next_color = DRAW_ARGB_JOIN(next->a, next->r, next->g, next->b); -while (fpos < next->offset && pos < size) - { - t = _ease_linear((fpos - curr->offset) * delta); - dist = (int)(256 * t); - idist = 256 - dist; - color_table[pos] = draw_interpolate_256(current_color, idist, next_color, dist); - ++pos; - fpos += incr; - } -current_color = next_color; - } - - for (;pos < size; ++pos) - color_table[pos] = current_color; - - // Make sure the last color stop is represented at the end of the table - color_table[size-1] = current_color; - return alpha; -} - static void _update_color_table(void *data, Ector_Software_Thread *t EINA_UNUSED) { Ector_Renderer_Software_Gradient_Data *gdata = data; gdata->color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4); - gdata->alpha = _generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count, - gdata->color_table, GRADIENT_STOPTABLE_SIZE); + gdata->alpha = efl_draw_generate_gradient_color_table(gdata->gd->colors, gdata->gd->colors_count, + gdata->color_table, GRADIENT_STOPTABLE_SIZE); } static void diff --git a/src/static_libs/draw/draw.h b/src/static_libs/draw/draw.h index e4f64340f4..825d6338f0 100644 --- a/src/static_libs/draw/draw.h +++ b/src/static_libs/draw/draw.h @@ -29,6 +29,8 @@ Cspace_Convert_Func efl_draw_convert_func_get (Efl_Gfx_Colorspace origcs, int efl_draw_argb_premul(uint32_t *data, unsigned int len); void efl_draw_argb_unpremul(uint32_t *data, unsigned int len); +Eina_Bool efl_draw_generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_count, uint32_t *color_table, int size); + /* common sw draw helpers */ diff --git a/src/static_libs/draw/draw_main.c b/src/static_libs/draw/draw_main.c index 92d2044541..2731514789 100644 --- a/src/static_libs/draw/draw_main.c +++ b/src/static_libs/draw/draw_main.c @@ -276,6 +276,64 @@ efl_draw_func_span_get(Efl_Gfx_Render_Op op, uint32_t color, Eina_Bool src_alpha return func_for_mode[op]; } +static double +_ease_linear(double t) +{ + return t; +} + +Eina_Bool +efl_draw_generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_count, uint32_t *color_table, int size) +{ + int dist, idist, pos = 0, i; + Eina_Bool alpha = EINA_FALSE; + Efl_Gfx_Gradient_Stop *curr, *next; + uint32_t current_color, next_color; + double delta, t, incr, fpos; + + curr = gradient_stops; + if (curr->a != 255) alpha = EINA_TRUE; + current_color = DRAW_ARGB_JOIN(curr->a, curr->r, curr->g, curr->b); + incr = 1.0 / (double)size; + fpos = 1.5 * incr; + + color_table[pos++] = current_color;
[EGIT] [core/efl] master 04/07: evas/vg: added support for engine surface cache.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=aacf277c3affcc68806020c1f9e7a44829e1bb74 commit aacf277c3affcc68806020c1f9e7a44829e1bb74 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Thu Nov 9 10:31:12 2017 +0900 evas/vg: added support for engine surface cache. --- src/lib/evas/include/evas_common_private.h | 28 + src/modules/evas/engines/gl_drm/evas_engine.c | 5 +- src/modules/evas/engines/gl_generic/evas_engine.c | 5 + src/modules/evas/engines/gl_sdl/evas_engine.c | 5 +- src/modules/evas/engines/gl_x11/evas_engine.c | 4 +- .../Evas_Engine_Software_Generic.h | 2 +- .../evas/engines/software_generic/evas_engine.c| 122 +++-- src/modules/evas/engines/wayland_egl/evas_engine.c | 3 +- 8 files changed, 108 insertions(+), 66 deletions(-) diff --git a/src/lib/evas/include/evas_common_private.h b/src/lib/evas/include/evas_common_private.h index 4f731d4e79..6518b16f93 100644 --- a/src/lib/evas/include/evas_common_private.h +++ b/src/lib/evas/include/evas_common_private.h @@ -1174,6 +1174,34 @@ typedef enum _Evas_Render_Mode void evas_common_rgba_image_scalecache_items_ref(Image_Entry *ie, Eina_Array *ret); void evas_common_rgba_image_scalecache_item_unref(Image_Entry *ie); +// Generic Cache +typedef struct _Generic_Cache Generic_Cache; +typedef struct _Generic_Cache_EntryGeneric_Cache_Entry; + +struct _Generic_Cache_Entry +{ + void *key; // pointer + void *data; // engine image + int ref; +}; + +typedef void (*Generic_Cache_Free)(void *user_data, void *data); + +struct _Generic_Cache +{ + Eina_Hash *hash; + Eina_List *lru_list; + void *user_data; + Generic_Cache_Free free_func; +}; + +EAPI Generic_Cache* generic_cache_new(void *user_data, Generic_Cache_Free func); +EAPI void generic_cache_destroy(Generic_Cache *cache); +EAPI void generic_cache_dump(Generic_Cache *cache); +EAPI void generic_cache_data_set(Generic_Cache *cache, void *key, void *data); +EAPI void *generic_cache_data_get(Generic_Cache *cache, void *key); +EAPI void generic_cache_data_drop(Generic_Cache *cache, void *key); + /*/ #ifdef __cplusplus diff --git a/src/modules/evas/engines/gl_drm/evas_engine.c b/src/modules/evas/engines/gl_drm/evas_engine.c index e1a36940cc..fd219bbd9b 100644 --- a/src/modules/evas/engines/gl_drm/evas_engine.c +++ b/src/modules/evas/engines/gl_drm/evas_engine.c @@ -1070,13 +1070,14 @@ eng_canvas_alpha_get(void *data) } static void -eng_output_dump(void *engine EINA_UNUSED, void *data) +eng_output_dump(void *engine, void *data) { Render_Engine *re; + Render_Engine_GL_Generic *e = engine; re = (Render_Engine *)data; if (!re) return; - + generic_cache_dump(e->software.surface_cache); evas_common_image_image_all_unload(); evas_common_font_font_all_unload(); glsym_evas_gl_common_image_all_unload(eng_get_ob(re)->gl_context); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index a6b229a5c6..62f1a38290 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -152,6 +152,8 @@ egl_display_get(Render_Engine_GL_Generic *engine) } #endif +void eng_image_free(void *engine, void *image); + static void * eng_engine_new(void) { @@ -159,6 +161,7 @@ eng_engine_new(void) engine = calloc(1, sizeof (Render_Engine_GL_Generic)); if (!engine) return NULL; + engine->software.surface_cache = generic_cache_new(engine, eng_image_free); return engine; } @@ -169,6 +172,8 @@ eng_engine_free(void *engine) Render_Engine_GL_Generic *e = engine; Render_Output_GL_Generic *output; + generic_cache_destroy(e->software.surface_cache); + EINA_LIST_FREE(e->software.outputs, output) ERR("Output %p not properly cleaned before engine destruction.", output); free(e); diff --git a/src/modules/evas/engines/gl_sdl/evas_engine.c b/src/modules/evas/engines/gl_sdl/evas_engine.c index bf6ba6540c..8a00b1196b 100644 --- a/src/modules/evas/engines/gl_sdl/evas_engine.c +++ b/src/modules/evas/engines/gl_sdl/evas_engine.c @@ -316,11 +316,13 @@ eng_output_free(void *engine, void *data) } static void -eng_output_dump(void *engine EINA_UNUSED, void *data) +eng_output_dump(void *engine, void *data) { Render_Engine *re; + Render_Engine_GL_Generic *e = engine; re = (Render_Engine *)data; + generic_cache_dump(e->software.surface_cache); evas_common_image_image_all_unload(); evas_common_font_font_all_unload(); glsym_evas_gl_common_image_all_unload(re->generic.software.ob->gl_context); @@ -339,7 +341,6 @@ gl_symbols(void) #define LINK2GENERIC(sym) \
[EGIT] [core/efl] master 01/01: evas/vg: changed the efl_vg_dup api signature.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8952c3e52444d78504a822bf95d757621891dd41 commit 8952c3e52444d78504a822bf95d757621891dd41 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Wed Nov 8 15:49:37 2017 +0900 evas/vg: changed the efl_vg_dup api signature. Reviewers: jpeg, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5440 --- src/lib/edje/edje_calc.c | 4 +- src/lib/evas/canvas/efl_vg.eo | 6 +-- src/lib/evas/canvas/evas_vg_container.c | 26 -- src/lib/evas/canvas/evas_vg_gradient.c| 21 src/lib/evas/canvas/evas_vg_gradient_linear.c | 18 +++ src/lib/evas/canvas/evas_vg_gradient_radial.c | 20 src/lib/evas/canvas/evas_vg_node.c| 70 +-- src/lib/evas/canvas/evas_vg_shape.c | 44 ++--- src/lib/evas/vg/evas_vg_cache.c | 3 +- 9 files changed, 76 insertions(+), 136 deletions(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index d752e2360a..3cfa5dc924 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3729,9 +3729,7 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U dest_root = efl_canvas_vg_root_node_get(ep->object); efl_ref(dest_root); -// FIXME: root = dup(), root.interpolate(dest). -root = evas_vg_container_add(NULL); -evas_vg_node_dup(root, src_root); +root = evas_vg_node_dup(src_root); if (!evas_vg_node_interpolate(root, src_root, dest_root, pos)) { diff --git a/src/lib/evas/canvas/efl_vg.eo b/src/lib/evas/canvas/efl_vg.eo index ecb514133b..2d64ade17b 100644 --- a/src/lib/evas/canvas/efl_vg.eo +++ b/src/lib/evas/canvas/efl_vg.eo @@ -103,11 +103,9 @@ abstract Efl.VG (Efl.Object, Efl.Gfx, Efl.Gfx.Stack) @in pos_map: double; [[Interpolate mapping]] } } - dup { + dup @const { [[Duplicate vector graphics object]] -params { - @in from: const(Efl.VG); [[Source object]] -} +return: Efl.VG @owned; } } implements { diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c index 704d6c1485..b89d702369 100644 --- a/src/lib/evas/canvas/evas_vg_container.c +++ b/src/lib/evas/canvas/evas_vg_container.c @@ -151,28 +151,20 @@ _efl_vg_container_efl_vg_interpolate(Eo *obj, return r; } -static void -_efl_vg_container_efl_vg_dup(Eo *obj, - Efl_VG_Container_Data *pd, - const Efl_VG *from) +EOLIAN static Efl_VG * +_efl_vg_container_efl_vg_dup(const Eo *obj, Efl_VG_Container_Data *pd) { - Efl_VG_Container_Data *fromd; Eina_List *l; - Eo *child; - - efl_vg_dup(efl_super(obj, EFL_VG_CONTAINER_CLASS), from); + Efl_VG *child; + Efl_VG *cn = NULL; - fromd = efl_data_scope_get(from, EFL_VG_CONTAINER_CLASS); - - EINA_LIST_FREE(pd->children, child) - efl_unref(child); - - EINA_LIST_FOREACH(fromd->children, l, child) + cn = efl_vg_dup(efl_super(obj, MY_CLASS)); + EINA_LIST_FOREACH(pd->children, l, child) { -// By setting parent, we automatically reference -// this new object as a child of obj. Magic at work ! -(void) efl_add(efl_class_get(child), obj, efl_vg_dup(efl_added, child)); +// parent_set adds the new node to the list of children of cn +efl_parent_set(efl_vg_dup(child), cn); } + return cn; } EAPI Efl_VG* diff --git a/src/lib/evas/canvas/evas_vg_gradient.c b/src/lib/evas/canvas/evas_vg_gradient.c index 12f8b3d504..db59b1b0fc 100644 --- a/src/lib/evas/canvas/evas_vg_gradient.c +++ b/src/lib/evas/canvas/evas_vg_gradient.c @@ -5,6 +5,8 @@ #include +#define MY_CLASS EFL_VG_GRADIENT_CLASS + static void _efl_vg_gradient_efl_gfx_gradient_stop_set(Eo *obj EINA_UNUSED, Efl_VG_Gradient_Data *pd, @@ -94,19 +96,16 @@ _efl_vg_gradient_efl_vg_interpolate(Eo *obj, return EINA_TRUE; } -static void -_efl_vg_gradient_efl_vg_dup(Eo *obj, - Efl_VG_Gradient_Data *pd EINA_UNUSED, - const Efl_VG *from) -{ - Efl_VG_Gradient_Data *fromd; - - efl_vg_dup(efl_super(obj, EFL_VG_GRADIENT_CLASS), from); +EOLIAN static Efl_VG * +_efl_vg_gradient_efl_vg_dup(const Eo *obj, Efl_VG_Gradient_Data *pd) - fromd = efl_data_scope_get(from, EFL_VG_GRADIENT_CLASS); +{ + Efl_VG *cn = NULL; - efl_gfx_gradient_stop_set(obj, fromd->colors, fromd->colors_count); - efl_gfx_gradient_spread_set(obj, fromd->s); + cn = efl_vg_dup(efl_super(obj, MY_CLASS)); + efl_gfx_gradient_stop_set(cn, pd->colors, pd->colors_count); + efl_gfx_gradient_spread_set(cn, pd->s); + return
[EGIT] [core/efl] master 01/01: Remove evas internal dependency from the evas_font module
raster pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=b038d7df25f9cecaa4f0d8c1c7355e4852e5348a commit b038d7df25f9cecaa4f0d8c1c7355e4852e5348a Author: subhransu mohanty <sub.moha...@samsung.com> Date: Tue Nov 7 11:22:09 2017 +0900 Remove evas internal dependency from the evas_font module Summary: dev branch : devs/subhransu/font The Final goal is to move the evas_font module to ector so that both ector and evas can reuse the code. make the api simple so that sam eapi can be used by evas_textblock and ector text. This is the 1st stage to achive that gola, first remove the evas internal dependancy as much as possible before moving to ector library. Reviewers: jpeg, raster, herdsman, cedric, id213sin Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D5419 --- src/Makefile_Evas.am |5 +- src/lib/evas/canvas/evas_font_dir.c| 1105 +++- src/lib/evas/canvas/evas_main.c| 135 ++- src/lib/evas/canvas/evas_object_text.c | 14 +- src/lib/evas/canvas/evas_object_textblock.c| 43 +- src/lib/evas/canvas/evas_object_textgrid.c | 54 +- src/lib/evas/canvas/evas_render.c |4 +- src/lib/evas/canvas/render2/evas_render2_old.c |2 +- src/lib/evas/common/evas_font.h| 354 +++- src/lib/evas/common/evas_font_compress.c | 173 +--- src/lib/evas/common/evas_font_draw.c | 154 +++- src/lib/evas/common/evas_font_draw.h | 18 + src/lib/evas/common/evas_font_load.c | 50 +- src/lib/evas/common/evas_font_main.c | 28 +- src/lib/evas/common/evas_font_ot.c |4 +- src/lib/evas/common/evas_font_ot.h | 11 +- src/lib/evas/common/evas_font_private.h| 44 +- src/lib/evas/common/evas_font_query.c |3 - src/lib/evas/common/evas_text_utils.c |8 +- src/lib/evas/common/evas_text_utils.h |5 +- src/lib/evas/include/evas_common_private.h | 181 +--- src/lib/evas/include/evas_private.h| 129 +-- 22 files changed, 1316 insertions(+), 1208 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 8b82e1aaed..d80e1c2015 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -493,7 +493,8 @@ lib/evas/common/language/evas_bidi_utils.h \ lib/evas/common/language/evas_language_utils.h \ lib/evas/common/language/evas_script_table.h \ lib/evas/common/evas_text_utils.h \ -lib/evas/common/evas_font_ot.h +lib/evas/common/evas_font_ot.h \ +lib/evas/common/evas_font_draw.h lib_evas_libevas_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/canvas \ @@ -1608,7 +1609,7 @@ if BUILD_VG_LOADER_SVG if EVAS_STATIC_BUILD_VG_SVG lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/svg/evas_vg_load_svg.c \ static_libs/vg_common/vg_common.c \ -static_libs/vg_common/vg_common.h +static_libs/vg_common/vg_common.h lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/static_libs/vg_common \ @evas_vg_loader_svg_cflags@ lib_evas_libevas_la_LIBADD += @evas_vg_loader_svg_libs@ diff --git a/src/lib/evas/canvas/evas_font_dir.c b/src/lib/evas/canvas/evas_font_dir.c index e120f682d6..cbdef108ff 100644 --- a/src/lib/evas/canvas/evas_font_dir.c +++ b/src/lib/evas/canvas/evas_font_dir.c @@ -13,8 +13,14 @@ #include #endif -#include "evas_common_private.h" -#include "evas_private.h" +#include "evas_font.h" + +/* General types - used for script type chceking */ +#define OPAQUE_TYPE(type) struct __##type { int a; }; \ + typedef struct __##type type + +OPAQUE_TYPE(Evas_Font_Set); /* General type for RGBA_Font */ +OPAQUE_TYPE(Evas_Font_Instance); /* General type for RGBA_Font_Int */ /* font dir cache */ static Eina_Hash *font_dirs = NULL; @@ -57,6 +63,70 @@ static int evas_object_text_font_string_parse(char *buffer, char dest[14][256]); static FcConfig *fc_config = NULL; #endif +/* FIXME move these helper function to eina_file or eina_path */ +/* get the casefold feature! */ +#include +#ifndef _MSC_VER +# include +# include +#endif +int +_file_path_is_full_path(const char *path) +{ + if (!path) return 0; +#ifdef _WIN32 + if (evil_path_is_absolute(path)) return 1; +#else + if (path[0] == '/') return 1; +#endif + return 0; +} + +static DATA64 +_file_modified_time(const char *file) +{ + struct stat st; + + if (stat(file, ) < 0) return 0; + if (st.st_ctime > st.st_mtime) return (DATA64)st.st_ctime; + else return (DATA64)st.st_mtime; + return 0; +} + +Eina_List * +_file_path_list(char *path, const char *match, int match_case) +{ + Eina_File_Direct_Info *info; + Eina_Iterator *it; + Eina_List *files = NULL; + int flags; + + flags = FNM_PATHNAME; +#ifdef FNM_CASEFOLD + if (!match_case) + flags |= F
[EGIT] [core/efl] master 08/10: edje: cleanup old implementation of handling svg file.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4c47200c49ef4e178c4785e8b0b73db93c1ddbe7 commit 4c47200c49ef4e178c4785e8b0b73db93c1ddbe7 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Fri Oct 27 09:24:25 2017 +0900 edje: cleanup old implementation of handling svg file. --- src/Makefile_Edje.am |3 +- src/bin/edje/edje_cc.h |3 - src/bin/edje/edje_svg_loader.c | 2048 src/lib/edje/edje_data.c | 424 - src/lib/edje/edje_edit.c |3 - src/lib/edje/edje_load.c | 411 src/lib/edje/edje_private.h| 293 +- 7 files changed, 3 insertions(+), 3182 deletions(-) diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am index e1afdc7444..6b708a3c56 100644 --- a/src/Makefile_Edje.am +++ b/src/Makefile_Edje.am @@ -176,8 +176,7 @@ bin/edje/edje_cc_parse.c \ bin/edje/edje_cc_mem.c \ bin/edje/edje_cc_handlers.c \ bin/edje/edje_cc_sources.c \ -bin/edje/edje_multisense_convert.c \ -bin/edje/edje_svg_loader.c +bin/edje/edje_multisense_convert.c bin_edje_edje_cc_CPPFLAGS = -I$(top_builddir)/src/lib/efl $(EDJE_COMMON_CPPFLAGS) @EDJE_LUA_CFLAGS@ bin_edje_edje_cc_LDADD = $(USE_EDJE_BIN_LIBS) @EDJE_LUA_LIBS@ bin_edje_edje_cc_DEPENDENCIES = \ diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h index e887bf4c3e..9e3c9a88d3 100644 --- a/src/bin/edje/edje_cc.h +++ b/src/bin/edje/edje_cc.h @@ -297,9 +297,6 @@ int get_param_index(char *str); void color_tree_root_free(void); void convert_color_code(char *str, int *r, int *g, int *b, int *a); -Svg_Node* _svg_load(Eina_File *f, const char *key EINA_UNUSED); - - /* global vars */ extern Eina_List *ext_dirs; extern Eina_List *img_dirs; diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c deleted file mode 100644 index 03088ca638..00 --- a/src/bin/edje/edje_svg_loader.c +++ /dev/null @@ -1,2048 +0,0 @@ -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include -#include -#include -#include - -#ifndef A_VAL -#ifndef WORDS_BIGENDIAN -/* x86 */ -#define A_VAL(p) (((uint8_t *)(p))[3]) -#define R_VAL(p) (((uint8_t *)(p))[2]) -#define G_VAL(p) (((uint8_t *)(p))[1]) -#define B_VAL(p) (((uint8_t *)(p))[0]) -#define AR_VAL(p) ((uint16_t *)(p)[1]) -#define GB_VAL(p) ((uint16_t *)(p)[0]) -#else -/* ppc */ -#define A_VAL(p) (((uint8_t *)(p))[0]) -#define R_VAL(p) (((uint8_t *)(p))[1]) -#define G_VAL(p) (((uint8_t *)(p))[2]) -#define B_VAL(p) (((uint8_t *)(p))[3]) -#define AR_VAL(p) ((uint16_t *)(p)[0]) -#define GB_VAL(p) ((uint16_t *)(p)[1]) -#endif -#endif - -#define ARGB_JOIN(a,r,g,b) \ -(((a) << 24) + ((r) << 16) + ((g) << 8) + (b)) - - -typedef Svg_Node *(*Factory_Method)(Svg_Node *parent, const char *buf, unsigned buflen); - -typedef Svg_Style_Gradient *(*Gradient_Factory_Method)(const char *buf, unsigned buflen); - -typedef struct _Evas_SVG_Loader Evas_SVG_Loader; -struct _Evas_SVG_Loader -{ - Eina_Array *stack; - Svg_Node *doc; - Svg_Node *def; - Svg_Style_Gradient *gradient; - int level; - Eina_Bool result:1; -}; - -char * -_skip_space(const char *str, const char *end) -{ - while (((end != NULL && str < end) || (end == NULL && *str != '\0')) && isspace(*str)) - ++str; - return (char *)str; -} - -static inline Eina_Stringshare * -_copy_id(const char* str) -{ - if (str == NULL) return NULL; - - return eina_stringshare_add(str); -} - -static const char * -_skipcomma(const char *content) -{ - content = _skip_space(content, NULL); - if (*content == ',') return content + 1; - return content; -} - -static inline Eina_Bool -_parse_number(const char **content, double *number) -{ - char *end = NULL; - - *number = strtod(*content, ); - // if the start of string is not number - if ((*content) == end) return EINA_FALSE; - //skip comma if any - *content = _skipcomma(end); - return EINA_TRUE; -} - -static inline double -_to_double(const char *str) -{ - char *end = NULL; - - return strtod(str, ); -} - -static inline int -_to_opacity(const char *str) -{ - char *end = NULL; - int a = 0; - double opacity = strtod(str, ); - - if (*end == '\0') - a = lrint(opacity * 255); - return a; -} - -#define _PARSE_TAG(Type, Short_Name, Tags_Array, Default) \ - static Type _to_##Short_Name(const char *str) \ - { \ - unsigned int i;\ -\ - for (i = 0; i < sizeof (Tags_Array) / sizeof (Tags_Array[0]); i++) \ - if (!strcmp(str, Tags_Array[i].tag)) \ - return Tags_Array[i].
[EGIT] [core/efl] master 02/10: vg_loaders/eet: Added implementaion for loading from eet file
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=079838e926331217c12d11ada957bd6d5c677c07 commit 079838e926331217c12d11ada957bd6d5c677c07 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 2 19:23:49 2016 +0900 vg_loaders/eet: Added implementaion for loading from eet file --- src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c | 50 +- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c b/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c index 485157add2..27263cfeb1 100644 --- a/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c +++ b/src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c @@ -1,9 +1,4 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "evas_common_private.h" -#include "evas_private.h" +#include "vg_common.h" static int _evas_vg_loader_eet_log_dom = -1; @@ -17,11 +12,34 @@ static int _evas_vg_loader_eet_log_dom = -1; #endif #define INF(...) EINA_LOG_DOM_INFO(_evas_vg_loader_eet_log_dom, __VA_ARGS__) -static void* -evas_vg_load_file_data_eet(Eina_File *f EINA_UNUSED, Eina_Stringshare *key EINA_UNUSED, int *error EINA_UNUSED) +static Vg_File_Data* +evas_vg_load_file_data_eet(const char *file, const char *key, int *error EINA_UNUSED) { - INF("No Implementation Yet"); - return NULL; + Eet_Data_Descriptor *svg_node_eet; + Svg_Node *node; + Eet_File *ef; + + ef = eet_open(file, EET_FILE_MODE_READ); + if (!ef) + { +*error = EVAS_LOAD_ERROR_CORRUPT_FILE; +return NULL; + } + + svg_node_eet = vg_common_svg_node_eet(); + node = eet_data_read(ef, svg_node_eet, key); + eet_close(ef); + + if (!node) + { +*error = EVAS_LOAD_ERROR_GENERIC; + } + else + { +*error = EVAS_LOAD_ERROR_NONE; + } + + return vg_common_create_vg_node(node); } static Evas_Vg_Load_Func evas_vg_load_eet_func = @@ -34,12 +52,24 @@ module_open(Evas_Module *em) { if (!em) return 0; em->functions = (void *)(_vg_load_eet_func); + _evas_vg_loader_eet_log_dom = eina_log_domain_register + ("vg-load-eet", EVAS_DEFAULT_LOG_COLOR); + if (_evas_vg_loader_eet_log_dom < 0) + { +EINA_LOG_ERR("Can not create a module log domain."); +return 0; + } return 1; } static void module_close(Evas_Module *em EINA_UNUSED) { + if (_evas_vg_loader_eet_log_dom >= 0) + { +eina_log_domain_unregister(_evas_vg_loader_eet_log_dom); +_evas_vg_loader_eet_log_dom = -1; + } } static Evas_Module_Api evas_modapi = --
[EGIT] [core/efl] master 03/10: vg_loaders/svg: Copied svg loading implementation from edje_cc
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=24ac2d65160058193ec881f37a9ba8a4271d0605 commit 24ac2d65160058193ec881f37a9ba8a4271d0605 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 2 19:25:45 2016 +0900 vg_loaders/svg: Copied svg loading implementation from edje_cc --- src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c | 2113 +++- 1 file changed, 2105 insertions(+), 8 deletions(-) diff --git a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c index 4fe90de1a7..7c19d75a47 100644 --- a/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c +++ b/src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c @@ -1,9 +1,5 @@ -#ifdef HAVE_CONFIG_H -# include -#endif -#include "evas_common_private.h" -#include "evas_private.h" +#include "vg_common.h" static int _evas_vg_loader_svg_log_dom = -1; @@ -17,13 +13,2102 @@ static int _evas_vg_loader_svg_log_dom = -1; #endif #define INF(...) EINA_LOG_DOM_INFO(_evas_vg_loader_svg_log_dom, __VA_ARGS__) -static void* -evas_vg_load_file_data_svg(Eina_File *f EINA_UNUSED, Eina_Stringshare *key EINA_UNUSED, int *error EINA_UNUSED) +typedef Svg_Node *(*Factory_Method)(Svg_Node *parent, const char *buf, unsigned buflen); + +typedef Svg_Style_Gradient *(*Gradient_Factory_Method)(const char *buf, unsigned buflen); + +typedef struct _Evas_SVG_Loader Evas_SVG_Loader; +struct _Evas_SVG_Loader +{ + Eina_Array *stack; + Svg_Node *doc; + Svg_Node *def; + Svg_Style_Gradient *gradient; + int level; + Eina_Bool result:1; +}; + +char * +_skip_space(const char *str, const char *end) +{ + while (((end != NULL && str < end) || (end == NULL && *str != '\0')) && isspace(*str)) + ++str; + return (char *)str; +} + +static inline Eina_Stringshare * +_copy_id(const char* str) +{ + if (str == NULL) return NULL; + + return eina_stringshare_add(str); +} + +static const char * +_skipcomma(const char *content) +{ + content = _skip_space(content, NULL); + if (*content == ',') return content + 1; + return content; +} + +static inline Eina_Bool +_parse_number(const char **content, double *number) +{ + char *end = NULL; + + *number = strtod(*content, ); + // if the start of string is not number + if ((*content) == end) return EINA_FALSE; + //skip comma if any + *content = _skipcomma(end); + return EINA_TRUE; +} + +static inline double +_to_double(const char *str) +{ + return strtod(str, NULL); +} + +static inline int +_to_opacity(const char *str) +{ + char *end = NULL; + int a = 0; + double opacity = strtod(str, ); + + if (*end == '\0') + a = lrint(opacity * 255); + return a; +} + +#define _PARSE_TAG(Type, Short_Name, Tags_Array, Default) \ + static Type _to_##Short_Name(const char *str) \ + { \ + unsigned int i;\ +\ + for (i = 0; i < sizeof (Tags_Array) / sizeof (Tags_Array[0]); i++) \ + if (!strcmp(str, Tags_Array[i].tag)) \ + return Tags_Array[i].Short_Name; \ + return Default;\ + } +/* parse the line cap used during stroking a path. + * Value:butt | round | square | inherit + * Initial:butt + * https://www.w3.org/TR/SVG/painting.html + */ +static struct { + Efl_Gfx_Cap line_cap; + const char *tag; +} line_cap_tags[] = { + { EFL_GFX_CAP_BUTT, "butt" }, + { EFL_GFX_CAP_ROUND, "round" }, + { EFL_GFX_CAP_SQUARE, "square" } +}; + +_PARSE_TAG(Efl_Gfx_Cap, line_cap, line_cap_tags, EFL_GFX_CAP_LAST); + +/* parse the line join used during stroking a path. + * Value: miter | round | bevel | inherit + * Initial:miter + * https://www.w3.org/TR/SVG/painting.html + */ +static struct { + Efl_Gfx_Join line_join; + const char *tag; +} line_join_tags[] = { + { EFL_GFX_JOIN_MITER, "miter" }, + { EFL_GFX_JOIN_ROUND, "round" }, + { EFL_GFX_JOIN_BEVEL, "bevel" } +}; + +_PARSE_TAG(Efl_Gfx_Join, line_join, line_join_tags, EFL_GFX_JOIN_LAST); + +/* parse the fill rule used during filling a path. + * Value: nonzero | evenodd | inherit + * Initial:nonzero + * https://www.w3.org/TR/SVG/painting.html + */ + +static struct { + Efl_Gfx_Fill_Rule fill_rule; + const char *tag; +} fill_rule_tags[] = { + { EFL_GFX_FILL_RULE_ODD_EVEN, "evenodd" } +}; + +_PARSE_TAG(Efl_Gfx_Fill_Rule, fill_rule, fill_rule_tags, EFL_GFX_FILL_RULE_WINDING); + +#if 0 +// unused at the moment +/* parse the dash pattern used during stroking a path. + * Value: none | | inherit + * Initial:none + * https://www.w3.o
[EGIT] [core/efl] master 06/10: evas/vg: Added file handling support in vg canvas.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ad4e133e08cc9e9ab327efed58b5ca36b17156b5 commit ad4e133e08cc9e9ab327efed58b5ca36b17156b5 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Fri Oct 27 09:15:28 2017 +0900 evas/vg: Added file handling support in vg canvas. --- src/lib/evas/canvas/efl_canvas_vg.c | 83 +++- src/lib/evas/canvas/efl_canvas_vg.eo | 4 +- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg.c b/src/lib/evas/canvas/efl_canvas_vg.c index e54875642d..15d0eb21b9 100644 --- a/src/lib/evas/canvas/efl_canvas_vg.c +++ b/src/lib/evas/canvas/efl_canvas_vg.c @@ -1,3 +1,5 @@ +#define EVAS_VG_BETA + #include "evas_common_private.h" #include "evas_private.h" @@ -133,6 +135,10 @@ evas_object_vg_add(Evas *e) EOLIAN static Efl_VG * _efl_canvas_vg_root_node_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd) { + if (pd->vg_entry) + { +return evas_cache_vg_tree_get(pd->vg_entry); + } return pd->vg_tree; } @@ -143,6 +149,13 @@ _efl_canvas_vg_root_node_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_VG if (pd->vg_tree == root_node) return; + // check if a file has been already set + if (pd->vg_entry) + { +evas_cache_vg_entry_del(pd->vg_entry); +pd->vg_entry = NULL; + } + // detach/free the old root_node if (pd->vg_tree) efl_parent_set(pd->vg_tree, NULL); @@ -226,6 +239,62 @@ _efl_canvas_vg_viewbox_align_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, do if (align_y) *align_y = pd->align_y; } +// file set and save api implementation + +EOLIAN static Eina_Bool +_efl_canvas_vg_efl_file_file_set(Eo *obj, Efl_Canvas_Vg_Data *pd, const char *file, const char *key) +{ + int w, h; + Evas_Cache_Vg_Entry *entry; + + if (!file) return EINA_FALSE; + + evas_object_geometry_get(obj, NULL, NULL, , ); + entry = evas_cache_vg_entry_find(file, key, w, h); + if (entry != pd->vg_entry) + { +if (pd->vg_entry) + { + evas_cache_vg_entry_del(pd->vg_entry); + } +pd->vg_entry = entry; + } + evas_object_change(obj, efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS)); + return EINA_TRUE; +} + +EOLIAN static void +_efl_canvas_vg_efl_file_file_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, const char **file, const char **key) +{ + if (pd->vg_entry) + { +if (file) *file = pd->vg_entry->file; +if (key) *key = pd->vg_entry->key; + } +} + +EOLIAN static Eina_Bool +_efl_canvas_vg_efl_file_save(const Eo *obj, Efl_Canvas_Vg_Data *pd, const char *file, const char *key, const char *flags) +{ + Vg_File_Data tmp; + Vg_File_Data *info = + + if (pd->vg_entry && pd->vg_entry->file) + { +info = evas_cache_vg_file_info(pd->vg_entry->file, pd->vg_entry->key); + } + else + { +info->view_box.x = 0; +info->view_box.y = 0; +evas_object_geometry_get(obj, NULL, NULL, >view_box.w, >view_box.h); +info->root = pd->root; +info->preserve_aspect = EINA_FALSE; + } + evas_vg_save_to_file(info, file, key, flags); + return EINA_TRUE; +} + static void _cleanup_reference(void *data, const Efl_Event *event EINA_UNUSED) { @@ -327,6 +396,7 @@ _efl_canvas_vg_render(Evas_Object *eo_obj EINA_UNUSED, int x, int y, Eina_Bool do_async) { Efl_Canvas_Vg_Data *vd = type_private_data; + Efl_VG *root = NULL; Ector_Surface *ector = evas_ector_get(obj->layer->evas); obj->layer->evas->engine.func->ector_output_set(engine, surface, output); @@ -351,6 +421,17 @@ _efl_canvas_vg_render(Evas_Object *eo_obj EINA_UNUSED, obj->cur->anti_alias); obj->layer->evas->engine.func->context_render_op_set(engine, context, obj->cur->render_op); + if (vd->vg_entry) + { +root = evas_cache_vg_tree_get(vd->vg_entry); +if (!root) return; +_evas_vg_render_pre(root, ector, NULL); + } + else + { +root = vd->root; + } + //obj->layer->evas->engine.func->ector_begin(output, context, obj->layer->evas->engine.func->ector_begin(engine, context, ector, surface, vd->engine_data, @@ -358,7 +439,7 @@ _efl_canvas_vg_render(Evas_Object *eo_obj EINA_UNUSED, do_async); _evas_vg_render(obj, vd, engine, output, context, surface, - vd->root, NULL, + root, NULL, d
[EGIT] [core/efl] master 01/10: static_lib: added vg_common static lib
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=48c1c4850a486b1d416665d7e7536842d4d68979 commit 48c1c4850a486b1d416665d7e7536842d4d68979 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 2 19:22:55 2016 +0900 static_lib: added vg_common static lib Features: Copied vg eet descriptor from edje_data Copied convert func from Svg_Node to Efl_VG from edje added convert function from Efl_VG to Svg_Node --- src/Makefile_Evas.am | 12 +- src/lib/evas/include/evas_private.h | 13 +- src/static_libs/vg_common/vg_common.c | 965 ++ src/static_libs/vg_common/vg_common.h | 299 +++ 4 files changed, 1284 insertions(+), 5 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 8789e95071..bc2c0abb1b 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1601,8 +1601,11 @@ endif if BUILD_VG_LOADER_SVG if EVAS_STATIC_BUILD_VG_SVG -lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/svg/evas_vg_load_svg.c -lib_evas_libevas_la_CPPFLAGS += @evas_vg_loader_svg_cflags@ +lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/svg/evas_vg_load_svg.c \ +static_libs/vg_common/vg_common.c \ +static_libs/vg_common/vg_common.h +lib_evas_libevas_la_CPPFLAGS += -I$(top_srcdir)/src/static_libs/vg_common \ +@evas_vg_loader_svg_cflags@ lib_evas_libevas_la_LIBADD += @evas_vg_loader_svg_libs@ else vgloadersvgpkgdir = $(libdir)/evas/modules/vg_loaders/svg/$(MODULE_ARCH) @@ -1613,9 +1616,12 @@ vgloadersvgpkg_LTLIBRARIES = modules/evas/vg_loaders/svg/module.la install_vgloadersvgpkgLTLIBRARIES = install-vgloadersvgpkgLTLIBRARIES $(install_vgloadersvgpkgLTLIBRARIES): install-libLTLIBRARIES -modules_evas_vg_loaders_svg_module_la_SOURCES = modules/evas/vg_loaders/svg/evas_vg_load_svg.c +modules_evas_vg_loaders_svg_module_la_SOURCES = modules/evas/vg_loaders/svg/evas_vg_load_svg.c \ +static_libs/vg_common/vg_common.c \ +static_libs/vg_common/vg_common.h modules_evas_vg_loaders_svg_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_srcdir)/src/lib/evas/include \ +-I$(top_srcdir)/src/static_libs/vg_common \ @EVAS_CFLAGS@ \ @evas_vg_loader_svg_cflags@ modules_evas_vg_loaders_svg_module_la_LIBADD = \ diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 8a16d63e68..2cedf01807 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -142,6 +142,8 @@ typedef struct _Evas_Canvas3D_Mesh_Eet Evas_Canvas3D_Mesh_Eet; typedef struct _Evas_Canvas3D_Header_Eet Evas_Canvas3D_Header_Eet; typedef struct _Evas_Canvas3D_File_Eet Evas_Canvas3D_File_Eet; +typedef struct _Vg_File_Data Vg_File_Data; + struct _Evas_Canvas3D_Vec2_Eet { float x; @@ -1629,14 +1631,21 @@ struct _Evas_Image_Save_Func int (*image_save) (RGBA_Image *im, const char *file, const char *key, int quality, int compress, const char *encoding); }; +struct _Vg_File_Data +{ + Eina_Rectangle view_box; + Efl_VG *root; + Eina_Bool preserve_aspect; +}; + struct _Evas_Vg_Load_Func { - void *(*file_data) (Eina_File *f, Eina_Stringshare *key, int *error); + Vg_File_Data *(*file_data) (const char *file, const char *key, int *error); }; struct _Evas_Vg_Save_Func { - int (*vg_save) (void *vg, const char *file, const char *key, int compress); + int (*vg_save) (Vg_File_Data *vg, const char *file, const char *key, int compress); }; #ifdef __cplusplus diff --git a/src/static_libs/vg_common/vg_common.c b/src/static_libs/vg_common/vg_common.c new file mode 100644 index 00..673ab0a503 --- /dev/null +++ b/src/static_libs/vg_common/vg_common.c @@ -0,0 +1,965 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "vg_common.h" + +#include +#include + + + +Eet_Data_Descriptor *_eet_rect_node = NULL; +Eet_Data_Descriptor *_eet_circle_node = NULL; +Eet_Data_Descriptor *_eet_ellipse_node = NULL; +Eet_Data_Descriptor *_eet_gradient_stops_node = NULL; +Eet_Data_Descriptor *_eet_linear_gradient_node = NULL; +Eet_Data_Descriptor *_eet_radial_gradient_node = NULL; +Eet_Data_Descriptor *_eet_style_gradient_node = NULL; +Eet_Data_Descriptor *_eet_style_property_node = NULL; +Eet_Data_Descriptor *_eet_matrix3_node = NULL; +Eet_Data_Descriptor *_eet_doc_node = NULL; +Eet_Data_Descriptor *_eet_defs_node = NULL; +Eet_Data_Descriptor *_eet_g_node = NULL; +Eet_Data_Descriptor *_eet_arc_node = NULL; +Eet_Data_Descriptor *_eet_path_node = NULL; +Eet_Data_Descriptor *_eet_polygon_node = NULL; +Eet_Data_Descriptor *_eet_vg_node = NULL; +Eet_Data_Descriptor *_eet_line_node = NULL; +Eet_Data_Descriptor *_eet_custom_command_node = NULL; + +#define FREE_DESCRIPTOR(eed) \ + if (eed) \ +{ \ + eet_data_descriptor_free((eed)); \ +
[EGIT] [core/efl] master 09/10: evas/vg: fixed handling of stroke width in cairo and native backend
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8329c98d5f5c3b3b8c974f39a461ef22f069c174 commit 8329c98d5f5c3b3b8c974f39a461ef22f069c174 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Nov 8 12:51:11 2016 +0900 evas/vg: fixed handling of stroke width in cairo and native backend --- src/static_libs/vg_common/vg_common.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/static_libs/vg_common/vg_common.c b/src/static_libs/vg_common/vg_common.c index 673ab0a503..4204c733f4 100644 --- a/src/static_libs/vg_common/vg_common.c +++ b/src/static_libs/vg_common/vg_common.c @@ -636,10 +636,7 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg) style->fill.paint.b, style->fill.opacity); } - // apply the stroke style property - //@TODO HACK, fix the below api to take the stroke width as pixels - // rightnow it draws double the pixel (inside and outside the outline) - evas_vg_shape_stroke_width_set(vg, style->stroke.width/2.0); + evas_vg_shape_stroke_width_set(vg, style->stroke.width); evas_vg_shape_stroke_cap_set(vg, style->stroke.cap); evas_vg_shape_stroke_join_set(vg, style->stroke.join); evas_vg_shape_stroke_scale_set(vg, style->stroke.scale); @@ -901,8 +898,7 @@ _apply_svg_property(Svg_Node *node, Efl_VG *vg) >stroke.paint.b, >stroke.opacity); } - // keep the stroke width same as svg spec. - style->stroke.width = (evas_vg_shape_stroke_width_get(vg) * 2.0); + style->stroke.width = (evas_vg_shape_stroke_width_get(vg)); style->stroke.cap = evas_vg_shape_stroke_cap_get(vg); style->stroke.join = evas_vg_shape_stroke_join_get(vg); style->stroke.scale = evas_vg_shape_stroke_scale_get(vg); --
[EGIT] [core/efl] master 07/10: edje: use the file_set api from vg canvas to load and parse svg file.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d5c882210744eafb75ebec057eadbedd748777fa commit d5c882210744eafb75ebec057eadbedd748777fa Author: subhransu mohanty <sub.moha...@samsung.com> Date: Fri Oct 27 09:21:48 2017 +0900 edje: use the file_set api from vg canvas to load and parse svg file. --- src/bin/edje/edje_cc_out.c | 46 src/lib/edje/edje_calc.c | 65 ++ 2 files changed, 47 insertions(+), 64 deletions(-) diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index d793cacc8b..7803f781a8 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -168,13 +168,6 @@ struct _Sound_Write int i; }; -struct _Vector_Write -{ - Eet_File *ef; - Svg_Node *root; - int i; -}; - struct _Mo_Write { Eet_File *ef; @@ -1270,19 +1263,25 @@ static void data_write_vectors(Eet_File *ef, int *vector_num) { unsigned int i; - Svg_Node *root; - Eet_Data_Descriptor *svg_node_eet; Eina_List *ll; char *s; Eina_File *f = NULL; Edje_Vector_Directory_Entry *vector; - Eina_Strbuf *buf; + char buf[100]; Eina_Bool found = EINA_FALSE; + Ecore_Evas *ee; + Evas *evas; + Evas_Object *vg; if (!((edje_file) && (edje_file->image_dir))) return; - svg_node_eet = _edje_svg_node_eet(); - buf = eina_strbuf_new(); + ecore_evas_init(); + ee = ecore_evas_buffer_new(1, 1); + if (!ee) + error_and_abort(ef, "Cannot create buffer engine canvas for image load."); + evas = ecore_evas_get(ee); + vg = evas_object_vg_add(evas); + for (i = 0; i < edje_file->image_dir->vectors_count; i++) { if (!beta) @@ -1291,29 +1290,28 @@ data_write_vectors(Eet_File *ef, int *vector_num) vector = _file->image_dir->vectors[i]; EINA_LIST_FOREACH(img_dirs, ll, s) { - eina_strbuf_reset(buf); - eina_strbuf_append_printf(buf, "%s/%s", s, vector->entry); - f = eina_file_open(eina_strbuf_string_get(buf), EINA_FALSE); + sprintf(buf, "%s/%s", s, vector->entry); + + f = eina_file_open(buf, EINA_FALSE); if (!f) continue; - root = _svg_load(f, NULL); - if(!root) + eina_file_close(f); + + if (!efl_file_set(vg, buf, NULL)) error_and_abort(ef, "Failed to parse svg : %s", vector->entry); - eina_strbuf_reset(buf); - eina_strbuf_append_printf(buf, "edje/vectors/%i", vector->id); - if(!eet_data_write(ef, svg_node_eet, eina_strbuf_string_get(buf), root, compress_mode)) + + sprintf(buf, "edje/vectors/%i", vector->id); + + if(!efl_file_save(vg, eet_file_get(ef), buf, NULL)) error_and_abort(ef, "Failed to write data in Eet for svg :%s", vector->entry); + *vector_num += 1; - eina_file_close(f); found = EINA_TRUE; - _edje_svg_node_free(root); break; } if (!found) error_and_abort(ef, "Unable to find the svg :%s", vector->entry); found = EINA_FALSE; } - eina_strbuf_free(buf); - } static void diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index ba5b4742dc..0a9efdcfc9 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -1,5 +1,6 @@ #define EFL_GFX_FILTER_BETA #define EFL_GFX_SIZE_HINT_PROTECTED +#define EVAS_VG_BETA #include "edje_private.h" @@ -3693,63 +3694,47 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj static void _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_UNUSED, Edje_Part_Description_Vector *chosen_desc, FLOAT_T pos) { + int new_svg = -1; //invalid svg int w, h; - int new_svg = -1; - Eina_Matrix3 matrix; - Edje_Vector_Data *start, *end; + char src_key[20], dest_key[20]; + Efl_VG *src_root, *dest_root, *root; evas_object_geometry_get(ep->object, NULL, NULL, , ); - if( (w == 0) || (h == 0)) return; + sprintf(src_key, "edje/vectors/%i", chosen_desc->vg.id); + if (ep->param2) { Edje_Part_Description_Vector *next_state = (Edje_Part_Description_Vector *)ep->param2->description; if (chosen_desc->vg.id != next_state->vg.id) - { - new_svg = next_state->vg.id; - } + new_svg = next_state->vg.id; +else + pos = 0; } - if (new_svg >= 0) // animation with svg id change + + if (new_svg < 0) { -start = _edje_ref_vector_data(ed, chosen_desc->vg.id); -end = _edje_ref_vector_data(ed, new_svg); +efl_file_set(ep->ob
[EGIT] [core/efl] master 04/10: vg_savers/eet: Added implementaion of vg saver to eet file
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=bf79ec359d7f7c6bbb5d6cd5dbb22d233551ae58 commit bf79ec359d7f7c6bbb5d6cd5dbb22d233551ae58 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 2 19:26:15 2016 +0900 vg_savers/eet: Added implementaion of vg saver to eet file --- src/modules/evas/vg_savers/eet/evas_vg_save_eet.c | 34 --- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c b/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c index 700c55bb2c..c0166d33eb 100644 --- a/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c +++ b/src/modules/evas/vg_savers/eet/evas_vg_save_eet.c @@ -1,9 +1,4 @@ -#ifdef HAVE_CONFIG_H -# include -#endif - -#include "evas_common_private.h" -#include "evas_private.h" +#include "vg_common.h" static int _evas_vg_saver_eet_log_dom = -1; @@ -18,10 +13,22 @@ static int _evas_vg_saver_eet_log_dom = -1; #define INF(...) EINA_LOG_DOM_INFO(_evas_vg_saver_eet_log_dom, __VA_ARGS__) int -evas_vg_save_file_eet(void *vg EINA_UNUSED, const char *file EINA_UNUSED, const char *key EINA_UNUSED, int compress EINA_UNUSED) +evas_vg_save_file_eet(Vg_File_Data *evg_data, const char *file, const char *key, int compress) { - INF("No Implementation Yet"); - return 0; + Eet_Data_Descriptor *svg_node_eet; + Svg_Node *root; + Eet_File *ef; + + ef = eet_open(file, EET_FILE_MODE_WRITE); + if (!ef) + return EVAS_LOAD_ERROR_GENERIC; + + svg_node_eet = vg_common_svg_node_eet(); + root = vg_common_create_svg_node(evg_data); + eet_data_write(ef, svg_node_eet, key, root, compress); + eet_close(ef); + + return EVAS_LOAD_ERROR_NONE; } static Evas_Vg_Save_Func evas_vg_save_eet_func = @@ -34,6 +41,13 @@ module_open(Evas_Module *em) { if (!em) return 0; em->functions = (void *)(_vg_save_eet_func); + _evas_vg_saver_eet_log_dom = eina_log_domain_register + ("vg-save-eet", EVAS_DEFAULT_LOG_COLOR); + if (_evas_vg_saver_eet_log_dom < 0) + { +EINA_LOG_ERR("Can not create a module log domain."); +return 0; + } return 1; } @@ -53,7 +67,7 @@ static Evas_Module_Api evas_modapi = } }; -EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_LOADER, vg_saver, eet); +EVAS_MODULE_DEFINE(EVAS_MODULE_TYPE_VG_SAVER, vg_saver, eet); #ifndef EVAS_STATIC_BUILD_VG_EET EVAS_EINA_MODULE_DEFINE(vg_saver, eet); --
[EGIT] [core/efl] master 05/10: evas/vg: Added vg tree caching support
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=64231ae699858b34d65f6e27d665a1411ff1bcf0 commit 64231ae699858b34d65f6e27d665a1411ff1bcf0 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Fri Oct 27 09:11:02 2017 +0900 evas/vg: Added vg tree caching support --- src/Makefile_Evas.am | 5 + src/lib/evas/canvas/evas_main.c | 2 + src/lib/evas/canvas/evas_vg_private.h | 43 - src/lib/evas/vg/evas_vg_cache.c | 328 ++ 4 files changed, 373 insertions(+), 5 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index bc2c0abb1b..5657ed34b1 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -311,6 +311,11 @@ lib/evas/canvas/render2/evas_render2_th_main.c \ lib/evas/canvas/render2/region.c \ lib/evas/canvas/render2/region.h + # Vg + lib_evas_libevas_la_SOURCES += \ + lib/evas/vg/evas_vg_cache.c + + # Cache lib_evas_libevas_la_SOURCES += \ lib/evas/cache/evas_cache_image.c \ diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index bcc2334ace..9efd0ca57d 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -84,6 +84,7 @@ evas_init(void) #endif _evas_preload_thread_init(); evas_filter_init(); + evas_cache_vg_init(); if (!evas_thread_init()) goto shutdown_filter; @@ -146,6 +147,7 @@ evas_shutdown(void) if (evas_cserve2_use_get()) evas_cserve2_shutdown(); #endif + evas_cache_vg_shutdown(); _efl_gfx_map_shutdown(); diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h index d3e151aba1..dda171bdad 100644 --- a/src/lib/evas/canvas/evas_vg_private.h +++ b/src/lib/evas/canvas/evas_vg_private.h @@ -3,18 +3,41 @@ #include -typedef struct _Efl_VG_Data Efl_VG_Data; -typedef struct _Efl_VG_Container_Data Efl_VG_Container_Data; -typedef struct _Efl_VG_Gradient_Data Efl_VG_Gradient_Data; -typedef struct _Efl_VG_Interpolation Efl_VG_Interpolation; +typedef struct _Efl_VG_Data Efl_VG_Data; +typedef struct _Efl_VG_Container_DataEfl_VG_Container_Data; +typedef struct _Efl_VG_Gradient_Data Efl_VG_Gradient_Data; +typedef struct _Efl_VG_Interpolation Efl_VG_Interpolation; -typedef struct _Efl_Canvas_Vg_Data Efl_Canvas_Vg_Data; + +typedef struct _Efl_Canvas_Vg_Data Efl_Canvas_Vg_Data; + +typedef struct _Evas_Cache_Vg_Entry Evas_Cache_Vg_Entry; +typedef struct _Evas_Cache_VgEvas_Cache_Vg; + +struct _Evas_Cache_Vg +{ + Eina_Hash *vg_hash; + Eina_Hash *active; + intref; +}; + +struct _Evas_Cache_Vg_Entry +{ + char *hash_key; + Eina_Stringshare *file; + Eina_Stringshare *key; + int w; + int h; + Efl_VG *root; + int ref; +}; struct _Efl_Canvas_Vg_Data { void *engine_data; Efl_VG *root; Efl_VG *vg_tree; + Evas_Cache_Vg_Entry *vg_entry; Eina_Rect fill; Eina_Rect viewbox; unsigned int width, height; @@ -70,6 +93,16 @@ struct _Efl_VG_Interpolation Eina_Point_3D skew; }; + +voidevas_cache_vg_init(void); +voidevas_cache_vg_shutdown(void); +Evas_Cache_Vg_Entry*evas_cache_vg_entry_find(const char *file, const char *key, int w, int h); +Efl_VG* evas_cache_vg_tree_get(Evas_Cache_Vg_Entry *svg_entry); +voidevas_cache_vg_entry_del(Evas_Cache_Vg_Entry *svg_entry); +Vg_File_Data * evas_cache_vg_file_info(const char *file, const char *key); + +Eina_Bool evas_vg_save_to_file(Vg_File_Data *evg_data, const char *file, const char *key, const char *flags); + static inline Efl_VG_Data * _evas_vg_render_pre(Efl_VG *child, Ector_Surface *s, Eina_Matrix3 *m) { diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c new file mode 100644 index 00..dae36cc290 --- /dev/null +++ b/src/lib/evas/vg/evas_vg_cache.c @@ -0,0 +1,328 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "evas_common_private.h" +#include "evas_private.h" +#include "evas_vg_private.h" + +static Evas_Cache_Vg* vg_cache = NULL; + +struct ext_loader_s +{ + unsigned int length; + const char *extension; + const char *loader; +}; + +#define MATCHING(Ext, Module) { sizeof(Ext)-1, Ext, Module } + +static const struct ext_loader_s loaders[] = +{ /* map extensions to loaders to use for good first-guess tries */ + MATCHING(".eet", "eet"), + MATCHING(".edj", "eet"), + MATCHING(".svg", "svg"), + MATCHING(".svgz", "svg"),
[EGIT] [core/efl] master 01/01: evas/vg: Added align, viewbox and fill_mode property to the vg canvas
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=57ba3318dca35f51a5e2a89367677100bf7b9e49 commit 57ba3318dca35f51a5e2a89367677100bf7b9e49 Author: subhransu mohanty <sub.moha...@samsung.com> Date: Wed Oct 25 20:16:17 2017 +0900 evas/vg: Added align, viewbox and fill_mode property to the vg canvas Summary: viewbox, fill_mode and align property required to scale the vg tree that we get from the svg file or manually created depending on the vg canvas size. Reviewers: jpeg, cedric Subscribers: jenkins, cedric Differential Revision: https://phab.enlightenment.org/D5358 --- src/lib/evas/canvas/efl_canvas_vg.c | 152 ++ src/lib/evas/canvas/efl_canvas_vg.eo | 53 +++- src/lib/evas/canvas/evas_vg_private.h | 21 +++-- 3 files changed, 178 insertions(+), 48 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg.c b/src/lib/evas/canvas/efl_canvas_vg.c index 55ad5d3b8d..e54875642d 100644 --- a/src/lib/evas/canvas/efl_canvas_vg.c +++ b/src/lib/evas/canvas/efl_canvas_vg.c @@ -73,6 +73,52 @@ _evas_vg_tree_changed(void *data, const Efl_Event *event EINA_UNUSED) evas_object_change(obj->object, obj); } +static void +_update_vgtree_viewport(Eo *obj, Efl_Canvas_Vg_Data *pd) +{ + double vb_w, vb_h, vp_w, vp_h, scale_w, scale_h, scale; + Eina_Size2D sz = efl_gfx_size_get(obj); + Eina_Matrix3 m; + + eina_matrix3_identity(); + + vb_w = pd->viewbox.w; + vb_h = pd->viewbox.h; + vp_w = sz.w; + vp_h = sz.h; + + scale_w = vp_w / vb_w; + scale_h = vp_h / vb_h; + + if (pd->fill_mode == EFL_CANVAS_VG_FILL_MODE_STRETCH) + { // Fill the viewport and ignore the aspect ratio +eina_matrix3_scale(, scale_w, scale_h); +eina_matrix3_translate(, -pd->viewbox.x, -pd->viewbox.y); + } + else + { +if (pd->fill_mode == EFL_CANVAS_VG_FILL_MODE_MEET) + scale = scale_w < scale_h ? scale_w : scale_h; +else // slice + scale = scale_w > scale_h ? scale_w : scale_h; +eina_matrix3_translate(, (vp_w - vb_w * scale) * pd->align_x, (vp_h - vb_h * scale) * pd->align_y); +eina_matrix3_scale(, scale, scale); +eina_matrix3_translate(, -pd->viewbox.x, -pd->viewbox.y); + } + + efl_vg_transformation_set(pd->root, ); +} + +static void +_evas_vg_resize(void *data, const Efl_Event *ev) +{ + Efl_Canvas_Vg_Data *pd = data; + + if (eina_rectangle_is_empty(>viewbox.rect)) + return; + _update_vgtree_viewport(ev->object, pd); +} + /* the actual api call to add a vector graphic object */ EAPI Evas_Object * evas_object_vg_add(Evas *e) @@ -84,13 +130,13 @@ evas_object_vg_add(Evas *e) return efl_add(MY_CLASS, e, efl_canvas_object_legacy_ctor(efl_added)); } -Efl_VG * +EOLIAN static Efl_VG * _efl_canvas_vg_root_node_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd) { return pd->vg_tree; } -void +EOLIAN static void _efl_canvas_vg_root_node_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_VG *root_node) { // if the same root is already set @@ -102,19 +148,84 @@ _efl_canvas_vg_root_node_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_VG efl_parent_set(pd->vg_tree, NULL); pd->vg_tree = root_node; - + if (pd->vg_tree) { // set the parent so that vg canvas can render it. efl_parent_set(pd->vg_tree, pd->root); } - + // force a redraw pd->changed = EINA_TRUE; - + evas_object_change(obj, efl_data_scope_get(obj, EFL_CANVAS_OBJECT_CLASS)); } +EOLIAN static void +_efl_canvas_vg_fill_mode_set(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd, Efl_Canvas_Vg_Fill_Mode fill_mode) +{ + pd->fill_mode = fill_mode; +} + +EOLIAN static Efl_Canvas_Vg_Fill_Mode +_efl_canvas_vg_fill_mode_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg_Data *pd) +{ + return pd->fill_mode; +} + +EOLIAN static void +_efl_canvas_vg_viewbox_set(Eo *obj, Efl_Canvas_Vg_Data *pd, Eina_Rect viewbox) +{ + // viewbox should be a valid rectangle + if (eina_rectangle_is_empty()) + { +// reset the old viewbox if any +if (!eina_rectangle_is_empty(>viewbox.rect)) + { + Eina_Matrix3 m; + + pd->viewbox = EINA_RECT_EMPTY(); + eina_matrix3_identity(); + efl_vg_transformation_set(pd->root, ); + // un register the resize callback + efl_event_callback_del(obj, EFL_GFX_EVENT_RESIZE, _evas_vg_resize, pd); + } +return; + } + // register for resize callback if not done yet + if (eina_rectangle_is_empty(>viewbox.rect)) + efl_event_callback_add(obj, EFL_GFX_EVENT_RESIZE, _evas_vg_resize, pd); + + pd->viewbox = viewbox; + _update_vgtree_viewport(obj, pd); +} + +EOLIAN static Eina_Rect +_efl_canvas_vg_viewbox_get(Eo *obj EINA_UNUSED, Efl_Canvas_Vg
[EGIT] [core/efl] master 04/04: evas/vg: renamed the evas_vg class to efl_canvas_vg
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=880dd63a0c884642a0f87aa3a08338a7b244e37a commit 880dd63a0c884642a0f87aa3a08338a7b244e37a Author: subhransu mohanty <sub.moha...@samsung.com> Date: Tue Oct 24 15:19:52 2017 +0900 evas/vg: renamed the evas_vg class to efl_canvas_vg Reviewers: jpeg Subscribers: jenkins, cedric Differential Revision: https://phab.enlightenment.org/D5357 --- src/Makefile_Evas.am | 4 +- src/lib/evas/Evas_Eo.h | 2 +- .../canvas/{evas_object_vg.c => efl_canvas_vg.c} | 86 +++--- .../evas/canvas/{evas_vg.eo => efl_canvas_vg.eo} | 2 +- src/lib/evas/canvas/evas_main.c| 4 +- src/lib/evas/canvas/evas_vg_node.c | 2 +- src/lib/evas/canvas/evas_vg_private.h | 4 +- 7 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 6e2e155af1..8789e95071 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -19,7 +19,7 @@ evas_canvas_eolian_pub_files = \ lib/evas/canvas/evas_canvas3d_node.eo\ lib/evas/canvas/evas_canvas3d_scene.eo\ lib/evas/canvas/evas_canvas3d_object.eo \ - lib/evas/canvas/evas_vg.eo \ + lib/evas/canvas/efl_canvas_vg.eo \ lib/evas/canvas/efl_vg.eo \ lib/evas/canvas/efl_vg_container.eo \ lib/evas/canvas/efl_vg_shape.eo \ @@ -390,7 +390,7 @@ lib/evas/common3d/primitives/primitive_common.c # Evas_VG lib_evas_libevas_la_SOURCES += \ -lib/evas/canvas/evas_object_vg.c \ +lib/evas/canvas/efl_canvas_vg.c \ lib/evas/canvas/evas_vg_node.c \ lib/evas/canvas/evas_vg_container.c \ lib/evas/canvas/evas_vg_gradient.c \ diff --git a/src/lib/evas/Evas_Eo.h b/src/lib/evas/Evas_Eo.h index 030a18fc63..dbd65e1555 100644 --- a/src/lib/evas/Evas_Eo.h +++ b/src/lib/evas/Evas_Eo.h @@ -305,7 +305,7 @@ typedef void (Evas_Canvas3D_Surface_Func)(Evas_Real *out_x, * * @{ */ -#include "canvas/evas_vg.eo.h" +#include "canvas/efl_canvas_vg.eo.h" /** * @} */ diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/efl_canvas_vg.c similarity index 84% rename from src/lib/evas/canvas/evas_object_vg.c rename to src/lib/evas/canvas/efl_canvas_vg.c index 386dcb85c9..55ad5d3b8d 100644 --- a/src/lib/evas/canvas/evas_object_vg.c +++ b/src/lib/evas/canvas/efl_canvas_vg.c @@ -3,7 +3,7 @@ #include "evas_vg_private.h" -#define MY_CLASS EVAS_VG_CLASS +#define MY_CLASS EFL_CANVAS_VG_CLASS /* private magic number for rectangle objects */ static const char o_type[] = "vectors"; @@ -11,24 +11,24 @@ static const char o_type[] = "vectors"; const char *o_vg_type = o_type; -static void evas_object_vg_render(Evas_Object *eo_obj, +static void _efl_canvas_vg_render(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data, void *engine, void *output, void *context, void *surface, int x, int y, Eina_Bool do_async); -static void evas_object_vg_render_pre(Evas_Object *eo_obj, +static void _efl_canvas_vg_render_pre(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data); -static void evas_object_vg_render_post(Evas_Object *eo_obj, +static void _efl_canvas_vg_render_post(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data); -static unsigned int evas_object_vg_id_get(Evas_Object *eo_obj); -static unsigned int evas_object_vg_visual_id_get(Evas_Object *eo_obj); -static void *evas_object_vg_engine_data_get(Evas_Object *eo_obj); -static int evas_object_vg_is_opaque(Evas_Object *eo_obj, +static unsigned int _efl_canvas_vg_id_get(Evas_Object *eo_obj); +static unsigned int _efl_canvas_vg_visual_id_get(Evas_Object *eo_obj); +static void *_efl_canvas_vg_engine_data_get(Evas_Object *eo_obj); +static int _efl_canvas_vg_is_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data); -static int evas_object_vg_was_opaque(Evas_Object *eo_obj, +static int _efl_canvas_vg_was_opaque(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, void *type_private_data); @@ -36,19 +36,19 @@ static const Evas_Object_Func object_func = { /* methods (compulsory) */ NULL, - evas_object_vg_render, - evas_object_vg_render_pre, - evas_object_vg_render_post, - evas_object_vg_id_get, - evas_object_vg_visual_id_get, - evas_object_vg_engine_data_get
[EGIT] [core/efl] master 01/01: evas: add set function for root_node property.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d26759555737681f454dbf80653a72dc506d355f commit d26759555737681f454dbf80653a72dc506d355f Author: subhransu mohanty <sub.moha...@samsung.com> Date: Mon Oct 23 11:05:34 2017 -0700 evas: add set function for root_node property. Summary: Currently user ask for the root_node from the evas_vg object and then attach its tree by setting the root node as parent. With this change this process will be explicit. user has to set the root node to the evas_vg object and the object will take the ownership of the tree. User can query the current vg_tree by root_node_get api. Test Plan: Fixed the test app to reflects this change. Reviewers: jpeg, cedric Reviewed By: jpeg, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D5347 Signed-off-by: Cedric Bail <ced...@osg.samsung.com> --- src/Makefile_Evas.am| 2 - src/examples/evas/evas-vg-batman.c | 5 +- src/examples/evas/evas-vg-simple.c | 12 +++- src/lib/edje/edje_calc.c| 5 +- src/lib/evas/canvas/efl_vg_root_node.eo | 9 --- src/lib/evas/canvas/evas_object_vg.c| 67 --- src/lib/evas/canvas/evas_vg.eo | 11 ++-- src/lib/evas/canvas/evas_vg_node.c | 6 +- src/lib/evas/canvas/evas_vg_private.h | 7 ++- src/lib/evas/canvas/evas_vg_root_node.c | 97 - 10 files changed, 74 insertions(+), 147 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 2da7935afc..6e2e155af1 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -23,7 +23,6 @@ evas_canvas_eolian_pub_files = \ lib/evas/canvas/efl_vg.eo \ lib/evas/canvas/efl_vg_container.eo \ lib/evas/canvas/efl_vg_shape.eo \ - lib/evas/canvas/efl_vg_root_node.eo \ lib/evas/canvas/efl_vg_gradient.eo \ lib/evas/canvas/efl_vg_gradient_radial.eo \ lib/evas/canvas/efl_vg_gradient_linear.eo \ @@ -394,7 +393,6 @@ lib_evas_libevas_la_SOURCES += \ lib/evas/canvas/evas_object_vg.c \ lib/evas/canvas/evas_vg_node.c \ lib/evas/canvas/evas_vg_container.c \ -lib/evas/canvas/evas_vg_root_node.c \ lib/evas/canvas/evas_vg_gradient.c \ lib/evas/canvas/evas_vg_gradient_linear.c \ lib/evas/canvas/evas_vg_gradient_radial.c \ diff --git a/src/examples/evas/evas-vg-batman.c b/src/examples/evas/evas-vg-batman.c index 10f4862490..6800daf248 100644 --- a/src/examples/evas/evas-vg-batman.c +++ b/src/examples/evas/evas-vg-batman.c @@ -57,6 +57,7 @@ static const char *batmans_path[] = { static void _on_delete(Ecore_Evas *ee EINA_UNUSED) { + ecore_animator_del(animation); ecore_main_loop_quit(); } @@ -141,7 +142,9 @@ main(void) animation = ecore_animator_timeline_add(1, _animator, NULL); - root = evas_object_vg_root_node_get(vg); + root = evas_vg_container_add(NULL); + + evas_object_vg_root_node_set(vg, root); Eina_Matrix3 matrix; eina_matrix3_identity(); diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c index 3414970b19..111fc3ef3c 100644 --- a/src/examples/evas/evas-vg-simple.c +++ b/src/examples/evas/evas-vg-simple.c @@ -309,7 +309,7 @@ _1_basic_shape_test() evas_object_event_callback_add(d.vg, EVAS_CALLBACK_KEY_DOWN, _basic_shape_key_handle, NULL); puts(basic_shape_menu); - container = evas_vg_container_add(evas_object_vg_root_node_get(d.vg)); + container = evas_vg_container_add(NULL); // Line shape = evas_vg_shape_add(container); @@ -406,6 +406,8 @@ _1_basic_shape_test() evas_vg_node_color_set(new_shape, 0, 0, 200, 200); evas_vg_node_origin_set(new_shape, 350, 450); d.shape_list = eina_list_append(d.shape_list, new_shape); + + evas_object_vg_root_node_set(d.vg, container); } // 2. Basic shape Test Case END @@ -487,9 +489,11 @@ _2_interpolation_test() evas_vg_node_origin_set(shape, 150, 150); d.shape_list = eina_list_append(d.shape_list, shape); - shape = evas_vg_shape_add(evas_object_vg_root_node_get(d.vg)); + shape = evas_vg_shape_add(NULL); evas_vg_node_origin_set(shape, 150, 150); d.shape_list = eina_list_append(d.shape_list, shape); + + evas_object_vg_root_node_set(d.vg, shape); } // 2. Interpolation Test Case END @@ -513,11 +517,13 @@ _main_menu() // create the initial screen d.vg = evas_object_vg_add(d.evas); evas_object_show(d.vg); - shape = evas_vg_shape_add(evas_object_vg_root_node_get(d.vg)); + shape = evas_vg_shape_add(NULL); evas_vg_shape_append_svg_path(shape, batman); evas_vg_node_color_set(shape, 10, 0, 0, 10); evas_vg_node_origin_set(shape, 0, 100); + evas_object_vg_root_node_set(d.vg, shape); + _canvas_resize_cb(d.ee); puts(main_menu); } diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 5a01da863f..ba5b4742dc 1006
[EGIT] [core/efl] master 01/04: efl: add new efl_gfx_shape_append_arc() api.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=648422c60b216b99f3fdf37c7f676b1885e64ef7 commit 648422c60b216b99f3fdf37c7f676b1885e64ef7 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Apr 18 15:32:36 2016 -0700 efl: add new efl_gfx_shape_append_arc() api. Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3895 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/efl/interfaces/efl_gfx_shape.eo | 17 - src/lib/evas/Evas_Legacy.h | 16 src/lib/evas/canvas/evas_vg_shape.c | 6 ++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.eo b/src/lib/efl/interfaces/efl_gfx_shape.eo index cd5ea68..6395b98 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.eo +++ b/src/lib/efl/interfaces/efl_gfx_shape.eo @@ -310,7 +310,7 @@ mixin Efl.Gfx.Shape x-direction (rx) and radius in y direction (ry). Use this api if you know the end point's of the arc otherwise use - more convenient function @.append_arc_to. + more convenient function @.append_arc. @since 1.14 ]] @@ -328,6 +328,21 @@ mixin Efl.Gfx.Shape property.]] } } + append_arc { +[[Append an arc that enclosed in the given rectangle (x, y, w, h). + The angle is defined in counter clock wise , use -ve angle for clockwise arc. + + @since 1.18 +]] +params { + @in x: double; [[X co-ordinate of the rect.]] + @in y: double; [[Y co-ordinate of the rect.]] + @in w: double; [[width of the rect.]] + @in h: double; [[height of the rect.]] + @in start_angle: double; [[Angle at which the arc will start]] + @in sweep_length: double; [[@ Length of the arc.]] +} + } append_close { [[Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting a new path. The current point of the diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 686739c..15b74a0 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -2239,6 +2239,22 @@ EAPI void evas_vg_shape_shape_append_scubic_to(Eo *obj, double x, double y, doub EAPI void evas_vg_shape_shape_append_arc_to(Eo *obj, double x, double y, double rx, double ry, double angle, Eina_Bool large_arc, Eina_Bool sweep); /** + * @brief Append an arc that enclosed in the given rectangle (x, y, w, h). The + * angle is defined in counter clock wise , use -ve angle for clockwise arc. + * + * @param[in] y Y co-ordinate of the rect. + * @param[in] w width of the rect. + * @param[in] h height of the rect. + * @param[in] start_angle Angle at which the arc will start + * @param[in] sweep_length @ Length of the arc. + * + * @since 1.18 + * + * @ingroup Efl_Gfx_Shape + */ +EAPI void evas_vg_shape_shape_append_arc(Eo *obj, double x, double y, double w, double h, double start_angle, double sweep_length); + +/** * * Closes the current subpath by drawing a line to the beginning of the subpath, * automatically starting a new path. The current point of the new path is diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c index fe2c902..1123fdf 100644 --- a/src/lib/evas/canvas/evas_vg_shape.c +++ b/src/lib/evas/canvas/evas_vg_shape.c @@ -420,6 +420,12 @@ evas_vg_shape_shape_append_arc_to(Eo *obj, double x, double y, double rx, double } EAPI void +evas_vg_shape_shape_append_arc(Eo *obj, double x, double y, double w, double h, double start_angle, double sweep_length) +{ + efl_gfx_shape_append_arc(obj, x, y, w, h, start_angle, sweep_length); +} + +EAPI void evas_vg_shape_shape_append_close(Eo *obj) { efl_gfx_shape_append_close(obj); --
[EGIT] [core/efl] master 08/09: efl: updated efl_gfx_shape_dup() implementation to use direct access to internal data.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e79dd4c1612b32428800b13b2b0385f1aec0312a commit e79dd4c1612b32428800b13b2b0385f1aec0312a Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 18 15:27:59 2015 +0900 efl: updated efl_gfx_shape_dup() implementation to use direct access to internal data. As I don't see the use of inheritance for stroke anymore, we will use internal access rather than inherited get/set function. This behavior can be reverted if anyone find a real use case for it. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/efl/interfaces/efl_gfx_shape.c | 74 +- 1 file changed, 29 insertions(+), 45 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index e285e27..364bd44 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -434,51 +434,6 @@ _efl_gfx_shape_equal_commands(Eo *obj EINA_UNUSED, } static void -_efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from) -{ - const Efl_Gfx_Dash *dash = NULL; - Efl_Gfx_Shape_Data *from; - Efl_Gfx_Fill_Rule fill_rule; - unsigned int dash_length = 0; - Efl_Gfx_Cap cap; - Efl_Gfx_Join j; - int sr, sg, sb, sa; - double scale, location; - double sw; - - if (obj == dup_from) return ; - from = eo_data_scope_get(dup_from, EFL_GFX_SHAPE_MIXIN); - if (!from) return ; - - eo_do(dup_from, - scale = efl_gfx_shape_stroke_scale_get(), - efl_gfx_shape_stroke_color_get(, , , ), - sw = efl_gfx_shape_stroke_width_get(), - location = efl_gfx_shape_stroke_location_get(), - efl_gfx_shape_stroke_dash_get(, _length), - cap = efl_gfx_shape_stroke_cap_get(), - j = efl_gfx_shape_stroke_join_get(), - fill_rule = efl_gfx_shape_fill_rule_get()); - eo_do(obj, - efl_gfx_shape_stroke_scale_set(scale), - efl_gfx_shape_stroke_color_set(sr, sg, sb, sa), - efl_gfx_shape_stroke_width_set(sw), - efl_gfx_shape_stroke_location_set(location), - efl_gfx_shape_stroke_dash_set(dash, dash_length), - efl_gfx_shape_stroke_cap_set(cap), - efl_gfx_shape_stroke_join_set(j), - efl_gfx_shape_fill_rule_set(fill_rule)); - - _efl_gfx_shape_path_set(obj, pd, from->commands, from->points); - - pd->convex = from->convex; - - eo_do(obj, - eo_event_callback_call(EFL_GFX_PATH_CHANGED, NULL), - eo_event_callback_call(EFL_GFX_CHANGED, NULL)); -} - -static void _efl_gfx_shape_reset(Eo *obj, Efl_Gfx_Shape_Data *pd) { free(pd->commands); @@ -1836,4 +1791,33 @@ _efl_gfx_shape_fill_rule_get(Eo *obj EINA_UNUSED, return pd->fill_rule; } +static void +_efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from) +{ + Efl_Gfx_Shape_Data *from; + + if (obj == dup_from) return ; + from = eo_data_scope_get(dup_from, EFL_GFX_SHAPE_MIXIN); + if (!from) return ; + + pd->public.stroke.scale = from->public.stroke.scale; + pd->public.stroke.width = from->public.stroke.width; + pd->public.stroke.centered = from->public.stroke.centered; + pd->public.stroke.cap = from->public.stroke.cap; + pd->public.stroke.join = from->public.stroke.join; + pd->public.stroke.color.r = from->public.stroke.color.r; + pd->public.stroke.color.g = from->public.stroke.color.g; + pd->public.stroke.color.b = from->public.stroke.color.b; + pd->public.stroke.color.a = from->public.stroke.color.a; + pd->fill_rule = from->fill_rule; + pd->convex = from->convex; + + _efl_gfx_shape_stroke_dash_set(obj, pd, from->public.stroke.dash, from->public.stroke.dash_length); + _efl_gfx_shape_path_set(obj, pd, from->commands, from->points); + + eo_do(obj, + eo_event_callback_call(EFL_GFX_PATH_CHANGED, NULL), + eo_event_callback_call(EFL_GFX_CHANGED, NULL)); +} + #include "interfaces/efl_gfx_shape.eo.c" --
[EGIT] [core/efl] master 07/09: efl: add bookkeeping for convex shapes.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=71b2efe94d7973ec64e7ab56ec3ddbeb44842a52 commit 71b2efe94d7973ec64e7ab56ec3ddbeb44842a52 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Nov 6 15:30:49 2015 +0900 efl: add bookkeeping for convex shapes. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/efl/interfaces/efl_gfx_shape.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 212e25b..e285e27 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -25,6 +25,7 @@ struct _Efl_Gfx_Shape_Data unsigned int commands_count; unsigned int points_count; + Eina_Bool convex; }; static inline unsigned int @@ -93,7 +94,7 @@ efl_gfx_path_grow(Efl_Gfx_Path_Command command, cmd_tmp[cmd_length - 1] = command; // NULL terminate the stream cmd_tmp[cmd_length] = EFL_GFX_PATH_COMMAND_TYPE_END; - + pd->convex = EINA_FALSE; return EINA_TRUE; } @@ -470,6 +471,8 @@ _efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from) _efl_gfx_shape_path_set(obj, pd, from->commands, from->points); + pd->convex = from->convex; + eo_do(obj, eo_event_callback_call(EFL_GFX_PATH_CHANGED, NULL), eo_event_callback_call(EFL_GFX_CHANGED, NULL)); @@ -490,7 +493,7 @@ _efl_gfx_shape_reset(Eo *obj, Efl_Gfx_Shape_Data *pd) pd->current.y = 0; pd->current_ctrl.x = 0; pd->current_ctrl.y = 0; - + pd->convex = EINA_FALSE; eo_do(obj, eo_event_callback_call(EFL_GFX_PATH_CHANGED, NULL), eo_event_callback_call(EFL_GFX_CHANGED, NULL)); @@ -1141,8 +1144,11 @@ static void _efl_gfx_shape_append_circle(Eo *obj, Efl_Gfx_Shape_Data *pd, double xc, double yc, double radius) { + Eina_Bool first = (pd->commands_count <= 0); _efl_gfx_shape_append_arc(obj, pd, xc - radius, yc - radius, 2*radius, 2*radius, 0, 360); _efl_gfx_shape_append_close(obj, pd); + //update convex flag + pd->convex = first; } static void @@ -1150,6 +1156,7 @@ _efl_gfx_shape_append_rect(Eo *obj, Efl_Gfx_Shape_Data *pd, double x, double y, double w, double h, double rx, double ry) { + Eina_Bool first = (pd->commands_count <= 0); // check for invalid rectangle if (w <=0 || h<= 0) return; @@ -1177,6 +1184,9 @@ _efl_gfx_shape_append_rect(Eo *obj, Efl_Gfx_Shape_Data *pd, _efl_gfx_shape_append_arc(obj, pd, x + w - rx, y, rx, ry, 0, 90); _efl_gfx_shape_append_arc(obj, pd, x, y, rx, ry, 90, 90); _efl_gfx_shape_append_close(obj, pd); + + //update convex flag + pd->convex = first; } static void --
[EGIT] [core/efl] master 04/09: efl: add alternative append_arc implementation
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4a48a7e9eab5551f21c4832fd0a1bf2cfd7a8483 commit 4a48a7e9eab5551f21c4832fd0a1bf2cfd7a8483 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Nov 5 19:29:55 2015 +0900 efl: add alternative append_arc implementation This allow to reduce the number of generated arc, but doesn't follow SVG specification. This is just used internally and can't be used by outside call. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/efl/interfaces/efl_gfx_shape.c | 300 + 1 file changed, 300 insertions(+) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 8ffdb76..e4efcef 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -824,6 +824,306 @@ _efl_gfx_shape_append_arc_to(Eo *obj, Efl_Gfx_Shape_Data *pd, } } +// append arc implementation +typedef struct _Point +{ + double x; + double y; +} Point; + +inline static void +_bezier_coefficients(double t, double *ap, double *bp, double *cp, double *dp) +{ + double a,b,c,d; + double m_t = 1. - t; + + b = m_t * m_t; + c = t * t; + d = c * t; + a = b * m_t; + b *= 3. * t; + c *= 3. * m_t; + *ap = a; + *bp = b; + *cp = c; + *dp = d; +} + +#define PATH_KAPPA 0.5522847498 +static double +_efl_gfx_t_for_arc_angle(double angle) +{ + double radians, cos_angle, sin_angle, tc, ts, t; + + if (angle < 0.1) + return 0; + + if (angle == 90.0) + return 1; + + radians = M_PI * angle / 180; + cos_angle = cos(radians); + sin_angle = sin(radians); + + // initial guess + tc = angle / 90; + // do some iterations of newton's method to approximate cos_angle + // finds the zero of the function b.pointAt(tc).x() - cos_angle + tc -= 2-3*PATH_KAPPA) * tc + 3*(PATH_KAPPA-1)) * tc) * tc + 1 - cos_angle) // value + / (((6-9*PATH_KAPPA) * tc + 6*(PATH_KAPPA-1)) * tc); // derivative + tc -= 2-3*PATH_KAPPA) * tc + 3*(PATH_KAPPA-1)) * tc) * tc + 1 - cos_angle) // value + / (((6-9*PATH_KAPPA) * tc + 6*(PATH_KAPPA-1)) * tc); // derivative + + // initial guess + ts = tc; + // do some iterations of newton's method to approximate sin_angle + // finds the zero of the function b.pointAt(tc).y() - sin_angle + ts -= 3*PATH_KAPPA-2) * ts - 6*PATH_KAPPA + 3) * ts + 3*PATH_KAPPA) * ts - sin_angle) + / (((9*PATH_KAPPA-6) * ts + 12*PATH_KAPPA - 6) * ts + 3*PATH_KAPPA); + ts -= 3*PATH_KAPPA-2) * ts - 6*PATH_KAPPA + 3) * ts + 3*PATH_KAPPA) * ts - sin_angle) + / (((9*PATH_KAPPA-6) * ts + 12*PATH_KAPPA - 6) * ts + 3*PATH_KAPPA); + + // use the average of the t that best approximates cos_angle + // and the t that best approximates sin_angle + t = 0.5 * (tc + ts); + return t; +} + +static void +_find_ellipse_coords(double x, double y, double w, double h, double angle, double length, + Point* start_point, Point *end_point) +{ + int i, quadrant; + double theta, t, a, b, c, d, px, py, cx, cy; + double w2 = w / 2; + double h2 = h / 2; + double angles[2] = { angle, angle + length }; + Point *points[2]; + + if (!w || !h) + { +if (start_point) + start_point->x = 0 , start_point->y = 0; +if (end_point) + end_point->x = 0 , end_point->y = 0; +return; + } + + points[0] = start_point; + points[1] = end_point; + for (i = 0; i < 2; ++i) + { +if (!points[i]) + continue; + +theta = angles[i] - 360 * floor(angles[i] / 360); +t = theta / 90; +// truncate +quadrant = (int)t; +t -= quadrant; + +t = _efl_gfx_t_for_arc_angle(90 * t); + +// swap x and y? +if (quadrant & 1) + t = 1 - t; + +_bezier_coefficients(t, , , , ); +px = a + b + c*PATH_KAPPA; +py = d + c + b*PATH_KAPPA; + +// left quadrants +if (quadrant == 1 || quadrant == 2) + px = -px; + +// top quadrants +if (quadrant == 0 || quadrant == 1) + py = -py; +cx = x+w/2; +cy = y+h/2; +points[i]->x = cx + w2 * px; +points[i]->y = cy + h2 * py; + } +} + +// The return value is the starting point of the arc +static Point +_curves_for_arc(double x, double y, double w, double h, +double start_angle, double sweep_length, +Point *curves, int *point_count) +{ + int start_segment, end_segment, delta, i, j, end, quadrant; + double start_t, end_t; + Eina_Bool split_at_start, split_at_end; + Eina_Bezier b, res; + Point start_point, end_point; + double w2 = w / 2; + double w2k = w2 * PATH_KAPPA; + double h2 = h / 2; + double h2k = h2 * PATH_KAPPA; + + Point points[16] = + { + // start point + { x + w, y + h2 }, + + // 0
[EGIT] [core/efl] master 05/09: efl: update append_circle implementation to use _efl_gfx_shape_append_arc.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d5719aad9da4ba3d3495b9b6a56a7fb3b8389cb0 commit d5719aad9da4ba3d3495b9b6a56a7fb3b8389cb0 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Nov 5 19:32:08 2015 +0900 efl: update append_circle implementation to use _efl_gfx_shape_append_arc. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/efl/interfaces/efl_gfx_shape.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index e4efcef..49b6e5f 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -1141,9 +1141,8 @@ static void _efl_gfx_shape_append_circle(Eo *obj, Efl_Gfx_Shape_Data *pd, double xc, double yc, double radius) { - _efl_gfx_shape_append_move_to(obj, pd, xc - radius, yc); - _efl_gfx_shape_append_arc_to(obj, pd, xc + radius, yc, radius, radius, 0, EINA_TRUE, EINA_TRUE); - _efl_gfx_shape_append_arc_to(obj, pd, xc - radius, yc, radius, radius, 0, EINA_TRUE, EINA_TRUE); + _efl_gfx_shape_append_arc(obj, pd, xc - radius, yc - radius, 2*radius, 2*radius, 0, 360); + _efl_gfx_shape_append_close(obj, pd); } static void --
[EGIT] [core/efl] master 03/09: eina: add new api eina_bezier_on_interval()
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8212f2aee3b15082294eaaa011ac943ba7c6a0b8 commit 8212f2aee3b15082294eaaa011ac943ba7c6a0b8 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 25 14:09:59 2015 +0900 eina: add new api eina_bezier_on_interval() I couldn't come up with a better name, if anyone has a suggestion. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/eina/eina_bezier.c| 18 ++ src/lib/eina/eina_bezier.h| 13 + src/tests/eina/eina_test_bezier.c | 22 ++ 3 files changed, 53 insertions(+) diff --git a/src/lib/eina/eina_bezier.c b/src/lib/eina/eina_bezier.c index f07ca61..6494551 100644 --- a/src/lib/eina/eina_bezier.c +++ b/src/lib/eina/eina_bezier.c @@ -313,3 +313,21 @@ eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, do if (w) *w = xmax - xmin; if (h) *h = ymax - ymin; } + +EAPI void +eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result) +{ + Eina_Bezier bezier; + double t; + + if (t0 == 0 && t1 == 1) + { +*result = *b; +return; + } + + bezier = *b; + _eina_bezier_split_left(, t0, result); + t = (t1-t0)/(1-t0); + _eina_bezier_split_left(, t, result); +} diff --git a/src/lib/eina/eina_bezier.h b/src/lib/eina/eina_bezier.h index 407deb5..7fd0a79 100644 --- a/src/lib/eina/eina_bezier.h +++ b/src/lib/eina/eina_bezier.h @@ -157,4 +157,17 @@ EAPI void eina_bezier_split_at_length(const Eina_Bezier *b, double len, Eina_Bez */ EAPI void eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h) EINA_ARG_NONNULL(1); +/** + * @brief find the bezier at given interval. + * + * @param b The floating point bezier. + * @param t0 The start interval. + * @param t1 The end interval. + * @param result The result bezier. + * + * @p b. No check is done on @p b. + * @since 1.16 + */ +EAPI void eina_bezier_on_interval(Eina_Bezier *b, double t0, double t1, Eina_Bezier *result); + #endif // EINA_BEZIER_H diff --git a/src/tests/eina/eina_test_bezier.c b/src/tests/eina/eina_test_bezier.c index fdfd9a3..a7a1598 100644 --- a/src/tests/eina/eina_test_bezier.c +++ b/src/tests/eina/eina_test_bezier.c @@ -195,6 +195,27 @@ START_TEST(eina_bezier_test_bounds_get) } END_TEST +START_TEST(eina_bezier_test_on_interval) +{ + Eina_Bezier b, res; + double px1, px2, py1, py2; + + eina_init(); + eina_bezier_values_set(, + 0, 0, + 10, 20, + 20, 90, + 30, 0); + eina_bezier_point_at(, 0.25, , ); + eina_bezier_on_interval(, 0.25, 0.5, ); + eina_bezier_point_at(, 0, , ); + + fail_if(px1 != px2 || py1 != py2); + + eina_shutdown(); +} +END_TEST + void eina_test_bezier(TCase *tc) { @@ -205,4 +226,5 @@ eina_test_bezier(TCase *tc) tcase_add_test(tc, eina_bezier_test_point_at); tcase_add_test(tc, eina_bezier_test_split_at_length); tcase_add_test(tc, eina_bezier_test_bounds_get); + tcase_add_test(tc, eina_bezier_test_on_interval); } --
[EGIT] [core/efl] master 06/09: efl: update append_rect implementation.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f6a1694181dccf03fa6d05bdf48bc4758179d84f commit f6a1694181dccf03fa6d05bdf48bc4758179d84f Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Nov 6 10:47:37 2015 +0900 efl: update append_rect implementation. This now generate more optimized path by reducing the use of arc and switching to only line whenever possible. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/efl/interfaces/efl_gfx_shape.c | 42 +- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 49b6e5f..212e25b 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -1150,22 +1150,32 @@ _efl_gfx_shape_append_rect(Eo *obj, Efl_Gfx_Shape_Data *pd, double x, double y, double w, double h, double rx, double ry) { - // clamp the x and y radius value. - if (rx > w/2) rx = w/2; - if (ry > h/2) ry = h/2; - - _efl_gfx_shape_append_move_to(obj, pd, x, y + ry); - // Top left corner - _efl_gfx_shape_append_arc_to(obj, pd, x + rx, y, rx, ry, 0, EINA_FALSE, EINA_TRUE); - _efl_gfx_shape_append_line_to(obj, pd, x + w - rx, y); - // Top right corner - _efl_gfx_shape_append_arc_to(obj, pd, x + w, y + ry, rx, ry, 0, EINA_FALSE, EINA_TRUE); - _efl_gfx_shape_append_line_to(obj, pd, x + w, y + h - ry); - // Bottom right corner - _efl_gfx_shape_append_arc_to(obj, pd, x + w - rx, y + h, rx, ry, 0, EINA_FALSE, EINA_TRUE); - _efl_gfx_shape_append_line_to(obj, pd, x + rx, y + h); - // Bottom left corner - _efl_gfx_shape_append_arc_to(obj, pd, x, y + h - ry, rx, ry, 0, EINA_FALSE, EINA_TRUE); + // check for invalid rectangle + if (w <=0 || h<= 0) + return; + + if (rx <=0 || ry<=0) + { + // add a normal rect. + _efl_gfx_shape_append_move_to(obj, pd, x, y); + _efl_gfx_shape_append_line_to(obj, pd, x, y + h); + _efl_gfx_shape_append_line_to(obj, pd, x + w, y + h); + _efl_gfx_shape_append_line_to(obj, pd, x + w, y); + _efl_gfx_shape_append_close(obj, pd); + return; + } + + // clamp the rx and ry radius value. + rx = 2*rx; + ry = 2*ry; + if (rx > w) rx = w; + if (ry > h) ry = h; + + _efl_gfx_shape_append_move_to(obj, pd, x, y + h/2); + _efl_gfx_shape_append_arc(obj, pd, x, y + h - ry, rx, ry, 180, 90); + _efl_gfx_shape_append_arc(obj, pd, x + w - rx, y + h - ry, rx, ry, 270, 90); + _efl_gfx_shape_append_arc(obj, pd, x + w - rx, y, rx, ry, 0, 90); + _efl_gfx_shape_append_arc(obj, pd, x, y, rx, ry, 90, 90); _efl_gfx_shape_append_close(obj, pd); } --
[EGIT] [core/efl] master 09/09: efl: change efl_gfx_shape_cubic_to() api signature to follow other API (cairo and freetype).
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=38902ef2919f0bc303e81081c5275412114fed8e commit 38902ef2919f0bc303e81081c5275412114fed8e Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Nov 23 10:43:46 2015 +0900 efl: change efl_gfx_shape_cubic_to() api signature to follow other API (cairo and freetype). Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/examples/evas/evas-vg-simple.c | 4 +-- src/lib/ector/cairo/ector_renderer_cairo_shape.c | 8 ++--- .../ector/software/ector_renderer_software_shape.c | 9 ++--- src/lib/efl/interfaces/efl_gfx_shape.c | 40 +++--- src/lib/efl/interfaces/efl_gfx_shape.eo| 4 +-- 5 files changed, 30 insertions(+), 35 deletions(-) diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c index 96afcb1..17416eb 100644 --- a/src/examples/evas/evas-vg-simple.c +++ b/src/examples/evas/evas-vg-simple.c @@ -370,9 +370,9 @@ void _arcto(Efl_VG *obj, int x, int y, int width, int height, int startAngle, in for (i = 0; i < point_count; i += 3) { evas_vg_shape_shape_append_cubic_to(obj, - pts[i+2].x, pts[i+2].y, pts[i].x, pts[i].y, - pts[i+1].x, pts[i+1].y); + pts[i+1].x, pts[i+1].y, + pts[i+2].x, pts[i+2].y); } evas_vg_shape_shape_append_close(obj); } diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c index a174cd1..aafec7b 100644 --- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c +++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c @@ -130,12 +130,10 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_prepare(Eo *obj, Ector_R pts += 2; break; case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: - // Be careful, we do have a different order than - // cairo, first is destination point, followed by - // the control point. The opposite of cairo. + cairo_curve_to(pd->parent->cairo, - pts[2], pts[3], pts[4], pts[5], // control points - pts[0], pts[1]); // destination point + pts[0], pts[1], pts[2], pts[3], // control points + pts[4], pts[5]); // destination point pts += 6; break; diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index a9a8c95..2d4947e 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -224,12 +224,9 @@ _generate_outline(const Efl_Gfx_Path_Command *cmds, const double *pts, Outline * break; case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: - // Be careful, we do have a different order than - // freetype first is destination point, followed by - // the control point. The opposite of cairo. _outline_cubic_to(outline, - pts[2], pts[3], pts[4], pts[5], // control points - pts[0], pts[1]); // destination point + pts[0], pts[1], pts[2], pts[3], // control points + pts[4], pts[5]); // destination point pts += 6; break; @@ -474,7 +471,7 @@ _generate_dashed_outline(const Efl_Gfx_Path_Command *cmds, const double *pts, Ou pts += 2; break; case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: - _dasher_cubic_to(, pts[2], pts[3], pts[4], pts[5], pts[0], pts[1]); + _dasher_cubic_to(, pts[0], pts[1], pts[2], pts[3], pts[4], pts[5]); pts += 6; break; diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 364bd44..9fe4d9e 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -498,9 +498,9 @@ _efl_gfx_shape_append_line_to(Eo *obj, Efl_Gfx_Shape_Data *pd, static void _efl_gfx_shape_append_cubic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, - double x, double y, double ctrl_x0, double ctrl_y0, - double ctrl_x1, double ctrl_y1) + double ctrl_x1, double ctrl_y1, + double x, double y) { double *offset_point; @@ -508,12 +508,12 @@ _efl_gfx_shape_ap
[EGIT] [core/efl] master 05/07: efl: added fill_rule property in efl_gfx_shape class
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=b1b0679daaa3ddf81363812061eeb008a2efbf96 commit b1b0679daaa3ddf81363812061eeb008a2efbf96 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 18 14:25:09 2015 +0900 efl: added fill_rule property in efl_gfx_shape class Open question, should fill rule be part of the public data ? Let's say no for now. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/efl/Efl.h | 10 ++ src/lib/efl/interfaces/efl_gfx_shape.c | 24 ++-- src/lib/efl/interfaces/efl_gfx_shape.eo | 19 +++ 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/src/lib/efl/Efl.h b/src/lib/efl/Efl.h index 8bc30b2..aa09157 100644 --- a/src/lib/efl/Efl.h +++ b/src/lib/efl/Efl.h @@ -125,6 +125,16 @@ typedef enum _Efl_Gfx_Gradient_Spread /** + * Type defining how an image content get filled. + * @since 1.14 + */ +typedef enum _Efl_Gfx_Fill_Rule +{ + EFL_GFX_FILL_RULE_WINDING = 0, /**< Draw a horizontal line from the point to a location outside the shape. Determine whether the direction of the line at each intersection point is up or down. The winding number is determined by summing the direction of each intersection. If the number is non zero, the point is inside the shape. This mode is the default */ + EFL_GFX_FILL_RULE_ODD_EVEN = 1, /**< Draw a horizontal line from the point to a location outside the shape, and count the number of intersections. If the number of intersections is an odd number, the point is inside the shape. */ +} Efl_Gfx_Fill_Rule; + +/** * Type defining stroke information. * @note Describe the properties to define the path stroke. * @since 1.14 diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 4ff8ceb..8ffdb76 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -13,6 +13,8 @@ struct _Efl_Gfx_Shape_Data { Efl_Gfx_Shape_Public public; + Efl_Gfx_Fill_Rule fill_rule; + struct { double x; double y; @@ -435,6 +437,7 @@ _efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from) { const Efl_Gfx_Dash *dash = NULL; Efl_Gfx_Shape_Data *from; + Efl_Gfx_Fill_Rule fill_rule; unsigned int dash_length = 0; Efl_Gfx_Cap cap; Efl_Gfx_Join j; @@ -453,7 +456,8 @@ _efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from) location = efl_gfx_shape_stroke_location_get(), efl_gfx_shape_stroke_dash_get(, _length), cap = efl_gfx_shape_stroke_cap_get(), - j = efl_gfx_shape_stroke_join_get()); + j = efl_gfx_shape_stroke_join_get(), + fill_rule = efl_gfx_shape_fill_rule_get()); eo_do(obj, efl_gfx_shape_stroke_scale_set(scale), efl_gfx_shape_stroke_color_set(sr, sg, sb, sa), @@ -461,7 +465,8 @@ _efl_gfx_shape_dup(Eo *obj, Efl_Gfx_Shape_Data *pd, const Eo *dup_from) efl_gfx_shape_stroke_location_set(location), efl_gfx_shape_stroke_dash_set(dash, dash_length), efl_gfx_shape_stroke_cap_set(cap), - efl_gfx_shape_stroke_join_set(j)); + efl_gfx_shape_stroke_join_set(j), + efl_gfx_shape_fill_rule_set(fill_rule)); _efl_gfx_shape_path_set(obj, pd, from->commands, from->points); @@ -1497,4 +1502,19 @@ _efl_gfx_shape_stroke_join_get(Eo *obj EINA_UNUSED, return pd->public.stroke.join; } +static void +_efl_gfx_shape_fill_rule_set(Eo *obj EINA_UNUSED, + Efl_Gfx_Shape_Data *pd, + Efl_Gfx_Fill_Rule fill_rule) +{ + pd->fill_rule = fill_rule; +} + +static Efl_Gfx_Fill_Rule +_efl_gfx_shape_fill_rule_get(Eo *obj EINA_UNUSED, + Efl_Gfx_Shape_Data *pd) +{ + return pd->fill_rule; +} + #include "interfaces/efl_gfx_shape.eo.c" diff --git a/src/lib/efl/interfaces/efl_gfx_shape.eo b/src/lib/efl/interfaces/efl_gfx_shape.eo index 395e542..4943522 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.eo +++ b/src/lib/efl/interfaces/efl_gfx_shape.eo @@ -125,6 +125,25 @@ mixin Efl.Gfx.Shape j: Efl_Gfx_Join; [[join style to use, default is EFL_GFX_JOIN_MITER]] } } + @property fill_rule { + set { +[[Sets the fill rule of the given shape object. + $EFL_GFX_FILL_RULE_WINDING, or $EFL_GFX_FILL_RULE_ODD_EVEN. + + @since 1.14 +]] + } + get { +[[Retrieves the fill rule for the given shape object. + + @since 1.14 +]] + } + values { +fill_rule: Efl_Gfx_Fill_Rule; [[The current fill rule of the shape object. + One of $EFL_GFX_FILL_RULE_WINDING, $EFL_GFX_FILL_RULE_ODD_EVEN]] + } +
[EGIT] [core/efl] master 06/07: ector: support fill rule for shape object.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=055354050e7e7c43a67c7361b9edba9fc9e56314 commit 055354050e7e7c43a67c7361b9edba9fc9e56314 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 18 14:45:16 2015 +0900 ector: support fill rule for shape object. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/ector/cairo/ector_renderer_cairo_shape.c | 15 +++ src/lib/ector/software/ector_renderer_software_shape.c | 10 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c index cd9f9d3..a174cd1 100644 --- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c +++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c @@ -26,6 +26,11 @@ typedef enum _cairo_line_join { CAIRO_LINE_JOIN_BEVEL } cairo_line_join_t; +typedef enum _cairo_fill_rule { + CAIRO_FILL_RULE_WINDING, + CAIRO_FILL_RULE_EVEN_ODD +} cairo_fill_rule_t; + static void (*cairo_move_to)(cairo_t *cr, double x, double y) = NULL; static void (*cairo_line_to)(cairo_t *cr, double x, double y) = NULL; static void (*cairo_curve_to)(cairo_t *cr, @@ -56,6 +61,7 @@ static void (*cairo_save)(cairo_t *cr) = NULL; static void (*cairo_restore)(cairo_t *cr) = NULL; static void (*cairo_set_dash) (cairo_t *cr, const double *dashes, int num_dashes, double offset) = NULL; +static void (*cairo_set_fill_rule) (cairo_t *cr, cairo_fill_rule_t fill_rule); typedef struct _Ector_Renderer_Cairo_Shape_Data Ector_Renderer_Cairo_Shape_Data; struct _Ector_Renderer_Cairo_Shape_Data @@ -153,6 +159,7 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend { int r, g, b, a; unsigned i; + Efl_Gfx_Fill_Rule fill_rule; if (pd->path == NULL) return EINA_FALSE; @@ -163,6 +170,12 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend cairo_new_path(pd->parent->cairo); cairo_append_path(pd->parent->cairo, pd->path); + eo_do(obj, fill_rule = efl_gfx_shape_fill_rule_get()); + if (fill_rule == EFL_GFX_FILL_RULE_ODD_EVEN) + cairo_set_fill_rule(pd->parent->cairo, CAIRO_FILL_RULE_EVEN_ODD); + else +cairo_set_fill_rule(pd->parent->cairo, CAIRO_FILL_RULE_WINDING); + if (pd->shape->fill) eo_do(pd->shape->fill, ector_renderer_cairo_base_fill(mul_col)); @@ -240,6 +253,7 @@ Eo * _ector_renderer_cairo_shape_eo_base_constructor(Eo *obj, Ector_Renderer_Cairo_Shape_Data *pd) { eo_do_super(obj, ECTOR_RENDERER_CAIRO_SHAPE_CLASS, obj = eo_constructor()); + if (!obj) return NULL; pd->public_shape = eo_data_xref(obj, EFL_GFX_SHAPE_MIXIN, obj); @@ -276,6 +290,7 @@ _ector_renderer_cairo_shape_eo_base_finalize(Eo *obj, Ector_Renderer_Cairo_Shape USE(pd->base, cairo_curve_to, NULL); USE(pd->base, cairo_line_to, NULL); USE(pd->base, cairo_move_to, NULL); + USE(pd->base, cairo_set_fill_rule, NULL); return obj; } diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index 5497dda..a9a8c95 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -520,13 +520,21 @@ _update_rle(Eo *obj, Ector_Renderer_Software_Shape_Data *pd) const Efl_Gfx_Path_Command *cmds = NULL; const double *pts = NULL; Eina_Bool close_path; + Efl_Gfx_Fill_Rule fill_rule; Outline *outline, *dash_outline; - eo_do(obj, efl_gfx_shape_path_get(, )); + eo_do(obj, + efl_gfx_shape_path_get(, ), + fill_rule = efl_gfx_shape_fill_rule_get()); if (cmds && (_generate_stroke_data(pd) || _generate_shape_data(pd))) { outline = _outline_create(); close_path = _generate_outline(cmds, pts, outline); +if (fill_rule == EFL_GFX_FILL_RULE_ODD_EVEN) + outline->ft_outline.flags = SW_FT_OUTLINE_EVEN_ODD_FILL; +else + outline->ft_outline.flags = SW_FT_OUTLINE_NONE; // default is winding fill + _outline_transform(outline, pd->base->m); //shape data generation --
[EGIT] [core/efl] master 07/07: ector: cleanup freetype raster
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1aa1bbc131e1bdd0b20acb1db43134d38858c604 commit 1aa1bbc131e1bdd0b20acb1db43134d38858c604 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Oct 29 17:20:09 2015 +0900 ector: cleanup freetype raster Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/static_libs/freetype/sw_ft_raster.c | 41 - 1 file changed, 41 deletions(-) diff --git a/src/static_libs/freetype/sw_ft_raster.c b/src/static_libs/freetype/sw_ft_raster.c index 4a41c3a..b2d96aa 100644 --- a/src/static_libs/freetype/sw_ft_raster.c +++ b/src/static_libs/freetype/sw_ft_raster.c @@ -101,9 +101,6 @@ typedef ptrdiff_t SW_FT_PtrDist; #define SW_FT_UNUSED( x ) (x) = (x) -#define SW_FT_TRACE5( x ) do { } while ( 0 ) /* nothing */ -#define SW_FT_TRACE7( x ) do { } while ( 0 ) /* nothing */ -#define SW_FT_ERROR( x ) do { } while ( 0 ) /* nothing */ #define SW_FT_THROW( e ) SW_FT_ERR_CAT( ErrRaster_, e ) /* The size in bytes of the render pool used by the scan-line converter */ @@ -350,10 +347,8 @@ typedef struct SW_FT_Outline_Funcs_ SW_FT_PtrDist max_cells; SW_FT_PtrDist num_cells; -TCoord cx, cy; TPosx, y; -TPoslast_ey; SW_FT_Vector bez_stack[32 * 3 + 1]; int lev_stack[32]; @@ -588,7 +583,6 @@ typedef struct SW_FT_Outline_Funcs_ ras.cover = 0; ras.ex = ex - ras.min_ex; ras.ey = ey - ras.min_ey; -ras.last_ey = SUBPIXELS( ey ); ras.invalid = 0; gray_set_cell( RAS_VAR_ ex, ey ); @@ -1238,8 +1232,6 @@ typedef struct SW_FT_Outline_Funcs_ int last; /* index of last point in contour */ - SW_FT_TRACE5(( "SW_FT_Outline_Decompose: Outline %d\n", n )); - last = outline->contours[n]; if ( last < 0 ) goto Invalid_Outline; @@ -1287,8 +1279,6 @@ typedef struct SW_FT_Outline_Funcs_ tags--; } - SW_FT_TRACE5(( " move to (%.2f, %.2f)\n", - v_start.x / 64.0, v_start.y / 64.0 )); error = func_interface->move_to( _start, user ); if ( error ) goto Exit; @@ -1309,8 +1299,6 @@ typedef struct SW_FT_Outline_Funcs_ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); -SW_FT_TRACE5(( " line to (%.2f, %.2f)\n", -vec.x / 64.0, vec.y / 64.0 )); error = func_interface->line_to( , user ); if ( error ) goto Exit; @@ -1337,10 +1325,6 @@ typedef struct SW_FT_Outline_Funcs_ if ( tag == SW_FT_CURVE_TAG_ON ) { - SW_FT_TRACE5(( " conic to (%.2f, %.2f)" - " with control (%.2f, %.2f)\n", - vec.x / 64.0, vec.y / 64.0, - v_control.x / 64.0, v_control.y / 64.0 )); error = func_interface->conic_to( _control, , user ); if ( error ) goto Exit; @@ -1353,10 +1337,6 @@ typedef struct SW_FT_Outline_Funcs_ v_middle.x = ( v_control.x + vec.x ) / 2; v_middle.y = ( v_control.y + vec.y ) / 2; -SW_FT_TRACE5(( " conic to (%.2f, %.2f)" -" with control (%.2f, %.2f)\n", -v_middle.x / 64.0, v_middle.y / 64.0, -v_control.x / 64.0, v_control.y / 64.0 )); error = func_interface->conic_to( _control, _middle, user ); if ( error ) goto Exit; @@ -1365,10 +1345,6 @@ typedef struct SW_FT_Outline_Funcs_ goto Do_Conic; } - SW_FT_TRACE5(( " conic to (%.2f, %.2f)" - " with control (%.2f, %.2f)\n", - v_start.x / 64.0, v_start.y / 64.0, - v_control.x / 64.0, v_control.y / 64.0 )); error = func_interface->conic_to( _control, _start, user ); goto Close; @@ -1398,22 +1374,12 @@ typedef struct SW_FT_Outline_Funcs_ vec.x = SCALED( point->x ); vec.y = SCALED( point->y ); - SW_FT_TRACE5(( " cubic to (%.2f, %.2f)" - " with controls (%.2f, %.2f) and (%.2f, %.2f)\n", - vec.x / 64.0, vec.y / 64.0, - vec1.x / 64.0, vec1.y / 64.0, - vec2.x / 64.0, vec2.y / 64.0 )); error = func_interface->cubic_to( , , , user ); if ( error ) goto Exit; continue; } -SW_FT_TRACE5(( " cubic to (%.2f, %.2f)" -" with controls (%.2f, %.2f) and (%.2f, %.2f)\n", -
[EGIT] [core/efl] master 04/07: efl: make path stroke related api as non virtual.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=609f74994bbb7d054fde95f7b284cebb949b2ad0 commit 609f74994bbb7d054fde95f7b284cebb949b2ad0 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 18 11:13:00 2015 +0900 efl: make path stroke related api as non virtual. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/ector/cairo/ector_renderer_cairo_shape.c | 44 +++--- src/lib/ector/ector_private.h | 14 -- src/lib/ector/ector_renderer_generic_shape.eo | 9 -- src/lib/ector/ector_renderer_shape.c | 131 .../ector/software/ector_renderer_software_shape.c | 70 + src/lib/efl/Efl.h | 31 +++- src/lib/efl/interfaces/efl_gfx_shape.c | 131 src/lib/efl/interfaces/efl_gfx_shape.eo| 16 -- src/lib/evas/canvas/efl_vg_shape.eo| 7 - src/lib/evas/canvas/evas_vg_shape.c| 170 ++--- 10 files changed, 238 insertions(+), 385 deletions(-) diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c index a78ddaf..cd9f9d3 100644 --- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c +++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c @@ -60,9 +60,12 @@ static void (*cairo_set_dash) (cairo_t *cr, const double *dashes, int num_dashes typedef struct _Ector_Renderer_Cairo_Shape_Data Ector_Renderer_Cairo_Shape_Data; struct _Ector_Renderer_Cairo_Shape_Data { + Efl_Gfx_Shape_Public *public_shape; + Ector_Cairo_Surface_Data *parent; Ector_Renderer_Generic_Shape_Data *shape; Ector_Renderer_Generic_Base_Data *base; + cairo_path_t *path; }; @@ -163,7 +166,7 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend if (pd->shape->fill) eo_do(pd->shape->fill, ector_renderer_cairo_base_fill(mul_col)); - if (pd->shape->stroke.fill || pd->shape->stroke.color.a > 0) + if (pd->shape->stroke.fill || pd->public_shape->stroke.color.a > 0) { cairo_fill_preserve(pd->parent->cairo); @@ -171,31 +174,31 @@ _ector_renderer_cairo_shape_ector_renderer_generic_base_draw(Eo *obj, Ector_Rend eo_do(pd->shape->stroke.fill, ector_renderer_cairo_base_fill(mul_col)); else { -r = (((pd->shape->stroke.color.r * R_VAL(_col)) + 0xff) >> 8); -g = (((pd->shape->stroke.color.g * G_VAL(_col)) + 0xff) >> 8); -b = (((pd->shape->stroke.color.b * B_VAL(_col)) + 0xff) >> 8); -a = (((pd->shape->stroke.color.a * A_VAL(_col)) + 0xff) >> 8); +r = (((pd->public_shape->stroke.color.r * R_VAL(_col)) + 0xff) >> 8); +g = (((pd->public_shape->stroke.color.g * G_VAL(_col)) + 0xff) >> 8); +b = (((pd->public_shape->stroke.color.b * B_VAL(_col)) + 0xff) >> 8); +a = (((pd->public_shape->stroke.color.a * A_VAL(_col)) + 0xff) >> 8); ector_color_argb_unpremul(a, , , ); cairo_set_source_rgba(pd->parent->cairo, r/255.0, g/255.0, b/255.0, a/255.0); -if (pd->shape->stroke.dash) +if (pd->public_shape->stroke.dash) { double *dashinfo; - dashinfo = (double *) malloc(2 * pd->shape->stroke.dash_length * sizeof(double)); - for (i = 0; i < pd->shape->stroke.dash_length; i++) + dashinfo = (double *) malloc(2 * pd->public_shape->stroke.dash_length * sizeof(double)); + for (i = 0; i < pd->public_shape->stroke.dash_length; i++) { - dashinfo[i*2] = pd->shape->stroke.dash[i].length; - dashinfo[i*2 + 1] = pd->shape->stroke.dash[i].gap; + dashinfo[i*2] = pd->public_shape->stroke.dash[i].length; + dashinfo[i*2 + 1] = pd->public_shape->stroke.dash[i].gap; } - cairo_set_dash(pd->parent->cairo, dashinfo, pd->shape->stroke.dash_length * 2, 0); + cairo_set_dash(pd->parent->cairo, dashinfo, pd->public_shape->stroke.dash_length * 2, 0); free(dashinfo); } } // Set dash, cap and join - cairo_set_line_width(pd->parent->cairo, (pd->shape->stroke.width * pd->shape->stroke.scale * 2)); - cairo_set_line_cap(pd->parent->cairo, (cairo_line_cap_t) pd->shape->stroke.cap); - cairo_set_line_join(pd->parent->cairo, (cairo_line_join_t) pd->shape->stroke.join); + cairo_set_line_width(pd->parent->ca
[EGIT] [core/efl] master 02/07: ector: updated the freetype raster with faster line renderer.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=da47b4df13272cc5a1be3dfd1a827b92aa606c41 commit da47b4df13272cc5a1be3dfd1a827b92aa606c41 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Oct 29 16:59:51 2015 +0900 ector: updated the freetype raster with faster line renderer. Merged from freetype repo with 'smooth', faster, alternative line renderer. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/static_libs/freetype/sw_ft_raster.c | 327 +++- 1 file changed, 113 insertions(+), 214 deletions(-) diff --git a/src/static_libs/freetype/sw_ft_raster.c b/src/static_libs/freetype/sw_ft_raster.c index 38b8539..4a41c3a 100644 --- a/src/static_libs/freetype/sw_ft_raster.c +++ b/src/static_libs/freetype/sw_ft_raster.c @@ -71,8 +71,10 @@ #include #include #include -#define SW_FT_UINT_MAX UINT_MAX -#define SW_FT_INT_MAX INT_MAX +#define SW_FT_UINT_MAX UINT_MAX +#define SW_FT_INT_MAXINT_MAX +#define SW_FT_ULONG_MAX ULONG_MAX +#define SW_FT_CHAR_BIT CHAR_BIT #define ft_memset memset @@ -268,6 +270,14 @@ typedef struct SW_FT_Outline_Funcs_ SW_FT_END_STMNT #endif /* __arm__ */ + /* These macros speed up repetitive divisions by replacing them */ + /* with multiplications and right shifts. */ +#define SW_FT_UDIVPREP( b ) \ + long b ## _r = (long)( SW_FT_ULONG_MAX >> PIXEL_BITS ) / ( b ) +#define SW_FT_UDIV( a, b )\ + ( ( (unsigned long)( a ) * (unsigned long)( b ## _r ) ) >> \ +( sizeof( long ) * SW_FT_CHAR_BIT - PIXEL_BITS ) ) + /*/ /* */ @@ -584,251 +594,140 @@ typedef struct SW_FT_Outline_Funcs_ gray_set_cell( RAS_VAR_ ex, ey ); } - /*/ /* */ - /* Render a scanline as one or more cells. */ - /* */ - static void - gray_render_scanline( RAS_ARG_ TCoord ey, - TPosx1, - TCoord y1, - TPosx2, - TCoord y2 ) - { -TCoord ex1, ex2, fx1, fx2, delta, mod; -longp, first, dx; -int incr; - - -dx = x2 - x1; - -ex1 = TRUNC( x1 ); -ex2 = TRUNC( x2 ); -fx1 = (TCoord)( x1 - SUBPIXELS( ex1 ) ); -fx2 = (TCoord)( x2 - SUBPIXELS( ex2 ) ); - -/* trivial case. Happens often */ -if ( y1 == y2 ) -{ - gray_set_cell( RAS_VAR_ ex2, ey ); - return; -} - -/* everything is located in a single cell. That is easy! */ -/**/ -if ( ex1 == ex2 ) -{ - delta = y2 - y1; - ras.area += (TArea)(( fx1 + fx2 ) * delta); - ras.cover += delta; - return; -} - -/* ok, we'll have to render a run of adjacent cells on the same */ -/* scanline... */ -/* */ -p = ( ONE_PIXEL - fx1 ) * ( y2 - y1 ); -first = ONE_PIXEL; -incr = 1; - -if ( dx < 0 ) -{ - p = fx1 * ( y2 - y1 ); - first = 0; - incr = -1; - dx= -dx; -} - -SW_FT_DIV_MOD( TCoord, p, dx, delta, mod ); - -ras.area += (TArea)(( fx1 + first ) * delta); -ras.cover += delta; - -ex1 += incr; -gray_set_cell( RAS_VAR_ ex1, ey ); -y1 += delta; - -if ( ex1 != ex2 ) -{ - TCoord lift, rem; - - - p = ONE_PIXEL * ( y2 - y1 + delta ); - SW_FT_DIV_MOD( TCoord, p, dx, lift, rem ); - - mod -= (int)dx; - - while ( ex1 != ex2 ) - { -delta = lift; -mod += rem; -if ( mod >= 0 ) -{ - mod -= (TCoord)dx; - delta++; -} - -ras.area += (TArea)(ONE_PIXEL * delta); -ras.cover += delta; -y1+= delta; -ex1 += incr; -gray_set_cell( RAS_VAR_ ex1, ey ); - } -} - -delta = y2 - y1; -ras.area += (TArea)(( fx2 + ONE_PIXEL - first ) * delta); -ras.cover += delta; - } - - - /*/ - /* */ - /* Render a given line as a series of scanlines. */ + /* Render a straight line across multiple cells in any direction.*/ /* */ static void
[EGIT] [core/efl] master 01/07: ector: fix the rounding issue when applying transformation to shape data in freetype backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=a6e168675dfc908216d16fe0e405ba0b7e49c0cc commit a6e168675dfc908216d16fe0e405ba0b7e49c0cc Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Oct 21 16:00:28 2015 +0900 ector: fix the rounding issue when applying transformation to shape data in freetype backend. @fix Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/ector/software/ector_renderer_software_shape.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index 71c2898..1198fb2 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -31,7 +31,7 @@ typedef struct _Outline }Outline; -#define TO_FT_COORD(x) ((x) * 64); // to freetype 26.6 coordinate. +#define TO_FT_COORD(x) ((x) * 64) // to freetype 26.6 coordinate. static inline void _grow_outline_contour(Outline *outline, int num) @@ -185,14 +185,15 @@ static void _outline_transform(Outline *outline, Eina_Matrix3 *m) double x, y; SW_FT_Outline *ft_outline = >ft_outline; - if (m) + if (m && (eina_matrix3_type_get(m) != EINA_MATRIX_TYPE_IDENTITY)) { for (i = 0; i < ft_outline->n_points; i++) { eina_matrix3_point_transform(m, - ft_outline->points[i].x/64,/* convert back to normal coord.*/ - ft_outline->points[i].y/64,/* convert back to normal coord.*/ + ft_outline->points[i].x/64.0,/* convert back to normal coord.*/ + ft_outline->points[i].y/64.0,/* convert back to normal coord.*/ , ); + ft_outline->points[i].x = TO_FT_COORD(x); ft_outline->points[i].y = TO_FT_COORD(y); } --
[EGIT] [core/efl] master 01/10: eina: added bounds_get api to Eina_Bezier
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=07bb5483b4acc0bc3ded4ccb7d61a24e545a2ff8 commit 07bb5483b4acc0bc3ded4ccb7d61a24e545a2ff8 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Nov 10 13:22:19 2015 +0900 eina: added bounds_get api to Eina_Bezier Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/eina/eina_bezier.c| 40 +++ src/lib/eina/eina_bezier.h| 14 ++ src/tests/eina/eina_test_bezier.c | 21 3 files changed, 75 insertions(+) diff --git a/src/lib/eina/eina_bezier.c b/src/lib/eina/eina_bezier.c index 4e8ffca..f07ca61 100644 --- a/src/lib/eina/eina_bezier.c +++ b/src/lib/eina/eina_bezier.c @@ -273,3 +273,43 @@ eina_bezier_split_at_length(const Eina_Bezier *b, double len, t = eina_bezier_t_at(right, len); _eina_bezier_split_left(right, t, left); } + +EAPI void +eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h) +{ + double xmin = b->start.x; + double xmax = b->start.x; + double ymin = b->start.y; + double ymax = b->start.y; + + if (b->ctrl_start.x < xmin) + xmin = b->ctrl_start.x; + else if (b->ctrl_start.x > xmax) + xmax = b->ctrl_start.x; + if (b->ctrl_end.x < xmin) + xmin = b->ctrl_end.x; + else if (b->ctrl_end.x > xmax) + xmax = b->ctrl_end.x; + if (b->end.x < xmin) + xmin = b->end.x; + else if (b->end.x > xmax) + xmax = b->end.x; + + if (b->ctrl_start.y < ymin) + ymin = b->ctrl_start.y; + else if (b->ctrl_start.y > ymax) + ymax = b->ctrl_start.y; + if (b->ctrl_end.y < ymin) + ymin = b->ctrl_end.y; + else if (b->ctrl_end.y > ymax) + ymax = b->ctrl_end.y; + if (b->end.y < ymin) + ymin = b->end.y; + else if (b->end.y > ymax) + ymax = b->end.y; + + if (x) *x = xmin; + if (y) *y = ymin; + if (w) *w = xmax - xmin; + if (h) *h = ymax - ymin; +} diff --git a/src/lib/eina/eina_bezier.h b/src/lib/eina/eina_bezier.h index aef32e4..407deb5 100644 --- a/src/lib/eina/eina_bezier.h +++ b/src/lib/eina/eina_bezier.h @@ -143,4 +143,18 @@ EAPI double eina_bezier_angle_at(const Eina_Bezier *b, double t) EINA_ARG_NONNUL */ EAPI void eina_bezier_split_at_length(const Eina_Bezier *b, double len, Eina_Bezier *left, Eina_Bezier *right) EINA_ARG_NONNULL(1); +/** + * @brief get the bound of the the bezier. + * + * @param b The floating point bezier. + * @param x x coordinate of bounding box. + * @param y y coordinate of bounding box. + * @param w width of bounding box. + * @param h height of bounding box. + * + * @p b. No check is done on @p b. + * @since 1.16 + */ +EAPI void eina_bezier_bounds_get(const Eina_Bezier *b, double *x, double *y, double *w, double *h) EINA_ARG_NONNULL(1); + #endif // EINA_BEZIER_H diff --git a/src/tests/eina/eina_test_bezier.c b/src/tests/eina/eina_test_bezier.c index a7ad8f2..fdfd9a3 100644 --- a/src/tests/eina/eina_test_bezier.c +++ b/src/tests/eina/eina_test_bezier.c @@ -175,6 +175,26 @@ START_TEST(eina_bezier_test_split_at_length) } END_TEST +START_TEST(eina_bezier_test_bounds_get) +{ + Eina_Bezier b; + double x, y, w, h; + + eina_init(); + eina_bezier_values_set(, + 0, 0, + 100, 0, + 0, 100, + 100, 100); + + eina_bezier_bounds_get(, , , , ); + + fail_if(x !=0 || y!=0 || w !=100 || h !=100 ); + + eina_shutdown(); +} +END_TEST + void eina_test_bezier(TCase *tc) { @@ -184,4 +204,5 @@ eina_test_bezier(TCase *tc) tcase_add_test(tc, eina_bezier_test_t_at); tcase_add_test(tc, eina_bezier_test_point_at); tcase_add_test(tc, eina_bezier_test_split_at_length); + tcase_add_test(tc, eina_bezier_test_bounds_get); } --
[EGIT] [core/efl] master 03/20: ector: convert to freetype co-ordinate before storing path data in software backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=576331955e10ebe51d6c8f60e9cd20104a0baafb commit 576331955e10ebe51d6c8f60e9cd20104a0baafb Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Aug 28 10:17:11 2015 +0900 ector: convert to freetype co-ordinate before storing path data in software backend. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- .../ector/software/ector_renderer_software_shape.c | 48 +++--- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index 0608798..c0cfe77 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -31,6 +31,8 @@ typedef struct _Outline }Outline; +#define TO_FT_COORD(x) ((x) * 64); // to freetype 26.6 coordinate. + static inline void _grow_outline_contour(Outline *outline, int num) { @@ -84,8 +86,8 @@ _outline_move_to(Outline *outline, double x, double y) SW_FT_Outline *ft_outline = >ft_outline; _grow_outline_points(outline, 1); - ft_outline->points[ft_outline->n_points].x = x; - ft_outline->points[ft_outline->n_points].y = y; + ft_outline->points[ft_outline->n_points].x = TO_FT_COORD(x); + ft_outline->points[ft_outline->n_points].y = TO_FT_COORD(y); ft_outline->tags[ft_outline->n_points] = SW_FT_CURVE_TAG_ON; if (ft_outline->n_points) @@ -118,8 +120,8 @@ static void _outline_line_to(Outline *outline, double x, double y) SW_FT_Outline *ft_outline = >ft_outline; _grow_outline_points(outline, 1); - ft_outline->points[ft_outline->n_points].x = x; - ft_outline->points[ft_outline->n_points].y = y; + ft_outline->points[ft_outline->n_points].x = TO_FT_COORD(x); + ft_outline->points[ft_outline->n_points].y = TO_FT_COORD(y); ft_outline->tags[ft_outline->n_points] = SW_FT_CURVE_TAG_ON; ft_outline->n_points++; } @@ -144,7 +146,13 @@ _outline_close_path(Outline *outline) // make sure there is atleast one point in the current path if (ft_outline->n_points == index) return EINA_FALSE; - _outline_line_to(outline, ft_outline->points[index].x, ft_outline->points[index].y); + // close the path + _grow_outline_points(outline, 1); + ft_outline->points[ft_outline->n_points].x = ft_outline->points[index].x; + ft_outline->points[ft_outline->n_points].y = ft_outline->points[index].y; + ft_outline->tags[ft_outline->n_points] = SW_FT_CURVE_TAG_ON; + ft_outline->n_points++; + return EINA_TRUE; } @@ -156,18 +164,18 @@ static void _outline_cubic_to(Outline *outline, double cx1, double cy1, _grow_outline_points(outline, 3); - ft_outline->points[ft_outline->n_points].x = cx1; - ft_outline->points[ft_outline->n_points].y = cy1; + ft_outline->points[ft_outline->n_points].x = TO_FT_COORD(cx1); + ft_outline->points[ft_outline->n_points].y = TO_FT_COORD(cy1); ft_outline->tags[ft_outline->n_points] = SW_FT_CURVE_TAG_CUBIC; ft_outline->n_points++; - ft_outline->points[ft_outline->n_points].x = cx2; - ft_outline->points[ft_outline->n_points].y = cy2; + ft_outline->points[ft_outline->n_points].x = TO_FT_COORD(cx2); + ft_outline->points[ft_outline->n_points].y = TO_FT_COORD(cy2); ft_outline->tags[ft_outline->n_points] = SW_FT_CURVE_TAG_CUBIC; ft_outline->n_points++; - ft_outline->points[ft_outline->n_points].x = x; - ft_outline->points[ft_outline->n_points].y = y; + ft_outline->points[ft_outline->n_points].x = TO_FT_COORD(x); + ft_outline->points[ft_outline->n_points].y = TO_FT_COORD(y); ft_outline->tags[ft_outline->n_points] = SW_FT_CURVE_TAG_ON; ft_outline->n_points++; } @@ -183,19 +191,11 @@ static void _outline_transform(Outline *outline, Eina_Matrix3 *m) for (i = 0; i < ft_outline->n_points; i++) { eina_matrix3_point_transform(m, - ft_outline->points[i].x, - ft_outline->points[i].y, + ft_outline->points[i].x/64,/* convert back to normal coord.*/ + ft_outline->points[i].y/64,/* convert back to normal coord.*/ , ); - ft_outline->points[i].x = (int)(x * 64);// to freetype 26.6 coordinate. - ft_outline->points[i].y = (int)(y * 64); - } - } - else - { -for (i = 0; i < ft_outline->n_points; i++) - { - ft_outline->points[i].x = ft_outline->points[i].x <<6;// to freetype 26.6
[EGIT] [core/efl] master 05/20: evas: create ector surface per engine instance.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=291c3e32af106531e4203ea4c2c69af786e0a34d commit 291c3e32af106531e4203ea4c2c69af786e0a34d Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Aug 25 15:32:35 2015 +0900 evas: create ector surface per engine instance. Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/evas/canvas/evas_main.c| 10 src/lib/evas/canvas/evas_object_vg.c | 19 +++ src/lib/evas/include/evas_private.h| 12 +++-- src/modules/evas/engines/gl_generic/evas_engine.c | 53 ++- .../evas/engines/software_generic/evas_engine.c| 61 -- 5 files changed, 89 insertions(+), 66 deletions(-) diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c index 5e7e6ee..1fa4d32 100644 --- a/src/lib/evas/canvas/evas_main.c +++ b/src/lib/evas/canvas/evas_main.c @@ -278,6 +278,8 @@ _evas_canvas_eo_base_destructor(Eo *eo_e, Evas_Public_Data *e) if (e->engine.func) { +e->engine.func->ector_destroy(e->engine.data.output, + e->engine.ector); e->engine.func->context_free(e->engine.data.output, e->engine.data.context); e->engine.func->output_free(e->engine.data.output); @@ -693,4 +695,12 @@ _evas_canvas_evas_common_interface_evas_get(Eo *eo_e, Evas_Public_Data *e EINA_U return (Evas *)eo_e; } +Ector_Surface * +evas_ector_get(Evas_Public_Data *e) +{ + if (!e->engine.ector) + e->engine.ector = e->engine.func->ector_create(e->engine.data.output); + return e->engine.ector; +} + #include "canvas/evas_canvas.eo.c" diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c index 628ade6..e50d787 100644 --- a/src/lib/evas/canvas/evas_object_vg.c +++ b/src/lib/evas/canvas/evas_object_vg.c @@ -194,7 +194,7 @@ evas_object_vg_render(Evas_Object *eo_obj EINA_UNUSED, int x, int y, Eina_Bool do_async) { Evas_VG_Data *vd = type_private_data; - + Ector_Surface *ector = evas_ector_get(obj->layer->evas); // FIXME: Set context (that should affect Ector_Surface) and // then call Ector_Renderer render from bottom to top. Get the // Ector_Surface that match the output from Evas engine API. @@ -219,14 +219,15 @@ evas_object_vg_render(Evas_Object *eo_obj EINA_UNUSED, obj->cur->anti_alias); obj->layer->evas->engine.func->context_render_op_set(output, context, obj->cur->render_op); - obj->layer->evas->engine.func->ector_begin(output, context, surface, + obj->layer->evas->engine.func->ector_begin(output, context, + ector, surface, obj->cur->geometry.x + x, obj->cur->geometry.y + y, do_async); _evas_vg_render(obj, vd, output, context, surface, vd->root, NULL, do_async); - obj->layer->evas->engine.func->ector_end(output, context, surface, do_async); + obj->layer->evas->engine.func->ector_end(output, context, ector, surface, do_async); } static void @@ -236,7 +237,6 @@ evas_object_vg_render_pre(Evas_Object *eo_obj, { Evas_VG_Data *vd = type_private_data; Efl_VG_Base_Data *rnd; - Evas_Public_Data *e = obj->layer->evas; int is_v, was_v; Ector_Surface *s; @@ -258,17 +258,18 @@ evas_object_vg_render_pre(Evas_Object *eo_obj, obj->cur->clipper, obj->cur->clipper->private_data); } + + // FIXME: handle damage only on changed renderer. + s = evas_ector_get(obj->layer->evas); + if (vd->root && s) + _evas_vg_render_pre(vd->root, s, NULL); + /* now figure what changed and add draw rects */ /* if it just became visible or invisible */ is_v = evas_object_is_visible(eo_obj, obj); was_v = evas_object_was_visible(eo_obj,obj); if (!(is_v | was_v)) goto done; - // FIXME: handle damage only on changed renderer. - s = e->engine.func->ector_get(e->engine.data.output); - if (vd->root && s) - _evas_vg_render_pre(vd->root, s, NULL); - // FIXME: for now the walking Evas_VG_Node tree doesn't trigger any damage // So just forcing it here if necessary rnd = eo_data_scope_get(vd->root, EFL_VG_BASE_CLASS); diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index e74ba01..e5d5889 100644 --- a/src/lib/ev
[EGIT] [core/efl] master 01/01: evas - fix texture context bind reset in gl common using wrong texture
raster pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8fe5e277e5bea32b8547385963a1664d46279ecd commit 8fe5e277e5bea32b8547385963a1664d46279ecd Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Sep 2 18:55:43 2015 +0900 evas - fix texture context bind reset in gl common using wrong texture evas gl common was simply resetting to the wrong texture id in the gl context struct - it was using pipe[0] not state.current. why i don't know. i know i wrote the pipe[0] code many years ago - really don';t know. it may have been a transitional piece of code that just happened t6o work 99% of the time that never got fixe when i added pipes. @fix --- .../evas/engines/gl_common/evas_gl_texture.c | 42 +++--- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c index 7e54283..f2451c3 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_texture.c +++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c @@ -392,7 +392,7 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, GLenum intformat, GLenum glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); ok = _tex_2d(gc, pt->intformat, w, h, pt->format, pt->dataformat); - glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); + glBindTexture(GL_TEXTURE_2D, gc->state.current.cur_tex); if (!ok) { glDeleteTextures(1, &(pt->texture)); @@ -624,7 +624,7 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in } glsym_glBindFramebuffer(GL_FRAMEBUFFER, fnum); - glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); + glBindTexture(GL_TEXTURE_2D, gc->state.current.cur_tex); if (!ok) { @@ -692,7 +692,7 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glBindTexture(im->native.target, 0); - glBindTexture(im->native.target, gc->pipe[0].shader.cur_tex); + glBindTexture(im->native.target, gc->state.current.cur_tex); texinfo.n.num++; texinfo.n.pix += pt->w * pt->h; @@ -840,7 +840,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i goto error; } - glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); + glBindTexture(GL_TEXTURE_2D, gc->state.current.cur_tex); #else if (gc + w + h + intformat + format) return pt; #endif @@ -927,8 +927,8 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) #endif glDeleteTextures(1, &(pt->texture)); - if (pt->gc->pipe[0].shader.cur_tex == pt->texture) - pt->gc->pipe[0].shader.cur_tex = 0; + if (pt->gc->state.current.cur_tex == pt->texture) + pt->gc->state.current.cur_tex = 0; if (pt->fb) { glsym_glDeleteFramebuffers(1, &(pt->fb)); @@ -1163,8 +1163,8 @@ evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int tpix); } //glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); + if (tex->pt->texture != tex->gc->state.current.cur_tex) + glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex); } void @@ -1262,9 +1262,9 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) im->image.data); } - if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) + if (tex->pt->texture != tex->gc->state.current.cur_tex) { -glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); +glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex); } return; } @@ -1383,8 +1383,8 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im) _tex_sub_2d(tex->gc, u, tex->ty, EVAS_GL_TILE_SIZE, EVAS_GL_TILE_SIZE, fmt, tex->ptt->dataformat, out); // Switch back to current texture -if (tex->ptt->texture != tex->gc->pipe[0].shader.cur_tex) - glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); +if (tex->ptt->texture != tex->gc->state.current.cur_tex) + glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex); // Now prepare uploading the main texture before returning; async = mall
[EGIT] [core/efl] master 01/13: evas: delete the ector_renderer when evas_vg_node gets deleted.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ad3ae08b82d3b53467f44261c61957fefc24f9d7 commit ad3ae08b82d3b53467f44261c61957fefc24f9d7 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Wed Aug 19 09:00:51 2015 +0900 evas: delete the ector_renderer when evas_vg_node gets deleted. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/evas/canvas/evas_vg_node.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c index ad0817e..775c688 100644 --- a/src/lib/evas/canvas/evas_vg_node.c +++ b/src/lib/evas/canvas/evas_vg_node.c @@ -266,6 +266,13 @@ _efl_vg_base_eo_base_destructor(Eo *obj, Efl_VG_Base_Data *pd) free(pd-m); pd-m = NULL; } + + if (pd-renderer) + { +eo_del(pd-renderer); +pd-renderer = NULL; + } + eo_do_super(obj, MY_CLASS, eo_destructor()); } --
[EGIT] [core/efl] master 11/13: ector: add NEON support for composition function in software backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=bed8325e3c2632782c01d21d008b09be7b8b3a3e commit bed8325e3c2632782c01d21d008b09be7b8b3a3e Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 15:42:48 2015 +0900 ector: add NEON support for composition function in software backend. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/Makefile_Ector.am | 3 +- src/lib/ector/software/ector_drawhelper.c | 2 + src/lib/ector/software/ector_drawhelper_neon.c | 226 + 3 files changed, 230 insertions(+), 1 deletion(-) diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am index 26e934d..3d158ef 100644 --- a/src/Makefile_Ector.am +++ b/src/Makefile_Ector.am @@ -97,7 +97,8 @@ lib/ector/software/sw_ft_math.c \ lib/ector/software/sw_ft_raster.c \ lib/ector/software/sw_ft_stroker.c \ lib/ector/software/ector_drawhelper.c \ -lib/ector/software/ector_drawhelper_sse2.c +lib/ector/software/ector_drawhelper_sse2.c \ +lib/ector/software/ector_drawhelper_neon.c installed_ectorsoftwareheadersdir = $(includedir)/ector-@VMAJ@/software nodist_installed_ectorsoftwareheaders_DATA = $(ector_eolian_software_h) diff --git a/src/lib/ector/software/ector_drawhelper.c b/src/lib/ector/software/ector_drawhelper.c index 26d8f98..39180b8 100644 --- a/src/lib/ector/software/ector_drawhelper.c +++ b/src/lib/ector/software/ector_drawhelper.c @@ -150,8 +150,10 @@ RGBA_Comp_Func ector_comp_func_span_get(Ector_Rop op, uint color, Eina_Bool src_ } extern void init_draw_helper_sse2(); +extern void init_draw_helper_neon(); void init_draw_helper() { init_draw_helper_sse2(); + init_draw_helper_neon(); } diff --git a/src/lib/ector/software/ector_drawhelper_neon.c b/src/lib/ector/software/ector_drawhelper_neon.c new file mode 100644 index 000..3adfdba --- /dev/null +++ b/src/lib/ector/software/ector_drawhelper_neon.c @@ -0,0 +1,226 @@ +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include Ector.h +#include ector_drawhelper_private.h + +#ifdef BUILD_NEON +#include arm_neon.h +static void +comp_func_solid_source_over_neon(uint * __restrict dest, int length, uint color, uint const_alpha) +{ + uint16x8_t temp00_16x8; + uint16x8_t temp01_16x8; + uint16x8_t temp10_16x8; + uint16x8_t temp11_16x8; + uint32x4_t temp0_32x4; + uint32x4_t temp1_32x4; + uint32x4_t c_32x4; + uint32x4_t d0_32x4; + uint32x4_t d1_32x4; + uint8x16_t d0_8x16; + uint8x16_t d1_8x16; + uint8x16_t temp0_8x16; + uint8x16_t temp1_8x16; + uint8x8_t alpha_8x8; + uint8x8_t d00_8x8; + uint8x8_t d01_8x8; + uint8x8_t d10_8x8; + uint8x8_t d11_8x8; + uint8x8_t temp00_8x8; + uint8x8_t temp01_8x8; + uint8x8_t temp10_8x8; + uint8x8_t temp11_8x8; + + if (const_alpha != 255) + color = BYTE_MUL(color, const_alpha); + + // alpha can only be 0 if color is 0x0. In that case we can just return. + // Otherwise we can assume alpha != 0. This allows more optimization in + // NEON code. + if(!color) + return; + + DATA32 *start = dest; + int size = length; + DATA32 *end = start + (size ~7); + + unsigned char alpha; + alpha = ~(color 24) + 1; + alpha_8x8 = vdup_n_u8(alpha); + + c_32x4 = vdupq_n_u32(color); + + while (start end) + { + d0_32x4 = vld1q_u32(start); + d1_32x4 = vld1q_u32(start+4); + d0_8x16 = vreinterpretq_u8_u32(d0_32x4); + d1_8x16 = vreinterpretq_u8_u32(d1_32x4); + + d00_8x8 = vget_low_u8(d0_8x16); + d01_8x8 = vget_high_u8(d0_8x16); + d10_8x8 = vget_low_u8(d1_8x16); + d11_8x8 = vget_high_u8(d1_8x16); + + temp00_16x8 = vmull_u8(alpha_8x8, d00_8x8); + temp01_16x8 = vmull_u8(alpha_8x8, d01_8x8); + temp10_16x8 = vmull_u8(alpha_8x8, d10_8x8); + temp11_16x8 = vmull_u8(alpha_8x8, d11_8x8); + + temp00_8x8 = vshrn_n_u16(temp00_16x8,8); + temp01_8x8 = vshrn_n_u16(temp01_16x8,8); + temp10_8x8 = vshrn_n_u16(temp10_16x8,8); + temp11_8x8 = vshrn_n_u16(temp11_16x8,8); + + temp0_8x16 = vcombine_u8(temp00_8x8, temp01_8x8); + temp1_8x16 = vcombine_u8(temp10_8x8, temp11_8x8); + + temp0_32x4 = vreinterpretq_u32_u8(temp0_8x16); + temp1_32x4 = vreinterpretq_u32_u8(temp1_8x16); + + d0_32x4 = vaddq_u32(c_32x4, temp0_32x4); + d1_32x4 = vaddq_u32(c_32x4, temp1_32x4); + + vst1q_u32(start, d0_32x4); + vst1q_u32(start+4, d1_32x4); + start+=8; + } + end += (size 7); + while (start end) + { + *start = color + MUL_256(alpha, *start); + start++; + } +} + +/* Note: Optimisation is based on keeping _dest_ aligned: else it's a pair of + * reads, then two writes, a miss on read is 'just' two reads */ +static void +comp_func_source_over_sse2(uint * __restrict dest, const uint * __restrict src, int length, uint color, uint const_alpha) +{ + uint16x8_t ad0_16x8; + uint16x8_t ad1_16x8; + uint16x8_t sc0_16x8; + uint16x8_t sc1_16x8
[EGIT] [core/efl] master 10/13: ector: add sse2 support for composition function in software backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=74dcf5ed15061349614c9d9a33437808734d5afb commit 74dcf5ed15061349614c9d9a33437808734d5afb Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 15:36:57 2015 +0900 ector: add sse2 support for composition function in software backend. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/Makefile_Ector.am | 6 +- src/lib/ector/software/ector_drawhelper.c | 4 +- src/lib/ector/software/ector_drawhelper_sse2.c | 324 + 3 files changed, 331 insertions(+), 3 deletions(-) diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am index c05642f..26e934d 100644 --- a/src/Makefile_Ector.am +++ b/src/Makefile_Ector.am @@ -96,7 +96,8 @@ lib/ector/software/ector_software_surface.c \ lib/ector/software/sw_ft_math.c \ lib/ector/software/sw_ft_raster.c \ lib/ector/software/sw_ft_stroker.c \ -lib/ector/software/ector_drawhelper.c +lib/ector/software/ector_drawhelper.c \ +lib/ector/software/ector_drawhelper_sse2.c installed_ectorsoftwareheadersdir = $(includedir)/ector-@VMAJ@/software nodist_installed_ectorsoftwareheaders_DATA = $(ector_eolian_software_h) @@ -109,7 +110,8 @@ lib_ector_libector_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -DPACKAGE_BIN_DIR=\$(bindir)\ \ -DPACKAGE_LIB_DIR=\$(libdir)\ \ -DPACKAGE_DATA_DIR=\$(datadir)/ector\ \ -@VALGRIND_CFLAGS@ +@VALGRIND_CFLAGS@ \ +@SSE3_CFLAGS@ lib_ector_libector_la_LIBADD = @ECTOR_LIBS@ @DL_LIBS@ lib_ector_libector_la_DEPENDENCIES = @ECTOR_INTERNAL_LIBS@ @DL_INTERNAL_LIBS@ diff --git a/src/lib/ector/software/ector_drawhelper.c b/src/lib/ector/software/ector_drawhelper.c index 40e7faa..26d8f98 100644 --- a/src/lib/ector/software/ector_drawhelper.c +++ b/src/lib/ector/software/ector_drawhelper.c @@ -149,7 +149,9 @@ RGBA_Comp_Func ector_comp_func_span_get(Ector_Rop op, uint color, Eina_Bool src_ return func_for_mode[op]; } +extern void init_draw_helper_sse2(); + void init_draw_helper() { - + init_draw_helper_sse2(); } diff --git a/src/lib/ector/software/ector_drawhelper_sse2.c b/src/lib/ector/software/ector_drawhelper_sse2.c new file mode 100644 index 000..bf6b25c --- /dev/null +++ b/src/lib/ector/software/ector_drawhelper_sse2.c @@ -0,0 +1,324 @@ +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include Ector.h +#include ector_drawhelper_private.h + +#ifdef BUILD_SSE3 +#include immintrin.h + +// Each 32bits components of alphaChannel must be in the form 0x00AA00AA +inline static __m128i +v4_byte_mul_sse2(__m128i c, __m128i a) +{ + const __m128i ag_mask = _mm_set1_epi32(0xFF00FF00); + const __m128i rb_mask = _mm_set1_epi32(0x00FF00FF); + + /* for AG */ + __m128i v_ag = _mm_and_si128(ag_mask, c); + v_ag = _mm_srli_epi32(v_ag, 8); + v_ag = _mm_mullo_epi16(a, v_ag); + v_ag = _mm_and_si128(ag_mask, v_ag); + + /* for RB */ + __m128i v_rb = _mm_and_si128(rb_mask, c); + v_rb = _mm_mullo_epi16(a, v_rb); + v_rb = _mm_srli_epi32(v_rb, 8); + v_rb = _mm_and_si128(rb_mask, v_rb); + + /* combine */ + return _mm_add_epi32(v_ag, v_rb); +} + +static inline __m128i +v4_interpolate_color_sse2(__m128i a, __m128i c0, __m128i c1) +{ + const __m128i rb_mask = _mm_set1_epi32(0xFF00FF00); + const __m128i zero = _mm_setzero_si128(); + + __m128i a_l = a; + __m128i a_h = a; + a_l = _mm_unpacklo_epi16(a_l, a_l); + a_h = _mm_unpackhi_epi16(a_h, a_h); + + __m128i a_t = _mm_slli_epi64(a_l, 32); + __m128i a_t0 = _mm_slli_epi64(a_h, 32); + + a_l = _mm_add_epi32(a_l, a_t); + a_h = _mm_add_epi32(a_h, a_t0); + + __m128i c0_l = c0; + __m128i c0_h = c0; + + c0_l = _mm_unpacklo_epi8(c0_l, zero); + c0_h = _mm_unpackhi_epi8(c0_h, zero); + + __m128i c1_l = c1; + __m128i c1_h = c1; + + c1_l = _mm_unpacklo_epi8(c1_l, zero); + c1_h = _mm_unpackhi_epi8(c1_h, zero); + + __m128i cl_sub = _mm_sub_epi16(c0_l, c1_l); + __m128i ch_sub = _mm_sub_epi16(c0_h, c1_h); + + cl_sub = _mm_mullo_epi16(cl_sub, a_l); + ch_sub = _mm_mullo_epi16(ch_sub, a_h); + + __m128i c1ls = _mm_slli_epi16(c1_l, 8); + __m128i c1hs = _mm_slli_epi16(c1_h, 8); + + cl_sub = _mm_add_epi16(cl_sub, c1ls); + ch_sub = _mm_add_epi16(ch_sub, c1hs); + + cl_sub = _mm_and_si128(cl_sub, rb_mask); + ch_sub = _mm_and_si128(ch_sub, rb_mask); + + cl_sub = _mm_srli_epi64(cl_sub, 8); + ch_sub = _mm_srli_epi64(ch_sub, 8); + + cl_sub = _mm_packus_epi16(cl_sub, cl_sub); + ch_sub = _mm_packus_epi16(ch_sub, ch_sub); + + return (__m128i) _mm_shuffle_ps( (__m128)cl_sub, (__m128)ch_sub, 0x44); +} + +static inline __m128i +v4_mul_color_sse2(__m128i x, __m128i y) +{ + const __m128i zero = _mm_setzero_si128(); + const __m128i sym4_mask = _mm_set_epi32(0x00FF00FF, 0x00FF, 0x00FF00FF, 0x00FF); + __m128i x_l = _mm_unpacklo_epi8(x, zero); + __m128i x_h = _mm_unpackhi_epi8(x, zero); + + __m128i y_l = _mm_unpacklo_epi8(y, zero); + __m128i y_h
[EGIT] [core/efl] master 09/13: ector: refactored software drawing backend to use composition function.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=2766ce57ce698850e50ebd8b92c4897fa739baf9 commit 2766ce57ce698850e50ebd8b92c4897fa739baf9 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 15:18:26 2015 +0900 ector: refactored software drawing backend to use composition function. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/Makefile_Ector.am | 5 +- src/lib/ector/software/ector_drawhelper.c | 155 src/lib/ector/software/ector_drawhelper_private.h | 102 ++ src/lib/ector/software/ector_software_rasterizer.c | 403 ++--- 4 files changed, 461 insertions(+), 204 deletions(-) diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am index 6d99092..c05642f 100644 --- a/src/Makefile_Ector.am +++ b/src/Makefile_Ector.am @@ -95,7 +95,8 @@ lib/ector/software/ector_software_rasterizer.c \ lib/ector/software/ector_software_surface.c \ lib/ector/software/sw_ft_math.c \ lib/ector/software/sw_ft_raster.c \ -lib/ector/software/sw_ft_stroker.c +lib/ector/software/sw_ft_stroker.c \ +lib/ector/software/ector_drawhelper.c installed_ectorsoftwareheadersdir = $(includedir)/ector-@VMAJ@/software nodist_installed_ectorsoftwareheaders_DATA = $(ector_eolian_software_h) @@ -147,7 +148,7 @@ endif EXTRA_DIST += \ lib/ector/ector_private.h \ lib/ector/cairo/ector_cairo_private.h \ -lib/ector/software/ector_blend_private.h \ +lib/ector/software/ector_drawhelper_private.h \ lib/ector/software/ector_software_private.h \ lib/ector/software/sw_ft_math.h \ lib/ector/software/sw_ft_raster.h \ diff --git a/src/lib/ector/software/ector_drawhelper.c b/src/lib/ector/software/ector_drawhelper.c new file mode 100644 index 000..40e7faa --- /dev/null +++ b/src/lib/ector/software/ector_drawhelper.c @@ -0,0 +1,155 @@ +#ifdef HAVE_CONFIG_H +#include config.h +#endif + +#include Ector.h +#include ector_drawhelper_private.h + +/* + s = source pixel + d = destination pixel + ca = const_alpha + sia = source inverse alpha + cia = const inverse alpha + +*/ + +/* + result = s + d * sia + dest = (s + d * sia) * ca + d * cia + = s * ca + d * (sia * ca + cia) + = s * ca + d * (1 - sa*ca) +*/ +void +comp_func_solid_source_over(uint *dest, int length, uint color, uint const_alpha) +{ + int ialpha, i; + if (const_alpha != 255) + color = BYTE_MUL(color, const_alpha); + ialpha = Alpha(~color); + for (i = 0; i length; ++i) + dest[i] = color + BYTE_MUL(dest[i], ialpha); +} + + +static void +comp_func_source_over(uint *dest, const uint *src, int length, uint color, uint const_alpha) +{ + int i; + uint s, sc, sia; + if (const_alpha != 255) + color = BYTE_MUL(color, const_alpha); + + if (color == 0x) // No color multiplier + { +for (i = 0; i length; ++i) + { + s = src[i]; + if (s = 0xff00) + dest[i] = s; + else if (s != 0) + { + sia = Alpha(~s); + dest[i] = s + BYTE_MUL(dest[i], sia); + } + } + } + else + { +for (i = 0; i length; ++i) + { + s = src[i]; + sc = ECTOR_MUL4_SYM(color, s); + sia = Alpha(~sc); + dest[i] = sc + BYTE_MUL(dest[i], sia); + } + } +} + +/* + result = s + dest = s * ca + d * cia +*/ +static void +comp_func_solid_source(uint *dest, int length, uint color, uint const_alpha) +{ + int ialpha, i; + if (const_alpha == 255) _ector_memfill(dest, length, color); + else + { +ialpha = 255 - const_alpha; +color = BYTE_MUL(color, const_alpha); +for (i = 0; i length; ++i) + dest[i] = color + BYTE_MUL(dest[i], ialpha); + } +} + +static void +comp_func_source(uint *dest, const uint *src, int length, uint color, uint const_alpha) +{ + int i, ialpha; + uint src_color; + if (color == 0x) // No color multiplier + { +if (const_alpha == 255) + memcpy(dest, src, length * sizeof(uint)); +else + { +ialpha = 255 - const_alpha; +for (i = 0; i length; ++i) + dest[i] = INTERPOLATE_PIXEL_256(src[i], const_alpha, dest[i], ialpha); + } + } + else + { +if (const_alpha == 255) + { + for (i = 0; i length; ++i) + dest[i] = ECTOR_MUL4_SYM(src[i], color); + } +else + { +ialpha = 255 - const_alpha; +for (i = 0; i length; ++i) + { + src_color = ECTOR_MUL4_SYM(src[i], color); + dest[i] = INTERPOLATE_PIXEL_256(src_color, const_alpha, dest[i], ialpha); +} + } + } +} + +RGBA_Comp_Func_Solid func_for_mode_solid[ECTOR_ROP_LAST] = { +comp_func_solid_source_over, +comp_func_solid_source
[EGIT] [core/efl] master 03/13: ector: add bounding box info in RLE data for software backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f1a4f461c2f90372035c59fc9cc376d25ad54c27 commit f1a4f461c2f90372035c59fc9cc376d25ad54c27 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 13:45:42 2015 +0900 ector: add bounding box info in RLE data for software backend. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/ector/software/ector_software_private.h| 1 + src/lib/ector/software/ector_software_rasterizer.c | 20 2 files changed, 21 insertions(+) diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h index c91d1d4..5fefe59 100644 --- a/src/lib/ector/software/ector_software_private.h +++ b/src/lib/ector/software/ector_software_private.h @@ -56,6 +56,7 @@ typedef struct _Raster_Buffer typedef struct _Shape_Rle_Data { + Eina_Rectangle bbox; unsigned short alloc; unsigned short size; SW_FT_Span *spans;// array of Scanlines. diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c index 47a0cae..5afb1ca 100644 --- a/src/lib/ector/software/ector_software_rasterizer.c +++ b/src/lib/ector/software/ector_software_rasterizer.c @@ -388,8 +388,11 @@ _rle_generation_cb( int count, const SW_FT_Span* spans,void *user) Shape_Rle_Data * ector_software_rasterizer_generate_rle_data(Software_Rasterizer *rasterizer, SW_FT_Outline *outline) { + int i, rle_size; + int l = 0, t = 0, r = 0, b = 0; Shape_Rle_Data *rle_data = (Shape_Rle_Data *) calloc(1, sizeof(Shape_Rle_Data)); SW_FT_Raster_Params params; + SW_FT_Span* span; params.flags = SW_FT_RASTER_FLAG_DIRECT | SW_FT_RASTER_FLAG_AA ; params.gray_spans = _rle_generation_cb; @@ -398,6 +401,23 @@ ector_software_rasterizer_generate_rle_data(Software_Rasterizer *rasterizer, SW_ sw_ft_grays_raster.raster_render(rasterizer-raster, params); + // update RLE bounding box. + span = rle_data-spans; + rle_size = rle_data-size; + if (rle_size) + { +t = span[0].y; +b = span[rle_size-1].y; +for (i = 0; i rle_size; i++) + { + if (span[i].x l) l = span[i].x; + if (span[i].x + span[i].len r) r = span[i].x + span[i].len; + } +rle_data-bbox.x = l; +rle_data-bbox.y = t; +rle_data-bbox.w = r - l; +rle_data-bbox.h = b - t + 1; + } return rle_data; } --
[EGIT] [core/efl] master 06/13: ector: refactored shape generation in software backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8b075c65348e460166aa964c48f379938cd0bc7d commit 8b075c65348e460166aa964c48f379938cd0bc7d Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 14:26:40 2015 +0900 ector: refactored shape generation in software backend. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- .../ector/software/ector_renderer_software_shape.c | 284 + 1 file changed, 178 insertions(+), 106 deletions(-) diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index 1c985d4..2ea12ee 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -30,18 +30,38 @@ typedef struct _Outline int contours_alloc; }Outline; + +static inline void +_grow_outline_contour(Outline *outline, int num) +{ + if ( outline-ft_outline.n_contours + num outline-contours_alloc) + { +outline-contours_alloc += 5; +outline-ft_outline.contours = (short *) realloc(outline-ft_outline.contours, + outline-contours_alloc * sizeof(short)); + } +} + +static inline void +_grow_outline_points(Outline *outline, int num) +{ + if ( outline-ft_outline.n_points + num outline-points_alloc) + { +outline-points_alloc += 50; +outline-ft_outline.points = (SW_FT_Vector *) realloc(outline-ft_outline.points, + outline-points_alloc * sizeof(SW_FT_Vector)); +outline-ft_outline.tags = (char *) realloc(outline-ft_outline.tags, +outline-points_alloc * sizeof(char)); + } +} static Outline * _outline_create() { Outline *outline = (Outline *) calloc(1, sizeof(Outline)); - - outline-ft_outline.points = (SW_FT_Vector *) calloc(50, sizeof(SW_FT_Vector)); - outline-ft_outline.tags = (char *) calloc(50, sizeof(char)); - - outline-ft_outline.contours = (short *) calloc(5, sizeof(short)); - - outline-points_alloc = 50; - outline-contours_alloc = 5; + outline-points_alloc = 0; + outline-contours_alloc = 0; + _grow_outline_contour(outline, 1); + _grow_outline_points(outline, 1); return outline; } @@ -63,17 +83,14 @@ _outline_move_to(Outline *outline, double x, double y) { SW_FT_Outline *ft_outline = outline-ft_outline; - if (ft_outline-n_contours == outline-contours_alloc) - { -outline-contours_alloc += 5; -ft_outline-contours = (short *) realloc(ft_outline-contours, outline-contours_alloc * sizeof(short)); - } + _grow_outline_points(outline, 1); ft_outline-points[ft_outline-n_points].x = x; ft_outline-points[ft_outline-n_points].y = y; ft_outline-tags[ft_outline-n_points] = SW_FT_CURVE_TAG_ON; if (ft_outline-n_points) { +_grow_outline_contour(outline, 1); ft_outline-contours[ft_outline-n_contours] = ft_outline-n_points - 1; ft_outline-n_contours++; } @@ -86,11 +103,7 @@ _outline_end(Outline *outline) { SW_FT_Outline *ft_outline = outline-ft_outline; - if (ft_outline-n_contours == outline-contours_alloc) - { -outline-contours_alloc += 1; -ft_outline-contours = (short *) realloc(ft_outline-contours, outline-contours_alloc * sizeof(short)); - } + _grow_outline_contour(outline, 1); if (ft_outline-n_points) { @@ -104,12 +117,7 @@ static void _outline_line_to(Outline *outline, double x, double y) { SW_FT_Outline *ft_outline = outline-ft_outline; - if (ft_outline-n_points == outline-points_alloc) - { -outline-points_alloc += 50; -ft_outline-points = (SW_FT_Vector *) realloc(ft_outline-points, outline-points_alloc * sizeof(SW_FT_Vector)); -ft_outline-tags = (char *) realloc(ft_outline-tags, outline-points_alloc * sizeof(char)); - } + _grow_outline_points(outline, 1); ft_outline-points[ft_outline-n_points].x = x; ft_outline-points[ft_outline-n_points].y = y; ft_outline-tags[ft_outline-n_points] = SW_FT_CURVE_TAG_ON; @@ -141,16 +149,12 @@ _outline_close_path(Outline *outline) } -static void _outline_cubic_to(Outline *outline, double cx1, double cy1, double cx2, double cy2, double x, double y) +static void _outline_cubic_to(Outline *outline, double cx1, double cy1, + double cx2, double cy2, double x, double y) { SW_FT_Outline *ft_outline = outline-ft_outline; - if (ft_outline-n_points == outline-points_alloc) - { -outline-points_alloc += 50; -ft_outline-points = (SW_FT_Vector *) realloc(ft_outline-points, outline-points_alloc * sizeof(SW_FT_Vector)); -ft_outline-tags = (char *) realloc(ft_outline-tags, outline-points_alloc * sizeof(char)); - } + _grow_outline_points(outline, 3
[EGIT] [core/efl] master 07/13: ector: add dash stroking feature in software backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e9896ee363e22e45b658cc5df650bfa0a1406047 commit e9896ee363e22e45b658cc5df650bfa0a1406047 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 14:44:46 2015 +0900 ector: add dash stroking feature in software backend. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- .../ector/software/ector_renderer_software_shape.c | 266 - 1 file changed, 263 insertions(+), 3 deletions(-) diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index 2ea12ee..0608798 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -245,6 +245,250 @@ _generate_outline(const Efl_Gfx_Path_Command *cmds, const double *pts, Outline * return close_path; } +typedef struct _Line +{ + double x1; + double y1; + double x2; + double y2; +}Line; + +static void +_line_value_set(Line *l, double x1, double y1, double x2, double y2) +{ + l-x1 = x1; + l-y1 = y1; + l-x2 = x2; + l-y2 = y2; +} + +// approximate sqrt(x*x + y*y) using alpha max plus beta min algorithm. +// With alpha = 1, beta = 3/8, giving results with a largest error less +// than 7% compared to the exact value. +static double +_line_length(Line *l) +{ + double x = l-x2 - l-x1; + double y = l-y2 - l-y1; + x = x 0 ? -x : x; + y = y 0 ? -y : y; + return (x y ? x + 0.375 * y : y + 0.375 * x); +} + +static void +_line_split_at_length(Line *l, double length, Line *left, Line *right) +{ + double len = _line_length(l); + double dx = ((l-x2 - l-x1)/len) *length; + double dy = ((l-y2 - l-y1)/len) *length; + + left-x1 = l-x1; + left-y1 = l-y1; + left-x2 = left-x1 + dx; + left-y2 = left-y1 + dy; + + right-x1 = left-x2; + right-y1 = left-y2; + right-x2 = l-x2; + right-y2 = l-y2; +} + +typedef struct _Dash_Stroker +{ + Efl_Gfx_Dash *dash; + int dash_len; + Outline *outline; + int cur_dash_index; + double cur_dash_length; + Eina_Bool cur_op_gap; + double start_x, start_y; + double cur_x, cur_y; +}Dash_Stroker; + +static void +_dasher_line_to(Dash_Stroker *dasher, double x, double y) +{ + Line l, left, right; + double line_len = 0.0; + _line_value_set(l, dasher-cur_x, dasher-cur_y, x, y); + line_len = _line_length(l); + if (line_len dasher-cur_dash_length) + { +dasher-cur_dash_length -= line_len; +if (!dasher-cur_op_gap) + { + _outline_move_to(dasher-outline, dasher-cur_x, dasher-cur_y); + _outline_line_to(dasher-outline, x, y); + } + } + else + { +while (line_len dasher-cur_dash_length) + { + line_len -= dasher-cur_dash_length; + _line_split_at_length(l, dasher-cur_dash_length, left, right); + if (!dasher-cur_op_gap) + { + _outline_move_to(dasher-outline, left.x1, left.y1); + _outline_line_to(dasher-outline, left.x2, left.y2); + dasher-cur_dash_length = dasher-dash[dasher-cur_dash_index].gap; + } + else + { + dasher-cur_dash_index = (dasher-cur_dash_index +1) % dasher-dash_len ; + dasher-cur_dash_length = dasher-dash[dasher-cur_dash_index].length; + } + dasher-cur_op_gap = !dasher-cur_op_gap; + l = right; + dasher-cur_x = l.x1; + dasher-cur_y = l.y1; + } +// remainder +dasher-cur_dash_length -= line_len; +if (!dasher-cur_op_gap) + { + _outline_move_to(dasher-outline, l.x1, l.y1); + _outline_line_to(dasher-outline, l.x2, l.y2); + } +if (dasher-cur_dash_length 1.0) + { + // move to next dash + if (!dasher-cur_op_gap) + { + dasher-cur_op_gap = EINA_TRUE; + dasher-cur_dash_length = dasher-dash[dasher-cur_dash_index].gap; + } + else + { + dasher-cur_op_gap = EINA_FALSE; + dasher-cur_dash_index = (dasher-cur_dash_index +1) % dasher-dash_len ; + dasher-cur_dash_length = dasher-dash[dasher-cur_dash_index].length; + } + } + } + dasher-cur_x = x; + dasher-cur_y = y; +} + +static void +_dasher_cubic_to(Dash_Stroker *dasher, double cx1 , double cy1, double cx2, double cy2, double x, double y) +{ + Eina_Bezier b, left, right; + double bez_len = 0.0; + eina_bezier_values_set(b, dasher-cur_x, dasher-cur_y, cx1, cy1, cx2, cy2, x, y); + bez_len = eina_bezier_length_get(b); + if (bez_len dasher-cur_dash_length) + { +dasher-cur_dash_length -= bez_len; +if (!dasher-cur_op_gap
[EGIT] [core/efl] master 04/13: ector: fix memory leak in software backend when using shape.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fcb2605f4f5e8c89007818bb968994a4df295ecd commit fcb2605f4f5e8c89007818bb968994a4df295ecd Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 13:54:49 2015 +0900 ector: fix memory leak in software backend when using shape. Mixin destructor are not called, so we need to explicitely call it. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/ector/software/ector_renderer_software_shape.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index a91b80e..1c985d4 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -378,6 +378,9 @@ void _ector_renderer_software_shape_eo_base_destructor(Eo *obj, Ector_Renderer_Software_Shape_Data *pd) { Eo *parent; + //FIXME, As base class destructor can't call destructor of mixin class. + // call explicit API to free shape data. + eo_do(obj, efl_gfx_shape_reset()); if (pd-shape_data) ector_software_rasterizer_destroy_rle_data(pd-shape_data); if (pd-outline_data) ector_software_rasterizer_destroy_rle_data(pd-outline_data); --
[EGIT] [core/efl] master 12/13: ector: add SSE2 support for gradient filling in software backend.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f3201e9ab97d135b38cdcd02d854784c1954194f commit f3201e9ab97d135b38cdcd02d854784c1954194f Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 15:55:18 2015 +0900 ector: add SSE2 support for gradient filling in software backend. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/ector/software/ector_drawhelper.c| 2 + src/lib/ector/software/ector_software_gradient.c | 395 ++- 2 files changed, 308 insertions(+), 89 deletions(-) diff --git a/src/lib/ector/software/ector_drawhelper.c b/src/lib/ector/software/ector_drawhelper.c index 39180b8..f1ea66b 100644 --- a/src/lib/ector/software/ector_drawhelper.c +++ b/src/lib/ector/software/ector_drawhelper.c @@ -149,11 +149,13 @@ RGBA_Comp_Func ector_comp_func_span_get(Ector_Rop op, uint color, Eina_Bool src_ return func_for_mode[op]; } +extern void init_drawhelper_gradient(); extern void init_draw_helper_sse2(); extern void init_draw_helper_neon(); void init_draw_helper() { + init_drawhelper_gradient(); init_draw_helper_sse2(); init_draw_helper_neon(); } diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c index 3682989..d6ad207 100644 --- a/src/lib/ector/software/ector_software_gradient.c +++ b/src/lib/ector/software/ector_software_gradient.c @@ -1,51 +1,53 @@ #ifdef HAVE_CONFIG_H -# include config.h +#include config.h #endif -//Remove #include assert.h - #include math.h -#include float.h -#include Eina.h -#include Ector.h #include software/Ector_Software.h #include ector_private.h #include ector_software_private.h -#include ector_blend_private.h +#include ector_drawhelper_private.h #define GRADIENT_STOPTABLE_SIZE 1024 #define FIXPT_BITS 8 #define FIXPT_SIZE (1FIXPT_BITS) +typedef void (*Radial_Helper_Func)(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, + float det, float delta_det, float delta_delta_det, float b, float delta_b); + +typedef void (*Linear_Helper_Func)(uint *buffer, int length, Ector_Renderer_Software_Gradient_Data *g_data, + int t_fixed, int inc_fixed); + +Radial_Helper_Func radial_helper; +Linear_Helper_Func linear_helper; static inline int _gradient_clamp(const Ector_Renderer_Software_Gradient_Data *data, int ipos) { -if (data-gd-s == EFL_GFX_GRADIENT_SPREAD_REPEAT) - { - ipos = ipos % GRADIENT_STOPTABLE_SIZE; - ipos = ipos 0 ? GRADIENT_STOPTABLE_SIZE + ipos : ipos; - } -else if (data-gd-s == EFL_GFX_GRADIENT_SPREAD_REFLECT) - { - const int limit = GRADIENT_STOPTABLE_SIZE * 2; - ipos = ipos % limit; - ipos = ipos 0 ? limit + ipos : ipos; - ipos = ipos = GRADIENT_STOPTABLE_SIZE ? limit - 1 - ipos : ipos; - } -else - { - if (ipos 0) - ipos = 0; - else if (ipos = GRADIENT_STOPTABLE_SIZE) - ipos = GRADIENT_STOPTABLE_SIZE-1; - } - -return ipos; + int limit; + if (data-gd-s == EFL_GFX_GRADIENT_SPREAD_REPEAT) + { +ipos = ipos % GRADIENT_STOPTABLE_SIZE; +ipos = ipos 0 ? GRADIENT_STOPTABLE_SIZE + ipos : ipos; + } + else if (data-gd-s == EFL_GFX_GRADIENT_SPREAD_REFLECT) + { +limit = GRADIENT_STOPTABLE_SIZE * 2; +ipos = ipos % limit; +ipos = ipos 0 ? limit + ipos : ipos; +ipos = ipos = GRADIENT_STOPTABLE_SIZE ? limit - 1 - ipos : ipos; + } + else + { +if (ipos 0) ipos = 0; +else if (ipos = GRADIENT_STOPTABLE_SIZE) + ipos = GRADIENT_STOPTABLE_SIZE-1; + } + return ipos; } @@ -63,12 +65,213 @@ _gradient_pixel(const Ector_Renderer_Software_Gradient_Data *data, float pos) return data-color_table[_gradient_clamp(data, ipos)]; } + +#ifdef BUILD_SSE3 +#include immintrin.h + +#define GRADIENT_STOPTABLE_SIZE_SHIFT 10 +typedef union{ __m128i v; int i[4];}vec4_i; +typedef union{ __m128 v; float f[4];}vec4_f; + +#define FETCH_CLAMP_INIT_F \ + __m128 v_min = _mm_set1_ps(0.0f); \ + __m128 v_max = _mm_set1_ps((float)(GRADIENT_STOPTABLE_SIZE-1)); \ + __m128 v_halff = _mm_set1_ps(0.5f); \ + __m128i v_repeat_mask = _mm_set1_epi32(~((uint)(0xff) GRADIENT_STOPTABLE_SIZE_SHIFT)); \ + __m128i v_reflect_mask = _mm_set1_epi32(~((uint)(0xff) (GRADIENT_STOPTABLE_SIZE_SHIFT+1))); \ + __m128i v_reflect_limit = _mm_set1_epi32(2 * GRADIENT_STOPTABLE_SIZE - 1); + +#define FETCH_CLAMP_REPEAT_F \ + vec4_i index_vec; \ + index_vec.v = _mm_and_si128(v_repeat_mask, _mm_cvttps_epi32(v_index)); + +#define FETCH_CLAMP_REFLECT_F \ + vec4_i index_vec; \ + __m128i v_index_i = _mm_and_si128(v_reflect_mask, _mm_cvttps_epi32(v_index)); \ + __m128i v_index_i_inv = _mm_sub_epi32(v_reflect_limit, v_index_i); \ + index_vec.v = _mm_min_epi16(v_index_i
[EGIT] [core/efl] master 08/13: ector: add alpha field to gradient data.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=48b558a997e5bfe321b401110daa449dc173bbd6 commit 48b558a997e5bfe321b401110daa449dc173bbd6 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 15:24:50 2015 +0900 ector: add alpha field to gradient data. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/ector/software/ector_software_gradient.c | 90 +--- src/lib/ector/software/ector_software_private.h | 1 + 2 files changed, 49 insertions(+), 42 deletions(-) diff --git a/src/lib/ector/software/ector_software_gradient.c b/src/lib/ector/software/ector_software_gradient.c index afd4dd3..3682989 100644 --- a/src/lib/ector/software/ector_software_gradient.c +++ b/src/lib/ector/software/ector_software_gradient.c @@ -71,61 +71,67 @@ _ease_linear(double t) return t; } -static void +static Eina_Bool _generate_gradient_color_table(Efl_Gfx_Gradient_Stop *gradient_stops, int stop_count, uint *color_table, int size) { -int pos = 0; -Efl_Gfx_Gradient_Stop *curr, *next; -assert(stop_count 0); - -curr = gradient_stops; -uint current_color = ECTOR_ARGB_JOIN(curr-a, curr-r, curr-g, curr-b); -double incr = 1.0 / (double)size; -double fpos = 1.5 * incr; - -color_table[pos++] = current_color; - -while (fpos = curr-offset) - { - color_table[pos] = color_table[pos - 1]; - pos++; - fpos += incr; - } + int dist, idist, pos = 0, i; + Eina_Bool alpha = EINA_FALSE; + Efl_Gfx_Gradient_Stop *curr, *next; + uint current_color, next_color; + double delta, t, incr, fpos; + assert(stop_count 0); + + curr = gradient_stops; + if (curr-a != 255) alpha = EINA_TRUE; + current_color = ECTOR_ARGB_JOIN(curr-a, curr-r, curr-g, curr-b); + incr = 1.0 / (double)size; + fpos = 1.5 * incr; + + color_table[pos++] = current_color; + + while (fpos = curr-offset) + { +color_table[pos] = color_table[pos - 1]; +pos++; +fpos += incr; + } -for (int i = 0; i stop_count - 1; ++i) - { - curr = (gradient_stops + i); - next = (gradient_stops + i + 1); - double delta = 1/(next-offset - curr-offset); - uint next_color = ECTOR_ARGB_JOIN(next-a, next-r, next-g, next-b); - BLEND_FUNC func = _ease_linear; - while (fpos next-offset pos size) - { - double t = func((fpos - curr-offset) * delta); - int dist = (int)(256 * t); - int idist = 256 - dist; - color_table[pos] = INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist); - ++pos; - fpos += incr; - } - current_color = next_color; - } + for (i = 0; i stop_count - 1; ++i) + { +curr = (gradient_stops + i); +next = (gradient_stops + i + 1); +delta = 1/(next-offset - curr-offset); +if (next-a != 255) alpha = EINA_TRUE; +next_color = ECTOR_ARGB_JOIN(next-a, next-r, next-g, next-b); +BLEND_FUNC func = _ease_linear; +while (fpos next-offset pos size) + { + t = func((fpos - curr-offset) * delta); + dist = (int)(256 * t); + idist = 256 - dist; + color_table[pos] = INTERPOLATE_PIXEL_256(current_color, idist, next_color, dist); + ++pos; + fpos += incr; + } +current_color = next_color; + } -for (;pos size; ++pos) - color_table[pos] = current_color; + for (;pos size; ++pos) + color_table[pos] = current_color; -// Make sure the last color stop is represented at the end of the table -color_table[size-1] = current_color; + // Make sure the last color stop is represented at the end of the table + color_table[size-1] = current_color; + return alpha; } void update_color_table(Ector_Renderer_Software_Gradient_Data *gdata) { - if(gdata-color_table) return; + if (gdata-color_table) return; gdata-color_table = malloc(GRADIENT_STOPTABLE_SIZE * 4); - _generate_gradient_color_table(gdata-gd-colors, gdata-gd-colors_count, gdata-color_table, GRADIENT_STOPTABLE_SIZE); + gdata-alpha = _generate_gradient_color_table(gdata-gd-colors, gdata-gd-colors_count, gdata-color_table, GRADIENT_STOPTABLE_SIZE); } void diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h index 5fefe59..a4d1221 100644 --- a/src/lib/ector/software/ector_software_private.h +++ b/src/lib/ector/software/ector_software_private.h @@ -42,6 +42,7 @@ typedef struct _Ector_Renderer_Software_Gradient_Data Software_Gradient_Linear_Data linear; Software_Gradient_Radial_Data radial; }; + Eina_Bool alpha; uint* color_table; } Ector_Renderer_Software_Gradient_Data; --
[EGIT] [core/efl] master 05/13: ector: remove wrong implementation of singleton in software_surface class.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=230b75acab9665dd77445de6d303d7171d3f684b commit 230b75acab9665dd77445de6d303d7171d3f684b Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 13:59:59 2015 +0900 ector: remove wrong implementation of singleton in software_surface class. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/ector/software/ector_software_surface.c | 15 +++ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/lib/ector/software/ector_software_surface.c b/src/lib/ector/software/ector_software_surface.c index a558302..0391150 100644 --- a/src/lib/ector/software/ector_software_surface.c +++ b/src/lib/ector/software/ector_software_surface.c @@ -8,8 +8,6 @@ #include ector_private.h #include ector_software_private.h -static unsigned int _software_count = 0; - typedef struct _Ector_Renderer_Software_Base_Data Ector_Renderer_Software_Base_Data; struct _Ector_Renderer_Software_Base_Data { @@ -69,14 +67,9 @@ static Eo * _ector_software_surface_eo_base_constructor(Eo *obj, Ector_Software_Surface_Data *pd EINA_UNUSED) { - obj = eo_do_super_ret(obj, ECTOR_SOFTWARE_SURFACE_CLASS, obj, eo_constructor()); - if(_software_count == 0) -{ - pd-software = (Software_Rasterizer *) calloc(1, sizeof(Software_Rasterizer)); - ector_software_rasterizer_init(pd-software); -} - _software_count++; - + obj = eo_do_super_ret(obj, ECTOR_SOFTWARE_SURFACE_CLASS, obj, eo_constructor()); + pd-software = (Software_Rasterizer *) calloc(1, sizeof(Software_Rasterizer)); + ector_software_rasterizer_init(pd-software); return obj; } @@ -84,8 +77,6 @@ static void _ector_software_surface_eo_base_destructor(Eo *obj EINA_UNUSED, Ector_Software_Surface_Data *pd EINA_UNUSED) { - --_software_count; - if (_software_count 0) return; ector_software_rasterizer_done(pd-software); free(pd-software); pd-software = NULL; --
[EGIT] [core/efl] master 13/13: ector: remove depricated file ector_blend_private.h
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=35ae391d644275e0e84a0e1f039d2eea7898f5a4 commit 35ae391d644275e0e84a0e1f039d2eea7898f5a4 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Mon Aug 17 16:00:34 2015 +0900 ector: remove depricated file ector_blend_private.h Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/ector/software/ector_blend_private.h | 105 --- 1 file changed, 105 deletions(-) diff --git a/src/lib/ector/software/ector_blend_private.h b/src/lib/ector/software/ector_blend_private.h deleted file mode 100644 index 0082baa..000 --- a/src/lib/ector/software/ector_blend_private.h +++ /dev/null @@ -1,105 +0,0 @@ -#ifndef ECTOR_BLEND_PRIVATE_H -#define ECTOR_BLEND_PRIVATE_H - -#ifndef MIN -#define MIN( a, b ) ( (a) (b) ? (a) : (b) ) -#endif - -#ifndef MAX -#define MAX( a, b ) ( (a) (b) ? (a) : (b) ) -#endif - -#define ECTOR_ARGB_JOIN(a,r,g,b) \ -(((a) 24) + ((r) 16) + ((g) 8) + (b)) - -#define ECTOR_MUL4_SYM(x, y) \ - ( ((x) 16) 0xff00) * (((y) 16) 0xff00)) + 0xff) 0xff00) + \ - ((x) 8) 0xff00) * (((y) 16) 0xff)) + 0xff00) 0xff) + \ - ((x) 0xff00) * ((y) 0xff00)) + 0xff) 16) 0xff00) + \ - (x) 0xff) * ((y) 0xff)) + 0xff) 8) ) - -#define ECTOR_MUL_256(c, a) \ - ( (c) 8) 0x00ff00ff) * (a)) 0xff00ff00) + \ - (c) 0x00ff00ff) * (a)) 8) 0x00ff00ff) ) - - -static inline void -_ector_memfill(DATA32 *dest, uint value, int count) -{ -if (!count) -return; - -int n = (count + 7) / 8; -switch (count 0x07) -{ -case 0: do { *dest++ = value; -case 7: *dest++ = value; -case 6: *dest++ = value; -case 5: *dest++ = value; -case 4: *dest++ = value; -case 3: *dest++ = value; -case 2: *dest++ = value; -case 1: *dest++ = value; -} while (--n 0); -} -} - - -static inline void -_ector_comp_func_source_over_mul_c(uint *dest, uint *src, DATA32 c, int length, uint const_alpha) -{ -if (const_alpha == 255) { -for (int i = 0; i length; ++i) { -uint s = src[i]; -DATA32 sc = ECTOR_MUL4_SYM(c, s); -uint a = (~sc) 24; -dest[i] = sc + ECTOR_MUL_256(dest[i], a); -} -} else { -for (int i = 0; i length; ++i) { -uint s = src[i]; -DATA32 sc = ECTOR_MUL4_SYM(c, s); -sc = ECTOR_MUL_256(sc, const_alpha); -uint a = (~sc) 24; -dest[i] = sc + ECTOR_MUL_256(dest[i], a); -} -} -} - - -static inline void -_ector_comp_func_source_over(uint *dest, uint *src, int length, uint const_alpha) -{ -if (const_alpha == 255) { -for (int i = 0; i length; ++i) { -uint s = src[i]; -if (s = 0xff00) -dest[i] = s; -else if (s != 0) { -uint a = (~s) 24; -dest[i] = s + ECTOR_MUL_256(dest[i], a); -} -} -} else { -for (int i = 0; i length; ++i) { -uint s = ECTOR_MUL_256(src[i], const_alpha); -uint a = (~s) 24; -dest[i] = s + ECTOR_MUL_256(dest[i], a); -} -} -} - -static inline uint -INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { -uint t = (x 0xff00ff) * a + (y 0xff00ff) * b; -t = 8; -t = 0xff00ff; - -x = ((x 8) 0xff00ff) * a + ((y 8) 0xff00ff) * b; -x = 0xff00ff00; -x |= t; -return x; -} - - -#endif \ No newline at end of file --
[EGIT] [core/efl] master 02/02: eina: add test for Eina_Bezier.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6afb497d915e85cb943ff8ffe086acad572025e9 commit 6afb497d915e85cb943ff8ffe086acad572025e9 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Sun Jul 12 15:39:09 2015 +0900 eina: add test for Eina_Bezier. --- src/Makefile_Eina.am | 3 +- src/tests/eina/eina_suite.c | 1 + src/tests/eina/eina_suite.h | 1 + src/tests/eina/eina_test_bezier.c | 187 ++ 4 files changed, 191 insertions(+), 1 deletion(-) diff --git a/src/Makefile_Eina.am b/src/Makefile_Eina.am index 0f1542d..7537e8a 100644 --- a/src/Makefile_Eina.am +++ b/src/Makefile_Eina.am @@ -317,7 +317,8 @@ tests/eina/eina_test_xattr.c \ tests/eina/eina_test_crc.c \ tests/eina/eina_test_quad.c \ tests/eina/eina_test_matrix.c \ -tests/eina/eina_test_quaternion.c +tests/eina/eina_test_quaternion.c \ +tests/eina/eina_test_bezier.c tests_eina_eina_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -DTESTS_WD=\`pwd`\ \ diff --git a/src/tests/eina/eina_suite.c b/src/tests/eina/eina_suite.c index 5caa536..42b9006 100644 --- a/src/tests/eina/eina_suite.c +++ b/src/tests/eina/eina_suite.c @@ -83,6 +83,7 @@ static const Eina_Test_Case etc[] = { { Quad, eina_test_quad }, { Matrix, eina_test_matrix }, { Quaternion, eina_test_quaternion }, + { Bezier, eina_test_bezier }, { NULL, NULL } }; diff --git a/src/tests/eina/eina_suite.h b/src/tests/eina/eina_suite.h index 845ec9d..b7f2726 100644 --- a/src/tests/eina/eina_suite.h +++ b/src/tests/eina/eina_suite.h @@ -68,5 +68,6 @@ void eina_test_crc(TCase *tc); void eina_test_quad(TCase *tc); void eina_test_matrix(TCase *tc); void eina_test_quaternion(TCase *tc); +void eina_test_bezier(TCase *tc); #endif /* EINA_SUITE_H_ */ diff --git a/src/tests/eina/eina_test_bezier.c b/src/tests/eina/eina_test_bezier.c new file mode 100644 index 000..a7ad8f2 --- /dev/null +++ b/src/tests/eina/eina_test_bezier.c @@ -0,0 +1,187 @@ +/* EINA - EFL data type library + * Copyright (C) 2015 Subhransu Mohanty sub.moha...@samsung.com + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see http://www.gnu.org/licenses/. + */ + +#ifdef HAVE_CONFIG_H +# include config.h +#endif + +#include math.h +#include stdio.h + +#include eina_suite.h +#include Eina.h + +START_TEST(eina_bezier_test_values) +{ + Eina_Bezier b; + double sx, sy, cx1, cy1, cx2, cy2, ex, ey; + + eina_init(); + eina_bezier_values_set(b, + 1, 2, + 3, 4, + 5, 6, + 7, 8); + eina_bezier_values_get(b, + sx, sy, + cx1, cy1, + cx2, cy2, + ex, ey); + fail_if(sx != 1 || + sy != 2 || + cx1 != 3 || + cy1 != 4 || + cx2 != 5 || + cy2 != 6 || + ex != 7 || + ey != 8); + eina_shutdown(); +} +END_TEST + +START_TEST(eina_bezier_test_angle) +{ + Eina_Bezier b; + double angle; + + eina_init(); + eina_bezier_values_set(b, + 1, 1, + 3, 1, + 5, 1, + 7, 1); + angle = eina_bezier_angle_at(b, 0.5); + + fail_if(angle != 0); + + eina_bezier_values_set(b, + 1, 2, + 1, 4, + 1, 6, + 1, 8); + angle = eina_bezier_angle_at(b, 0.5); + fail_if(floor(angle) != 90); + + eina_shutdown(); +} +END_TEST + +START_TEST(eina_bezier_test_length) +{ + Eina_Bezier b; + double length; + + eina_init(); + eina_bezier_values_set(b, + 1, 1, + 3, 1, + 5, 1, + 7, 1); + length = eina_bezier_length_get(b); + fail_if(floor(length) != 6); + + eina_bezier_values_set(b, + 1, 1, + 1, 1, + 1, 1, + 1, 1); + length = eina_bezier_length_get(b); + fail_if(length != 0); + + eina_shutdown(); +} +END_TEST + +START_TEST(eina_bezier_test_t_at) +{ + Eina_Bezier b; + double length, t; + + eina_init(); + eina_bezier_values_set(b
[EGIT] [core/efl] master 01/02: eina: add Eina_Bezier infrastructure for manipulating cubic bezier curves.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ddb8515930c2da8364d7be6f363faafcaa7ea334 commit ddb8515930c2da8364d7be6f363faafcaa7ea334 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Wed Apr 8 14:13:15 2015 +0900 eina: add Eina_Bezier infrastructure for manipulating cubic bezier curves. --- src/Makefile_Eina.am | 6 +- src/lib/eina/Eina.h| 1 + src/lib/eina/eina_bezier.c | 275 + src/lib/eina/eina_bezier.h | 146 4 files changed, 426 insertions(+), 2 deletions(-) diff --git a/src/Makefile_Eina.am b/src/Makefile_Eina.am index aab92e2..0f1542d 100644 --- a/src/Makefile_Eina.am +++ b/src/Makefile_Eina.am @@ -92,7 +92,8 @@ lib/eina/eina_crc.h \ lib/eina/eina_inline_crc.x \ lib/eina/eina_evlog.h \ lib/eina/eina_util.h \ -lib/eina/eina_quaternion.h +lib/eina/eina_quaternion.h \ +lib/eina/eina_bezier.h lib_eina_libeina_la_SOURCES = \ lib/eina/eina_abi.c \ @@ -161,7 +162,8 @@ lib/eina/eina_debug.h \ lib/eina/eina_private.h \ lib/eina/eina_share_common.h \ lib/eina/eina_strbuf_common.h \ -lib/eina/eina_quaternion.c +lib/eina/eina_quaternion.c \ +lib/eina/eina_bezier.c if HAVE_WIN32 lib_eina_libeina_la_SOURCES += lib/eina/eina_file_win32.c diff --git a/src/lib/eina/Eina.h b/src/lib/eina/Eina.h index 9e1918c..97cdd3d 100644 --- a/src/lib/eina/Eina.h +++ b/src/lib/eina/Eina.h @@ -267,6 +267,7 @@ extern C { #include eina_evlog.h #include eina_util.h #include eina_quaternion.h +#include eina_bezier.h #undef EAPI #define EAPI diff --git a/src/lib/eina/eina_bezier.c b/src/lib/eina/eina_bezier.c new file mode 100644 index 000..4e8ffca --- /dev/null +++ b/src/lib/eina/eina_bezier.c @@ -0,0 +1,275 @@ +/* EINA - EFL data type library + * Copyright (C) 2015 Subhransu Mohanty + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; + * if not, see http://www.gnu.org/licenses/. + */ +#include eina_private.h +#include eina_bezier.h + +#include math.h +#include float.h + +#define FLOAT_CMP(a, b) (fabs(a - b) = 0.01/* DBL_MIN */) + +static void +_eina_bezier_1st_derivative(const Eina_Bezier *bz, +double t, +double *px, double *py) +{ + // p'(t) = 3 * (-(1-2t+t^2) * p0 + (1 - 4 * t + 3 * t^2) * p1 + (2 * t - 3 * t^2) * p2 + t^2 * p3) + + double m_t = 1. - t; + + double d = t * t; + double a = -m_t * m_t; + double b = 1 - 4 * t + 3 * d; + double c = 2 * t - 3 * d; + + *px = 3 * ( a * bz-start.x + b * bz-ctrl_start.x + c * bz-ctrl_end.x + d * bz-end.x); + *py = 3 * ( a * bz-start.y + b * bz-ctrl_start.y + c * bz-ctrl_end.y + d * bz-end.y); +} + +// approximate sqrt(x*x + y*y) using alpha max plus beta min algorithm. +// With alpha = 1, beta = 3/8, giving results with a largest error less +// than 7% compared to the exact value. +static double +_line_length(double x1, double y1, double x2, double y2) +{ + double x = x2 - x1; + double y = y2 - y1; + + x = x 0 ? -x : x; + y = y 0 ? -y : y; + + return (x y ? x + 0.375 * y : y + 0.375 * x); +} + +static void +_eina_bezier_split(const Eina_Bezier *b, + Eina_Bezier *first, Eina_Bezier *second) +{ + double c = (b-ctrl_start.x + b-ctrl_end.x) * 0.5; + + first-ctrl_start.x = (b-start.x + b-ctrl_start.x) * 0.5; + second-ctrl_end.x = (b-ctrl_end.x + b-end.x) * 0.5; + first-start.x = b-start.x; + second-end.x = b-end.x; + first-ctrl_end.x = (first-ctrl_start.x + c) * 0.5; + second-ctrl_start.x = (second-ctrl_end.x + c) * 0.5; + first-end.x = second-start.x = (first-ctrl_end.x + second-ctrl_start.x) * 0.5; + + c = (b-ctrl_start.y + b-ctrl_end.y) / 2; + first-ctrl_start.y = (b-start.y + b-ctrl_start.y) * 0.5; + second-ctrl_end.y = (b-ctrl_end.y + b-end.y) * 0.5; + first-start.y = b-start.y; + second-end.y = b-end.y; + first-ctrl_end.y = (first-ctrl_start.y + c) * 0.5; + second-ctrl_start.y = (second-ctrl_end.y + c) * 0.5; + first-end.y = second-start.y = (first-ctrl_end.y + second-ctrl_start.y) * 0.5; +} + +static void +_eina_bezier_length_helper(const Eina_Bezier *b, + double *length) +{ + Eina_Bezier left, right; /* bez poly splits */ + double len = 0.0; /* arc length */ + double chord; /* chord length */ + + len = len + _line_length(b-start.x, b-start.y, b-ctrl_start.x, b
[EGIT] [core/elementary] master 04/17: check: add elm, activate, check, on and elm, activate, check, off signal to support state change animation.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/elementary.git/commit/?id=76b6a3791a8b176cb433b89640717d73d08fe245 commit 76b6a3791a8b176cb433b89640717d73d08fe245 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Wed Jul 29 23:10:49 2015 +0200 check: add elm,activate,check,on and elm,activate,check,off signal to support state change animation. Summary: Currently when user clicks on the checkbox, and when api state_check() called by the developer we emit elm,state,check,* signal. To support state change animation when user interacts with check box. There is no way to distinguish the action in EDC. This elm,activate,check,* is a way which edc can make use to distinguish the stae change signal by the user action or due to api call. Reviewers: woohyun, raster, cedric, Hermet Reviewed By: Hermet Subscribers: id213sin Differential Revision: https://phab.enlightenment.org/D2817 Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/elm_check.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/lib/elm_check.c b/src/lib/elm_check.c index 0dbf571..dc761ef 100644 --- a/src/lib/elm_check.c +++ b/src/lib/elm_check.c @@ -57,12 +57,22 @@ _activate(Evas_Object *obj) if (sd-statep) *sd-statep = sd-state; if (sd-state) { +// FIXME: to do animation during state change , we need different signal +// so that we can distinguish between state change by user or state change +// by calling state_change() api. Keep both the signal for backward compatibility +// and remove elm,state,check,on signal emission when we can break ABI. +elm_layout_signal_emit(obj, elm,activate,check,on, elm); elm_layout_signal_emit(obj, elm,state,check,on, elm); if (_elm_config-access_mode != ELM_ACCESS_MODE_OFF) _elm_access_say(E_(State: On)); } else { +// FIXME: to do animation during state change , we need different signal +// so that we can distinguish between state change by user or state change +// by calling state_change() api. Keep both the signal for backward compatibility +// and remove elm,state,check,off signal emission when we can break ABI. +elm_layout_signal_emit(obj, elm,activate,check,off, elm); elm_layout_signal_emit(obj, elm,state,check,off, elm); if (_elm_config-access_mode != ELM_ACCESS_MODE_OFF) _elm_access_say(E_(State: Off)); --
[EGIT] [core/efl] master 01/01: ector/software: Update the PIXEL_BIT to 8 for better quality.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4f2ad23585ac57006c4b7ff426646c5a9fea7900 commit 4f2ad23585ac57006c4b7ff426646c5a9fea7900 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Thu Jun 25 18:51:41 2015 +0900 ector/software: Update the PIXEL_BIT to 8 for better quality. --- src/lib/ector/software/sw_ft_raster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ector/software/sw_ft_raster.c b/src/lib/ector/software/sw_ft_raster.c index 2956123..f20a881 100644 --- a/src/lib/ector/software/sw_ft_raster.c +++ b/src/lib/ector/software/sw_ft_raster.c @@ -209,7 +209,7 @@ typedef struct SW_FT_Outline_Funcs_ /* must be at least 6 bits! */ -#define PIXEL_BITS 5 +#define PIXEL_BITS 8 #undef FLOOR #undef CEILING --
[EGIT] [core/efl] master 01/02: evas/engines : renamed ector native engine to default from freetype
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=aac9bee035886daae490f17a6cbc010b3dcc401a commit aac9bee035886daae490f17a6cbc010b3dcc401a Author: Subhransu Mohanty sub.moha...@samsung.com Date: Wed Apr 15 11:31:29 2015 +0900 evas/engines : renamed ector native engine to default from freetype --- src/modules/evas/engines/gl_generic/evas_engine.c | 2 +- src/modules/evas/engines/software_generic/evas_engine.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 4b181a8..68dd9b4 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -2282,7 +2282,7 @@ eng_ector_get(void *data EINA_UNUSED) const char *ector_backend; ector_backend = getenv(ECTOR_BACKEND); -if (ector_backend !strcasecmp(ector_backend, freetype)) +if (ector_backend !strcasecmp(ector_backend, default)) { _software_ector = eo_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL); use_cairo = EINA_FALSE; diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index 0470841..62219f6 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c @@ -3499,7 +3499,7 @@ eng_ector_get(void *data EINA_UNUSED) const char *ector_backend; ector_backend = getenv(ECTOR_BACKEND); -if (ector_backend !strcasecmp(ector_backend, freetype)) +if (ector_backend !strcasecmp(ector_backend, default)) { _software_ector = eo_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL); use_cairo = EINA_FALSE; --
[EGIT] [core/efl] master 02/02: evas/vg : Fixed issue regarding geometry change of vg object.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=dc7611cd711bab750db9bf678aa2ad191c024807 commit dc7611cd711bab750db9bf678aa2ad191c024807 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Fri Jun 12 17:24:55 2015 +0900 evas/vg : Fixed issue regarding geometry change of vg object. --- src/lib/evas/canvas/evas_object_vg.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c index 9cc81e4..f460719 100644 --- a/src/lib/evas/canvas/evas_object_vg.c +++ b/src/lib/evas/canvas/evas_object_vg.c @@ -282,15 +282,7 @@ evas_object_vg_render_pre(Evas_Object *eo_obj, (obj-cur-geometry.w != obj-prev-geometry.w) || (obj-cur-geometry.h != obj-prev-geometry.h)) { -evas_rects_return_difference_rects(obj-layer-evas-clip_changes, - obj-cur-geometry.x, - obj-cur-geometry.y, - obj-cur-geometry.w, - obj-cur-geometry.h, - obj-prev-geometry.x, - obj-prev-geometry.y, - obj-prev-geometry.w, - obj-prev-geometry.h); +evas_object_render_pre_prev_cur_add(obj-layer-evas-clip_changes, eo_obj, obj); goto done; } /* it obviously didn't change - add a NO obscure - this unupdates this */ --
[EGIT] [core/efl] master 01/02: evas/canvas : Call correct engine function for setting clip color
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d82c0ae1bfb4a0e15858dc5f2b52d4b103a0d32b commit d82c0ae1bfb4a0e15858dc5f2b52d4b103a0d32b Author: Subhransu Mohanty sub.moha...@samsung.com Date: Sat May 9 18:44:31 2015 +0900 evas/canvas : Call correct engine function for setting clip color --- src/lib/evas/canvas/evas_object_vg.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c index cca772a..731eec6 100644 --- a/src/lib/evas/canvas/evas_object_vg.c +++ b/src/lib/evas/canvas/evas_object_vg.c @@ -165,14 +165,18 @@ evas_object_vg_render(Evas_Object *eo_obj EINA_UNUSED, /* render object to surface with context, and offxet by x,y */ obj-layer-evas-engine.func-context_color_set(output, context, -obj-cur-cache.clip.r, -obj-cur-cache.clip.g, -obj-cur-cache.clip.b, -obj-cur-cache.clip.a); +255, +255, +255, +255); + obj-layer-evas-engine.func-context_multiplier_set(output, + context, + obj-cur-cache.clip.r, + obj-cur-cache.clip.g, + obj-cur-cache.clip.b, + obj-cur-cache.clip.a); obj-layer-evas-engine.func-context_anti_alias_set(output, context, obj-cur-anti_alias); - obj-layer-evas-engine.func-context_multiplier_unset(output, - context); obj-layer-evas-engine.func-context_render_op_set(output, context, obj-cur-render_op); obj-layer-evas-engine.func-ector_begin(output, context, surface, --
[EGIT] [core/efl] master 02/02: evas/engine: Fix the ector drawing for gl backend
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1ce417eb8b928053cd21b0fe829923745821aff8 commit 1ce417eb8b928053cd21b0fe829923745821aff8 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Sat May 9 18:46:42 2015 +0900 evas/engine: Fix the ector drawing for gl backend --- src/modules/evas/engines/gl_generic/evas_engine.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index cd08995..04f26a1 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -2388,6 +2388,7 @@ eng_ector_begin(void *data EINA_UNUSED, void *context EINA_UNUSED, void *surface w = gl_context-w; h = gl_context-h; software_buffer = realloc(software_buffer, sizeof (unsigned int) * w * h); + memset(software_buffer, 0, sizeof (unsigned int) * w * h); if (use_cairo) { eo_do(_software_ector, --
[EGIT] [core/efl] master 02/02: evas/canvas: Null check for base class data pointer.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8f55ac7550360e6afcdc0567685ceb25b7ecec63 commit 8f55ac7550360e6afcdc0567685ceb25b7ecec63 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Fri May 8 20:32:40 2015 +0900 evas/canvas: Null check for base class data pointer. --- src/lib/evas/canvas/evas_object_vg.c | 4 1 file changed, 4 insertions(+) diff --git a/src/lib/evas/canvas/evas_object_vg.c b/src/lib/evas/canvas/evas_object_vg.c index 57d4090..cca772a 100644 --- a/src/lib/evas/canvas/evas_object_vg.c +++ b/src/lib/evas/canvas/evas_object_vg.c @@ -226,6 +226,10 @@ evas_object_vg_render_pre(Evas_Object *eo_obj, // FIXME: for now the walking Evas_VG_Node tree doesn't trigger any damage // So just forcing it here if necessary rnd = eo_data_scope_get(vd-root, EFL_VG_BASE_CLASS); + + //FIXME find the reason for NULL Base Class in some case? + if (!rnd) return; + if (rnd-changed) { rnd-changed = EINA_FALSE; --
[EGIT] [core/efl] master 01/03: eina: updated matrix_translate, matrix_scale and matrix_rotate implementation to do compose of the matrix in not identity matrix.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ee99232b36118eb4c132667f9dd8277681fa4e49 commit ee99232b36118eb4c132667f9dd8277681fa4e49 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Fri Apr 17 11:19:59 2015 +0900 eina: updated matrix_translate, matrix_scale and matrix_rotate implementation to do compose of the matrix in not identity matrix. This is a late change that has been discussing on the ML as we don't want to release an API, we can't make faster. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/eina/eina_matrix.c | 60 +- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/src/lib/eina/eina_matrix.c b/src/lib/eina/eina_matrix.c index dc2e65c..61ee824 100644 --- a/src/lib/eina/eina_matrix.c +++ b/src/lib/eina/eina_matrix.c @@ -419,29 +419,33 @@ eina_matrix3_f16p16_compose(const Eina_Matrix3_F16p16 *m1, EAPI void eina_matrix3_translate(Eina_Matrix3 *m, double tx, double ty) { - MATRIX_XX(m) = 1; - MATRIX_XY(m) = 0; - MATRIX_XZ(m) = tx; - MATRIX_YX(m) = 0; - MATRIX_YY(m) = 1; - MATRIX_YZ(m) = ty; - MATRIX_ZX(m) = 0; - MATRIX_ZY(m) = 0; - MATRIX_ZZ(m) = 1; + Eina_Matrix3 tmp; + MATRIX_XX(tmp) = 1; + MATRIX_XY(tmp) = 0; + MATRIX_XZ(tmp) = tx; + MATRIX_YX(tmp) = 0; + MATRIX_YY(tmp) = 1; + MATRIX_YZ(tmp) = ty; + MATRIX_ZX(tmp) = 0; + MATRIX_ZY(tmp) = 0; + MATRIX_ZZ(tmp) = 1; + eina_matrix3_compose(m, tmp, m); } EAPI void eina_matrix3_scale(Eina_Matrix3 *m, double sx, double sy) { - MATRIX_XX(m) = sx; - MATRIX_XY(m) = 0; - MATRIX_XZ(m) = 0; - MATRIX_YX(m) = 0; - MATRIX_YY(m) = sy; - MATRIX_YZ(m) = 0; - MATRIX_ZX(m) = 0; - MATRIX_ZY(m) = 0; - MATRIX_ZZ(m) = 1; + Eina_Matrix3 tmp; + MATRIX_XX(tmp) = sx; + MATRIX_XY(tmp) = 0; + MATRIX_XZ(tmp) = 0; + MATRIX_YX(tmp) = 0; + MATRIX_YY(tmp) = sy; + MATRIX_YZ(tmp) = 0; + MATRIX_ZX(tmp) = 0; + MATRIX_ZY(tmp) = 0; + MATRIX_ZZ(tmp) = 1; + eina_matrix3_compose(m, tmp, m); } EAPI void @@ -458,15 +462,17 @@ eina_matrix3_rotate(Eina_Matrix3 *m, double rad) s = _sin(rad); #endif - MATRIX_XX(m) = c; - MATRIX_XY(m) = -s; - MATRIX_XZ(m) = 0; - MATRIX_YX(m) = s; - MATRIX_YY(m) = c; - MATRIX_YZ(m) = 0; - MATRIX_ZX(m) = 0; - MATRIX_ZY(m) = 0; - MATRIX_ZZ(m) = 1; + Eina_Matrix3 tmp; + MATRIX_XX(tmp) = c; + MATRIX_XY(tmp) = -s; + MATRIX_XZ(tmp) = 0; + MATRIX_YX(tmp) = s; + MATRIX_YY(tmp) = c; + MATRIX_YZ(tmp) = 0; + MATRIX_ZX(tmp) = 0; + MATRIX_ZY(tmp) = 0; + MATRIX_ZZ(tmp) = 1; + eina_matrix3_compose(m, tmp, m); } EAPI void --
[EGIT] [core/efl] master 03/03: evas: update Evas_Object_VG examples to use eina_matrix api correctly after change.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=40bdc50a12975f927fc9490d9b81f5f597c56b33 commit 40bdc50a12975f927fc9490d9b81f5f597c56b33 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Fri Apr 17 11:24:47 2015 +0900 evas: update Evas_Object_VG examples to use eina_matrix api correctly after change. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/examples/evas/evas-vg-batman.c | 1 + src/examples/evas/evas-vg-simple.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/examples/evas/evas-vg-batman.c b/src/examples/evas/evas-vg-batman.c index 116150a..f17636d 100644 --- a/src/examples/evas/evas-vg-batman.c +++ b/src/examples/evas/evas-vg-batman.c @@ -148,6 +148,7 @@ main(void) root = evas_object_vg_root_node_get(vg); Eina_Matrix3 matrix; + eina_matrix3_identity(matrix); eina_matrix3_scale(matrix, 1.1, 1.1); evas_vg_node_transformation_set(root, matrix); diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c index b125e3f..61fc704 100644 --- a/src/examples/evas/evas-vg-simple.c +++ b/src/examples/evas/evas-vg-simple.c @@ -437,6 +437,7 @@ vector_set(int x, int y, int w, int h) // apply some transformation double radian = 30.0 * 2 * 3.141 / 360.0; Eina_Matrix3 matrix; + eina_matrix3_identity(matrix); eina_matrix3_rotate(matrix, radian); Efl_VG *root = evas_object_vg_root_node_get(d.vg); --
[EGIT] [core/efl] master 02/03: evas: update matrix calulation as the behaviour of eina_matrix api changed.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=451a15802add5ff08e763c04674018ae80dec466 commit 451a15802add5ff08e763c04674018ae80dec466 Author: Subhransu Mohanty sub.moha...@samsung.com Date: Fri Apr 17 11:22:48 2015 +0900 evas: update matrix calulation as the behaviour of eina_matrix api changed. Signed-off-by: Cedric BAIL ced...@osg.samsung.com --- src/lib/evas/canvas/evas_vg_private.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h index 8f5bf4f..af4912a 100644 --- a/src/lib/evas/canvas/evas_vg_private.h +++ b/src/lib/evas/canvas/evas_vg_private.h @@ -59,7 +59,7 @@ _efl_vg_base_changed(Eo *obj) #define EFL_VG_COMPUTE_MATRIX(Current, Parent, Nd) \ Eina_Matrix3 *Current = Nd-m;\ - Eina_Matrix3 _matrix_tmp, translate; \ + Eina_Matrix3 _matrix_tmp; \ \ if (Parent) \ { \ @@ -70,10 +70,10 @@ _efl_vg_base_changed(Eo *obj) } \ else \ { \ -eina_matrix3_translate(translate, -(Nd-x), -(Nd-y)); \ -eina_matrix3_compose(Parent, translate, _matrix_tmp); \ -eina_matrix3_translate(translate, (Nd-x), (Nd-y)); \ -eina_matrix3_compose(_matrix_tmp, translate, _matrix_tmp); \ +eina_matrix3_identity(_matrix_tmp);\ +eina_matrix3_translate(_matrix_tmp, -(Nd-x), -(Nd-y)); \ +eina_matrix3_compose(Parent, _matrix_tmp, _matrix_tmp); \ +eina_matrix3_translate(_matrix_tmp, (Nd-x), (Nd-y)); \ Current = _matrix_tmp; \ } \ } --