[EGIT] [core/efl] master 01/01: edje/styles: keep an escaped string of font_set. As eina_ecaped_string() creates a new string just make it once and use when needed.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1d930427a3d2fd5540ce804e0e90569d12a72b55 commit 1d930427a3d2fd5540ce804e0e90569d12a72b55 Author: subhransu mohanty Date: Mon Aug 19 19:21:47 2019 +0900 edje/styles: keep an escaped string of font_set. As eina_ecaped_string() creates a new string just make it once and use when needed. Reviewers: Hermet, ali.alzyod Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9615 --- src/lib/edje/edje_private.h | 1 + src/lib/edje/edje_textblock_styles.c | 12 src/lib/edje/edje_util.c | 7 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 0eab189859..f054fa25a2 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2457,6 +2457,7 @@ EAPI extern Eet_Data_Descriptor *_edje_edd_edje_part_collection; extern Eina_Inlist *_edje_edjes; extern char*_edje_fontset_append; +extern char*_edje_fontset_append_escaped; extern FLOAT_T _edje_scale; extern int _edje_util_freeze_val; extern int _edje_util_freeze_calc_count; diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 555cab92c0..cebbd23677 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -168,7 +168,7 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) Eina_Strbuf *txt = NULL; Edje_Style_Tag *tag; Edje_Text_Class *tc; - char *fontset = NULL, *fontsource = NULL; + char *fontset = _edje_fontset_append_escaped, *fontsource = NULL; if (!ed->file) return; @@ -253,7 +253,6 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) eina_strbuf_append(txt, "'"); } - if (fontset) free(fontset); if (fontsource) free(fontsource); /* Configure the style */ @@ -448,11 +447,12 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) Eina_Strbuf *txt = NULL; Eina_List *l, *ll; Edje_Style *stl; + char *fontset = _edje_fontset_append_escaped; EINA_LIST_FOREACH(edf->styles, l, stl) { Edje_Style_Tag *tag; -char *fontset = NULL, *fontsource = NULL, *ts; +char *fontsource = NULL, *ts; if (stl->style) break; @@ -464,8 +464,6 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) stl->style = evas_textblock_style_new(); evas_textblock_style_set(stl->style, NULL); -if (_edje_fontset_append) - fontset = eina_str_escape(_edje_fontset_append); if (edf->fonts) fontsource = eina_str_escape(edf->path); @@ -495,8 +493,7 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) { if (fontset) { - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_fallbacks="); + eina_strbuf_append(txt, " font_fallbacks="); eina_strbuf_append(txt, fontset); } if (fontsource) @@ -510,7 +507,6 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) if (tag->text_class) stl->readonly = EINA_FALSE; } -if (fontset) free(fontset); if (fontsource) free(fontsource); /* Configure the style */ diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 2f6c5b2d22..0e74e79855 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -27,6 +27,7 @@ Efl_Observable *_edje_size_class_member = NULL; static Eina_Rbtree *_edje_box_layout_registry = NULL; char *_edje_fontset_append = NULL; +char *_edje_fontset_append_escaped = NULL; FLOAT_T _edje_scale = ZERO; Eina_Bool _edje_password_show_last = EINA_FALSE; double _edje_password_show_last_timeout = 0; @@ -357,8 +358,12 @@ EAPI void edje_fontset_append_set(const char *fonts) { if (_edje_fontset_append) - free(_edje_fontset_append); + { +free(_edje_fontset_append); +free(_edje_fontset_append_escaped); + } _edje_fontset_append = fonts ? strdup(fonts) : NULL; + _edje_fontset_append_escaped = fonts ? eina_str_escape(fonts) : NULL; } EAPI const char * --
[EGIT] [core/efl] master 01/01: edje/style: remove dead code.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d7d9ed856f93458badb8114f56650dfc257b4487 commit d7d9ed856f93458badb8114f56650dfc257b4487 Author: subhransu mohanty Date: Wed Aug 28 14:07:04 2019 +0900 edje/style: remove dead code. Summary: leftover from last refactoring. Reviewers: Hermet, ali.alzyod Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9763 --- src/lib/edje/edje_textblock_styles.c | 18 -- 1 file changed, 18 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 9f74b911db..f9495f24f6 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -247,24 +247,6 @@ _edje_textblock_style_search(Edje *ed, const char *style) return eina_hash_find(ed->file->style_hash, style); } -static inline void -_edje_textblock_style_member_add(Edje *ed, Edje_Style *stl) -{ - Edje_Style_Tag *tag; - Eina_List *l; - - if (!stl) return; - - EINA_LIST_FOREACH(stl->tags, l, tag) - { -if (tag->text_class) - efl_observable_observer_add(_edje_text_class_member, tag->text_class, ed->obj); - } -/* Newly added text_class member should be updated - according to the latest text_class's status. */ - _edje_textblock_style_update(ed, stl, EINA_TRUE); -} - static inline void _edje_textblock_style_observer_add(Edje_Style *stl, Efl_Observer* observer) { --
[EGIT] [core/efl] master 01/01: edje/style/optimization: Enable lazy computaion of styles.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e2663ba8f38c80dd583abb3ecc6ed8e2ab7c1a45 commit e2663ba8f38c80dd583abb3ecc6ed8e2ab7c1a45 Author: subhransu mohanty Date: Thu Aug 29 14:32:28 2019 +0900 edje/style/optimization: Enable lazy computaion of styles. Summary: As user request for the evas_textblock_style through _edje_textblock_style_get() api and that api implements lazy computation of the styles. By just marking the style dirty (stl->cache=false) will be enough. no need to calculate the style computaion at that time. Reviewers: Hermet, ali.alzyod, kimcinoo, woohyun Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9776 --- src/lib/edje/edje_textblock_styles.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index d9856ba7fb..4ceb3ae152 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -126,10 +126,11 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag *tag_ret, E * * @param ed The edje containing the given style which need to be updated * @param style The style which need to be updated - * @param force Update the given style forcely or not + * As now edje_style supports lazy computation of evas_textblock_style + * only call this function from _edje_textblock_style_get() */ void -_edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) +_edje_textblock_style_update(Edje *ed, Edje_Style *stl) { Eina_List *l; Eina_Strbuf *txt = NULL; @@ -142,11 +143,19 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) /* Make sure the style is already defined */ if (!stl->style) return; - /* we are sure it dosen't have any text_class */ - if (stl->readonly) return; + /* this check is only here to catch misuse of this function */ + if (stl->readonly) + { +ERR("style_update() shouldn't be called for readonly style. performance regression : %s", stl->name); +return; + } - /* No need to compute it again and again and again */ - if (!force && stl->cache) return; + /* this check is only here to catch misuse of this function */ + if (stl->cache) + { +ERR("style_update() shouldn't be called for cached style. performance regression : %s", stl->name); +return; + } if (!txt) txt = eina_strbuf_new(); @@ -282,7 +291,8 @@ _edje_textblock_style_add(Edje *ed, Edje_Style *stl) _edje_textblock_style_observer_add(stl, ed->obj); - _edje_textblock_style_update(ed, stl, EINA_TRUE); + // mark it dirty to recompute it later. + stl->cache = EINA_FALSE; } static inline void @@ -370,7 +380,7 @@ _edje_textblock_style_get(Edje *ed, const char *style) /* if style is dirty recompute */ if (!stl->cache) - _edje_textblock_style_update(ed, stl, EINA_FALSE); + _edje_textblock_style_update(ed, stl); return stl->style; } @@ -400,7 +410,9 @@ _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class) if (!strcmp(tag->text_class, text_class)) { - _edje_textblock_style_update(ed, stl, EINA_TRUE); + // just mark it dirty so the next request + // for this style will trigger recomputation. + stl->cache = EINA_FALSE; break; } } --
[EGIT] [core/efl] master 02/05: textblock/optimization: refactor evas_textblock_style for memory and perfromance.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9952b9bf182d2b27de05b82476649a1ed8c1785d commit 9952b9bf182d2b27de05b82476649a1ed8c1785d Author: subhransu mohanty Date: Mon Aug 12 02:42:27 2019 + textblock/optimization: refactor evas_textblock_style for memory and perfromance. the main user of textblock_style_set() api is the edje whcih keeps its owen edje_textblock_style tags( string_shared string) by changing the textblock to keep the string_shared string will improve the chance of sharing the same string hence reducing memory. By removing the Eina_StrBuf usage inside the loop in textblock_style_set() api we can avoid lot of temporary memory allocation and deallocation hence will improve performance. Note: I see lot of places we use Eina_Strbuf inside a loop (eina_strbuf_new() does 2 allocation) We need to be extra carefull while reviewing when the code uses those construct to see if its really necessary. Data: it reduces memory allocation by 7000 in elementary_test launch time. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9545 --- src/lib/evas/canvas/evas_object_textblock.c | 57 ++--- 1 file changed, 20 insertions(+), 37 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index 4f3f4d54eb..6ecc9b1112 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -307,8 +307,8 @@ typedef struct _Text_Item_Filter Text_Item_Filter; struct _Evas_Object_Style_Tag_Base { - char *tag; /**< Format Identifier: b=Bold, i=Italic etc. */ - char *replace; /**< Replacement string. "font_weight=Bold", "font_style=Italic" etc. */ + const char *tag; /**< Format Identifier: b=Bold, i=Italic etc. */ + const char *replace; /**< Replacement string. "font_weight=Bold", "font_style=Italic" etc. */ size_t tag_len; /**< Strlen of tag. */ }; @@ -552,7 +552,7 @@ struct _Evas_Object_Textblock_Format struct _Efl_Canvas_Text_Style { const char*style_text; - char *default_tag; + const char*default_tag; Evas_Object_Style_Tag *tags; Eina_List *objects; Eina_Bool delete_me : 1; @@ -874,15 +874,15 @@ static void _style_replace(Evas_Textblock_Style *ts, const char *style_text) { eina_stringshare_replace(>style_text, style_text); - if (ts->default_tag) free(ts->default_tag); + if (ts->default_tag) eina_stringshare_del(ts->default_tag); while (ts->tags) { Evas_Object_Style_Tag *tag; tag = (Evas_Object_Style_Tag *)ts->tags; ts->tags = (Evas_Object_Style_Tag *)eina_inlist_remove(EINA_INLIST_GET(ts->tags), EINA_INLIST_GET(tag)); -free(tag->tag.tag); -free(tag->tag.replace); +eina_stringshare_del(tag->tag.tag); +eina_stringshare_del(tag->tag.replace); free(tag); } ts->default_tag = NULL; @@ -7319,6 +7319,7 @@ evas_textblock_style_set(Evas_Textblock_Style *ts, const char *text) key_start = key_stop = val_start = NULL; p = ts->style_text; +Eina_Strbuf *tag_value_buf = eina_strbuf_new(); while (*p) { if (!key_start) @@ -7344,12 +7345,13 @@ evas_textblock_style_set(Evas_Textblock_Style *ts, const char *text) } if ((key_start) && (key_stop) && (val_start)) { - char *tags, *replaces = NULL; + const char *tag_value = NULL; Evas_Object_Style_Tag *tag; const char *val_stop = NULL; + + eina_strbuf_reset(tag_value_buf); size_t tag_len; { - Eina_Strbuf *buf = eina_strbuf_new(); val_stop = val_start; while(*p) { @@ -7358,72 +7360,53 @@ evas_textblock_style_set(Evas_Textblock_Style *ts, const char *text) /* Break if we found the tag end */ if (p[-1] != '\\') { - eina_strbuf_append_length(buf, val_stop, + eina_strbuf_append_length(tag_value_buf, val_stop, p - val_stop); break; } else { - eina_strbuf_append_length(buf, val_stop, +
[EGIT] [core/efl] master 01/01: elm/config: avoid unnecessary elm cache flush
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=10b2f65e606594616abc1acf2dd9db1277ed145c commit 10b2f65e606594616abc1acf2dd9db1277ed145c Author: subhransu mohanty Date: Thu Aug 22 08:14:13 2019 -0400 elm/config: avoid unnecessary elm cache flush Summary: in config_apply() we load the deafult theme and then elm_recache() just throws it away. so just move it before config_apply for time being. We need to revisit to check if we really need that elm_recache() in that function or not. Reviewers: Hermet, raster, cedric, zmike Reviewed By: zmike Subscribers: zmike, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9700 --- src/lib/elementary/elm_config.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/elementary/elm_config.c b/src/lib/elementary/elm_config.c index 5344f6681a..5624f0b125 100644 --- a/src/lib/elementary/elm_config.c +++ b/src/lib/elementary/elm_config.c @@ -2033,6 +2033,7 @@ _config_flush_get(void) _elm_config->is_mirrored = is_mirrored; _elm_config->translate = translate; + _elm_recache(); _config_apply(); _config_sub_apply(); evas_font_reinit(); @@ -2040,7 +2041,6 @@ _config_flush_get(void) _elm_config_color_overlay_apply(); if (pre_scale != _elm_config->scale) _elm_rescale(); - _elm_recache(); _elm_old_clouseau_reload(); _elm_config_key_binding_hash(); _elm_win_access(_elm_config->access_mode); @@ -4218,10 +4218,10 @@ _elm_config_init(void) ELM_SAFE_FREE(_elm_accel_preference, eina_stringshare_del); ELM_SAFE_FREE(_elm_gl_preference, eina_stringshare_del); _translation_init(); + _elm_recache(); _config_apply(); _elm_config_font_overlay_apply(); _elm_config_color_overlay_apply(); - _elm_recache(); _elm_old_clouseau_reload(); _elm_config_key_binding_hash(); } @@ -4402,6 +4402,7 @@ _elm_config_reload(void) _elm_config->is_mirrored = is_mirrored; _elm_config->translate = translate; + _elm_recache(); _config_apply(); _elm_config_font_overlay_apply(); _elm_config_color_overlay_apply(); @@ -4426,7 +4427,6 @@ _elm_config_reload(void) ) _elm_rescale(); #undef CMP - _elm_recache(); _elm_old_clouseau_reload(); _elm_config_key_binding_hash(); ecore_event_add(ELM_EVENT_CONFIG_ALL_CHANGED, NULL, NULL, NULL); @@ -4703,11 +4703,11 @@ _elm_config_profile_set(const char *profile) _elm_config->is_mirrored = is_mirrored; _elm_config->translate = translate; + _elm_recache(); _config_apply(); _elm_config_font_overlay_apply(); _elm_config_color_overlay_apply(); _elm_rescale(); - _elm_recache(); _elm_old_clouseau_reload(); _elm_config_key_binding_hash(); } --
[EGIT] [core/efl] master 01/01: edje: refactor _edje_object_file_set_internal() part 2.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4b511671de56f5a2bad29b84801a8cf68a72d8d8 commit 4b511671de56f5a2bad29b84801a8cf68a72d8d8 Author: subhransu mohanty Date: Wed Aug 28 16:23:55 2019 +0900 edje: refactor _edje_object_file_set_internal() part 2. Summary: - split functionality into smaller helper class _edje_process_colorclass() , _edje_process_sizeclass() and _edje_process_physics() for easy redability and maintenance. Reviewers: Hermet, zmike Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9764 --- src/lib/edje/edje_load.c | 142 +++ 1 file changed, 82 insertions(+), 60 deletions(-) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 4039bd562a..9c6193a3c1 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -684,6 +684,85 @@ _edje_devices_add(Edje *ed, Evas *tev) _edje_device_changed_cb, ed); } +static inline void +_edje_process_colorclass(Edje *ed) +{ + unsigned int i; + + for (i = 0; i < ed->collection->parts_count; ++i) + { +Edje_Part *ep; +unsigned int k; + +ep = ed->collection->parts[i]; + +/* Register any color classes in this parts descriptions. */ +if ((ep->default_desc) && (ep->default_desc->color_class)) + efl_observable_observer_add(_edje_color_class_member, ep->default_desc->color_class, ed->obj); + +for (k = 0; k < ep->other.desc_count; k++) + { + Edje_Part_Description_Common *desc; + + desc = ep->other.desc[k]; + + if (desc->color_class) + efl_observable_observer_add(_edje_color_class_member, desc->color_class, ed->obj); + } + } +} + +static inline void +_edje_process_sizeclass(Edje *ed) +{ + unsigned int i; + + for (i = 0; i < ed->collection->parts_count; ++i) + { +Edje_Part *ep; +unsigned int k; + +ep = ed->collection->parts[i]; + +/* Register any size classes in this parts descriptions. */ +if ((ep->default_desc) && (ep->default_desc->size_class)) + efl_observable_observer_add(_edje_size_class_member, ep->default_desc->size_class, ed->obj); + +for (k = 0; k < ep->other.desc_count; k++) + { + Edje_Part_Description_Common *desc; + + desc = ep->other.desc[k]; + + if (desc->size_class) + efl_observable_observer_add(_edje_size_class_member, desc->size_class, ed->obj); + } + } +} + +static inline void +_edje_process_physics(Edje *ed) +{ +#ifdef HAVE_EPHYSICS + if (EPH_LOAD()) + { +EPH_CALL(ephysics_init)(); +ed->world = EPH_CALL(ephysics_world_new)(); +EPH_CALL(ephysics_world_event_callback_add) + (ed->world, EPHYSICS_CALLBACK_WORLD_UPDATE, + _edje_physics_world_update_cb, ed); +EPH_CALL(ephysics_world_rate_set) + (ed->world, ed->collection->physics.world.rate); +EPH_CALL(ephysics_world_gravity_set) + (ed->world, ed->collection->physics.world.gravity.x, + ed->collection->physics.world.gravity.y, + ed->collection->physics.world.gravity.z); + } +#else + ERR("Edje compiled without support to physics."); +#endif +} + Eina_Error _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const char *group, const char *parent, Eina_List *group_path, Eina_Array *nested) { @@ -777,74 +856,17 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch unsigned int i; if (ed->collection->physics_enabled) -#ifdef HAVE_EPHYSICS - { - if (EPH_LOAD()) -{ - EPH_CALL(ephysics_init)(); - ed->world = EPH_CALL(ephysics_world_new)(); - EPH_CALL(ephysics_world_event_callback_add) - (ed->world, EPHYSICS_CALLBACK_WORLD_UPDATE, - _edje_physics_world_update_cb, ed); - EPH_CALL(ephysics_world_rate_set) - (ed->world, ed->collection->physics.world.rate); - EPH_CALL(ephysics_world_gravity_set) - (ed->world, ed->collection->physics.world.gravity.x, - ed->collection->physics.world.gravity.y, - ed->collection->physics.world.gravity.z); -} - } -#else - ERR("Edje compiled without support to physi
[EGIT] [core/efl] master 02/02: edje/cache: Refactor _edje_cache_file_coll_open()
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=02b63b8260063d5185f82affd587874b2d49e8f9 commit 02b63b8260063d5185f82affd587874b2d49e8f9 Author: subhransu mohanty Date: Mon Aug 26 08:08:29 2019 -0400 edje/cache: Refactor _edje_cache_file_coll_open() Summary: This function does lot of things - can be called only to load the file (by passing coll as null) - can be called to load both file and open the collection from the file. - handles the file_cache logic - handles fixing the collection after reading from file. this patch is targeting to split the responsibility to smaller function for easy maintenance and code readability. future patch to follow for splitting the file opening and collection opening to two different function. Reviewers: Hermet, raster, cedric, zmike Reviewed By: zmike Subscribers: zmike, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9715 --- src/lib/edje/edje_cache.c | 270 +- 1 file changed, 150 insertions(+), 120 deletions(-) diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index c1d39f7543..986ee71ab9 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -156,6 +156,103 @@ _edje_programs_patterns_init(Edje_Part_Collection *edc) ssp->sources_patterns = edje_match_programs_source_init(all, j); } +static inline void +_edje_part_collection_fix(Edje_Part_Collection *edc) +{ + if (edc->checked) return; + + edc->checked = 1; + + unsigned int j; + Edje_Part *ep; + Eina_List *hist; + + for (j = 0; j < edc->parts_count; ++j) + { +Edje_Part *ep2; +ep = edc->parts[j]; + +/* Register any color classes in this parts descriptions. */ +hist = NULL; +hist = eina_list_append(hist, ep); +ep2 = ep; +while (ep2->dragable.confine_id >= 0) + { + if (ep2->dragable.confine_id >= (int)edc->parts_count) + { + ERR("confine_to above limit. invalidating it."); + ep2->dragable.confine_id = -1; + break; + } + + ep2 = edc->parts[ep2->dragable.confine_id]; + if (eina_list_data_find(hist, ep2)) + { + ERR("confine_to loops. invalidating loop."); + ep2->dragable.confine_id = -1; + break; + } + hist = eina_list_append(hist, ep2); + } +eina_list_free(hist); +hist = NULL; +hist = eina_list_append(hist, ep); +ep2 = ep; +while (ep2->dragable.event_id >= 0) + { + Edje_Part *prev; + + if (ep2->dragable.event_id >= (int)edc->parts_count) + { + ERR("event_id above limit. invalidating it."); + ep2->dragable.event_id = -1; + break; + } + prev = ep2; + + ep2 = edc->parts[ep2->dragable.event_id]; + /* events_to may be used only with dragable */ + if (!ep2->dragable.x && !ep2->dragable.y) + { + prev->dragable.event_id = -1; + break; + } + + if (eina_list_data_find(hist, ep2)) + { + ERR("events_to loops. invalidating loop."); + ep2->dragable.event_id = -1; + break; + } + hist = eina_list_append(hist, ep2); + } +eina_list_free(hist); +hist = NULL; +hist = eina_list_append(hist, ep); +ep2 = ep; +while (ep2->clip_to_id >= 0) + { + if (ep2->clip_to_id >= (int)edc->parts_count) + { + ERR("clip_to_id above limit. invalidating it."); + ep2->clip_to_id = -1; + break; + } + + ep2 = edc->parts[ep2->clip_to_id]; + if (eina_list_data_find(hist, ep2)) + { + ERR("clip_to loops. invalidating loop."); + ep2->clip_to_id = -1; + break; + } + hist = eina_list_append(hist, ep2); + } +eina_list_free(hist); +hist = NULL; + } +} + static Edje_Part_Collection * _edje_file_coll_open(Edje_File *edf, const char *coll) { @@ -284,6 +381,8 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) } } + _edje_part_collection_fix(edc); + return edc; } @@ -463,30 +562,21 @@ _edje_file_dangling(Edje_File *edf) #endi
[EGIT] [core/efl] master 01/01: eina/hash: optimize eina_hash_find() when hash is empty.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=da39f53b95c9bae298fb0145f152c2d81b5ebe31 commit da39f53b95c9bae298fb0145f152c2d81b5ebe31 Author: subhransu mohanty Date: Fri Aug 9 14:00:03 2019 +0900 eina/hash: optimize eina_hash_find() when hash is empty. Summary: Check if hash is empty before computing the hash key and look inside the hash to find data. Note: could have called the eina_hash_population() api but didn't because of extra function call. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9531 --- src/lib/eina/eina_hash.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/eina/eina_hash.c b/src/lib/eina/eina_hash.c index 92c37e1968..64d298b513 100644 --- a/src/lib/eina/eina_hash.c +++ b/src/lib/eina/eina_hash.c @@ -1077,6 +1077,9 @@ eina_hash_find(const Eina_Hash *hash, const void *key) EINA_SAFETY_ON_NULL_RETURN_VAL(key, NULL); EINA_MAGIC_CHECK_HASH(hash); + if (hash->population == 0) + return NULL; + _eina_hash_compute(hash, key, _length, _hash); return eina_hash_find_by_hash(hash, key, key_length, key_hash); --
[EGIT] [core/efl] master 01/03: edje/optimization: replace eina_list with eina_array.
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fcc235b3297d1e1cc738543e4a803d31e474b6d4 commit fcc235b3297d1e1cc738543e4a803d31e474b6d4 Author: subhransu mohanty Date: Tue Aug 27 07:42:14 2019 -0400 edje/optimization: replace eina_list with eina_array. Summary: We were creating 3 eina_list and destroying inside a for loop. replace that with creating a single eina_array at start and use eina_array_clean() function ro reuse the array. Reviewers: Hermet, zmike, cedric, raster Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9745 --- src/lib/edje/edje_cache.c | 35 ++- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index 986ee71ab9..24e18b20c6 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -165,7 +165,9 @@ _edje_part_collection_fix(Edje_Part_Collection *edc) unsigned int j; Edje_Part *ep; - Eina_List *hist; + Eina_Array hist; + + eina_array_step_set(, sizeof(Eina_Array), 5); for (j = 0; j < edc->parts_count; ++j) { @@ -173,8 +175,7 @@ _edje_part_collection_fix(Edje_Part_Collection *edc) ep = edc->parts[j]; /* Register any color classes in this parts descriptions. */ -hist = NULL; -hist = eina_list_append(hist, ep); +eina_array_push(, ep); ep2 = ep; while (ep2->dragable.confine_id >= 0) { @@ -186,17 +187,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc) } ep2 = edc->parts[ep2->dragable.confine_id]; - if (eina_list_data_find(hist, ep2)) + if (eina_array_find(, ep2, NULL)) { ERR("confine_to loops. invalidating loop."); ep2->dragable.confine_id = -1; break; } - hist = eina_list_append(hist, ep2); + eina_array_push(, ep2); } -eina_list_free(hist); -hist = NULL; -hist = eina_list_append(hist, ep); +eina_array_clean(); + +eina_array_push(, ep); ep2 = ep; while (ep2->dragable.event_id >= 0) { @@ -218,17 +219,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc) break; } - if (eina_list_data_find(hist, ep2)) + if (eina_array_find(, ep2, NULL)) { ERR("events_to loops. invalidating loop."); ep2->dragable.event_id = -1; break; } - hist = eina_list_append(hist, ep2); + eina_array_push(, ep2); } -eina_list_free(hist); -hist = NULL; -hist = eina_list_append(hist, ep); +eina_array_clean(); + +eina_array_push(, ep); ep2 = ep; while (ep2->clip_to_id >= 0) { @@ -240,17 +241,17 @@ _edje_part_collection_fix(Edje_Part_Collection *edc) } ep2 = edc->parts[ep2->clip_to_id]; - if (eina_list_data_find(hist, ep2)) + if (eina_array_find(, ep2, NULL)) { ERR("clip_to loops. invalidating loop."); ep2->clip_to_id = -1; break; } - hist = eina_list_append(hist, ep2); + eina_array_push(, ep2); } -eina_list_free(hist); -hist = NULL; +eina_array_clean(); } + eina_array_flush(); } static Edje_Part_Collection * --
[EGIT] [core/efl] master 01/01: ecore_con/memleak: due to checking refcount using postfix decrement operator
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=862a460e7fe30b35dab3c249e0e0bfb680340824 commit 862a460e7fe30b35dab3c249e0e0bfb680340824 Author: subhransu mohanty Date: Fri Aug 23 11:09:42 2019 +0900 ecore_con/memleak: due to checking refcount using postfix decrement operator Reviewers: Hermet, raster, cedric Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9716 --- src/lib/ecore_con/ecore_con_url_curl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ecore_con/ecore_con_url_curl.c b/src/lib/ecore_con/ecore_con_url_curl.c index 6e8d9e73c3..4217f914d8 100644 --- a/src/lib/ecore_con/ecore_con_url_curl.c +++ b/src/lib/ecore_con/ecore_con_url_curl.c @@ -347,7 +347,7 @@ error: void _c_shutdown(void) { - if (!_c || _c->ref--) return; + if (!_c || --_c->ref) return; if (_c->_curlm) { _c->curl_multi_cleanup(_c->_curlm); --
[EGIT] [core/efl] master 03/03: edje/load: pass Edje_File instead of Edje to _edje_extract_mo_files()
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=05ea1854a9218306e27c64f9bf16cd623abf69a2 commit 05ea1854a9218306e27c64f9bf16cd623abf69a2 Author: subhransu mohanty Date: Tue Aug 27 08:04:43 2019 -0400 edje/load: pass Edje_File instead of Edje to _edje_extract_mo_files() Summary: Why : 1. The function operates on the Edje_File level not on Edje object level , so express it clearly in the function argument. 2. if its clear that this function works on file level then this should be called when the theme file loaded for the first time not on every Edje object creation. Reviewers: Hermet, zmike, raster, cedric Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9753 --- src/lib/edje/edje_load.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index d5f8d43019..e1b3085eea 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -53,7 +53,7 @@ _edje_smart_nested_smart_class_new(void) } void -_edje_extract_mo_files(Edje *ed) +_edje_extract_mo_files(Edje_File *edf) { Eina_Strbuf *mo_id_str; const void *data; @@ -67,19 +67,19 @@ _edje_extract_mo_files(Edje *ed) cache_path = efreet_cache_home_get(); - t = eina_file_mtime_get(ed->file->f); - sz = eina_file_size_get(ed->file->f); - filename = eina_file_filename_get(ed->file->f); + t = eina_file_mtime_get(edf->f); + sz = eina_file_size_get(edf->f); + filename = eina_file_filename_get(edf->f); crc = eina_crc(filename, strlen(filename), 0x, EINA_TRUE); - snprintf(ed->file->fid, sizeof(ed->file->fid), "%lld-%lld-%x", + snprintf(edf->fid, sizeof(edf->fid), "%lld-%lld-%x", (long long int)t, (long long int)sz, crc); mo_id_str = eina_strbuf_new(); - for (i = 0; i < ed->file->mo_dir->mo_entries_count; i++) + for (i = 0; i < edf->mo_dir->mo_entries_count; i++) { Edje_Mo *mo_entry; char out[PATH_MAX + PATH_MAX + 128]; @@ -87,13 +87,13 @@ _edje_extract_mo_files(Edje *ed) char *sub_str; char *mo_src; -mo_entry = >file->mo_dir->mo_entries[i]; +mo_entry = >mo_dir->mo_entries[i]; eina_strbuf_append_printf(mo_id_str, "edje/mo/%i/%s/LC_MESSAGES", mo_entry->id, mo_entry->locale); -data = eet_read_direct(ed->file->ef, +data = eet_read_direct(edf->ef, eina_strbuf_string_get(mo_id_str), ); @@ -110,10 +110,10 @@ _edje_extract_mo_files(Edje *ed) sub_str[1] = 'm'; snprintf(out, sizeof(out), "%s/%s-%s", - outdir, ed->file->fid, mo_src); + outdir, edf->fid, mo_src); if (ecore_file_exists(out)) { - if (ed->file->mtime > ecore_file_mod_time(out)) + if (edf->mtime > ecore_file_mod_time(out)) ecore_file_remove(out); } if (!ecore_file_exists(out)) @@ -847,7 +847,7 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch ed->has_entries = EINA_FALSE; if (ed->file && ed->file->mo_dir) - _edje_extract_mo_files(ed); + _edje_extract_mo_files(ed->file); if (ed->collection) { --
[EGIT] [core/efl] master 02/02: edje/style: append file prefix to textblock_style api that affects on file level
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=35e385a1ec8d5193922ff478eb8fbf6f0cb6332e commit 35e385a1ec8d5193922ff478eb8fbf6f0cb6332e Author: subhransu mohanty Date: Thu Aug 29 10:07:25 2019 -0400 edje/style: append file prefix to textblock_style api that affects on file level Summary: All those api's are working on the Edje_file level so by appending the file prefix and changing the argument to Edje_File leads to easy maintainability. Depends on D9776 Reviewers: Hermet, ali.alzyod, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9777 --- src/lib/edje/edje_cache.c| 2 +- src/lib/edje/edje_load.c | 2 +- src/lib/edje/edje_private.h | 8 src/lib/edje/edje_smart.c| 2 +- src/lib/edje/edje_textblock_styles.c | 16 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index a48ee85549..20ae174f5d 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -562,7 +562,7 @@ _edje_file_open(const Eina_File *f, int *error_ret, time_t mtime, Eina_Bool coll edf->references = 1; /* This should be done at edje generation time */ - _edje_textblock_style_parse_and_fix(edf); + _edje_file_textblock_style_parse_and_fix(edf); edf->style_hash = eina_hash_string_small_new(NULL); EINA_LIST_FOREACH(edf->styles, l, stl) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 176cc3bbbc..d719b10a98 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2280,7 +2280,7 @@ _edje_file_free(Edje_File *edf) if (edf->free_strings && edf->compiler) eina_stringshare_del(edf->compiler); if (edf->free_strings) eina_stringshare_del(edf->id); eina_hash_free(edf->style_hash); - _edje_textblock_style_cleanup(edf); + _edje_file_textblock_style_cleanup(edf); if (edf->ef) eet_close(edf->ef); if (edf->f) eina_file_close(edf->f); // close matching open (in _edje_file_open) OK free(edf); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 55ccd4d621..3487f2 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2793,10 +2793,10 @@ void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep); void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt); // Edje File level textblock style api -void _edje_textblock_style_all_update(Edje *ed); -void _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class); -void _edje_textblock_style_parse_and_fix(Edje_File *edf); -void _edje_textblock_style_cleanup(Edje_File *edf); +void _edje_file_textblock_style_all_update(Edje_File *ed); +void _edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *text_class); +void _edje_file_textblock_style_parse_and_fix(Edje_File *edf); +void _edje_file_textblock_style_cleanup(Edje_File *edf); Edje_File *_edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed); void _edje_cache_coll_clean(Edje_File *edf); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 3a25b75208..16e4dbd7d8 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -504,7 +504,7 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object } else if (obs == _edje_text_class_member) { -_edje_textblock_style_all_update_text_class(ed, key); +_edje_file_textblock_style_all_update_text_class(ed->file, key); #ifdef EDJE_CALC_CACHE ed->text_part_change = EINA_TRUE; #endif diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 09a033986f..22bc7aef4b 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -237,14 +237,14 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl) * @param ed The edje containing styles which need to be updated */ void -_edje_textblock_style_all_update(Edje *ed) +_edje_file_textblock_style_all_update(Edje_File *edf) { Eina_List *l; Edje_Style *stl; - if (!ed->file) return; + if (!edf) return; - EINA_LIST_FOREACH(ed->file->styles, l, stl) + EINA_LIST_FOREACH(edf->styles, l, stl) if (stl && !stl->readonly) stl->cache = EINA_FALSE; } @@ -390,15 +390,15 @@ _edje_textblock_style_get(Edje *ed, const char *style) * updates them. */ void -_edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class) +_edje_file_textblock_style_all_update_text_class(Edje_File *edf, const char *text_class) { Eina_List *l, *ll; Edje_Style *stl; - if (!ed->file)
[EGIT] [core/efl] master 01/01: edje/style: Remove redundant style tags from style text.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7ab04abf27464ddea69a68cc521a4c93681c6a7d commit 7ab04abf27464ddea69a68cc521a4c93681c6a7d Author: subhransu mohanty Date: Tue Aug 13 11:17:28 2019 +0900 edje/style: Remove redundant style tags from style text. Summary: Both font and font_size are already added into the style text in _edje_format_reparse() function and there we update the tag->font_size as well as tag->font member. so I think it is unnecessary to add again which has memory as well as parsing performance impact. Note : someone please update this cryptic comment /* Add font name last to save evas from multiple loads */ how this is going to help saving multiple load. Reviewers: ali.alzyod, Hermet, raster, cedric Reviewed By: Hermet Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9543 --- src/lib/edje/edje_textblock_styles.c | 16 1 file changed, 16 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 1b7e94b6a1..e83a21d227 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -515,22 +515,6 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) eina_strbuf_append(txt, fontsource); } } - if (tag->font_size > 0) - { - char font_size[32]; - - snprintf(font_size, sizeof(font_size), "%f", tag->font_size); - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_size="); - eina_strbuf_append(txt, font_size); - } - /* Add font name last to save evas from multiple loads */ - if (tag->font) - { - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font="); - eina_strbuf_append_escaped(txt, tag->font); - } eina_strbuf_append(txt, "'"); } if (fontset) free(fontset); --
[EGIT] [core/efl] master 01/01: edje: refactor _edje_object_file_set_internal() function
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4b2403d80cd3259c3c2fb2c667c6b1d1c15cab19 commit 4b2403d80cd3259c3c2fb2c667c6b1d1c15cab19 Author: subhransu mohanty Date: Wed Aug 28 13:18:42 2019 +0900 edje: refactor _edje_object_file_set_internal() function Summary: move the file related function to edje_cache so that code is easy to read and maintainable and we don't have to do unnecessary stuff for each edje object creation. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9761 --- src/lib/edje/edje_cache.c | 103 ++ src/lib/edje/edje_load.c | 98 --- 2 files changed, 103 insertions(+), 98 deletions(-) diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index 24e18b20c6..a48ee85549 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -387,6 +387,93 @@ _edje_file_coll_open(Edje_File *edf, const char *coll) return edc; } +void +_edje_extract_mo_files(Edje_File *edf) +{ + Eina_Strbuf *mo_id_str; + const void *data; + const char *cache_path; + const char *filename; + unsigned int crc; + time_t t; + size_t sz; + unsigned int i; + int len; + + cache_path = efreet_cache_home_get(); + + t = eina_file_mtime_get(edf->f); + sz = eina_file_size_get(edf->f); + filename = eina_file_filename_get(edf->f); + crc = eina_crc(filename, strlen(filename), 0x, EINA_TRUE); + + snprintf(edf->fid, sizeof(edf->fid), "%lld-%lld-%x", +(long long int)t, +(long long int)sz, +crc); + + mo_id_str = eina_strbuf_new(); + + for (i = 0; i < edf->mo_dir->mo_entries_count; i++) + { +Edje_Mo *mo_entry; +char out[PATH_MAX + PATH_MAX + 128]; +char outdir[PATH_MAX]; +char *sub_str; +char *mo_src; + +mo_entry = >mo_dir->mo_entries[i]; + +eina_strbuf_append_printf(mo_id_str, + "edje/mo/%i/%s/LC_MESSAGES", + mo_entry->id, + mo_entry->locale); +data = eet_read_direct(edf->ef, + eina_strbuf_string_get(mo_id_str), + ); + +if (data) + { + snprintf(outdir, sizeof(outdir), + "%s/edje/%s/LC_MESSAGES", + cache_path, mo_entry->locale); + ecore_file_mkpath(outdir); + mo_src = strdup(mo_entry->mo_src); + sub_str = strstr(mo_src, ".po"); + + if (sub_str) + sub_str[1] = 'm'; + + snprintf(out, sizeof(out), "%s/%s-%s", + outdir, edf->fid, mo_src); + if (ecore_file_exists(out)) + { + if (edf->mtime > ecore_file_mod_time(out)) +ecore_file_remove(out); + } + if (!ecore_file_exists(out)) + { + FILE *f; + + f = fopen(out, "wb"); + if (f) +{ + if (fwrite(data, len, 1, f) != 1) + ERR("Could not write mo: %s: %s", out, strerror(errno)); + fclose(f); +} + else +ERR("Could not open for writing mo: %s: %s", out, strerror(errno)); + } + free(mo_src); + } + +eina_strbuf_reset(mo_id_str); + } + + eina_strbuf_free(mo_id_str); +} + // XXX: this is not pretty. some oold edje files do not store strings // in their dictionary for hashes. this works around crashes loading such // files @@ -542,6 +629,22 @@ _edje_file_open(const Eina_File *f, int *error_ret, time_t mtime, Eina_Bool coll } } + if (edf->external_dir) + { +unsigned int i; + +for (i = 0; i < edf->external_dir->entries_count; ++i) + edje_module_load(edf->external_dir->entries[i].entry); + } + + // this call is unnecessary as we are doing same opeartion + // inside _edje_textblock_style_parse_and_fix() function + // remove ?? + //_edje_textblock_style_all_update(ed); + + if (edf->mo_dir) + _edje_extract_mo_files(edf); + return edf; } diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index e1b3085eea..4039bd562a 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -52,93 +52,6 @@ _edje_smart_nested_smart_class_new(void) return smart; } -void -_edje_extract_mo_files(Edje_File *edf) -{ - Eina_Strbuf
[EGIT] [core/efl] master 01/01: edje/optimization: refactor edje_color_class_set() api.
zmike pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5370c2e7957cfec1b4bf8eff65dfe0e7a6547263 commit 5370c2e7957cfec1b4bf8eff65dfe0e7a6547263 Author: subhransu mohanty Date: Thu Aug 29 14:31:52 2019 -0400 edje/optimization: refactor edje_color_class_set() api. Summary: During _elm_config_color_overlay_apply() application can call this api 100's of time depending on how many overlay it wants add . As each color_class set triggers the global color class apply chain 3 times (for color , outline and shadow) just club them once and emit single color_class,set event. Reviewers: Hermet, ali.alzyod, zmike Reviewed By: zmike Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9784 --- src/lib/edje/edje_util.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 0e74e79855..450015f8d6 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -680,13 +680,21 @@ _edje_color_class_get_internal(Edje_Color_Class *cc, Efl_Gfx_Color_Class_Layer l EAPI Eina_Bool edje_color_class_set(const char *color_class, int r, int g, int b, int a, int r2, int g2, int b2, int a2, int r3, int g3, int b3, int a3) { - Eina_Bool int_ret = EINA_TRUE; + Eina_Bool result = EINA_TRUE; + Eina_Bool normal = EINA_FALSE , outline = EINA_FALSE , shadow = EINA_FALSE; - int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a); - int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2); - int_ret &= efl_gfx_color_class_set(_edje_global(), color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3); + if (!_edje_color_class_hash) + _edje_color_class_hash = eina_hash_string_superfast_new(NULL); - return int_ret; + result &= _edje_color_class_set_internal(_edje_color_class_hash, color_class, EFL_GFX_COLOR_CLASS_LAYER_NORMAL, r, g, b, a, ); + result &= _edje_color_class_set_internal(_edje_color_class_hash, color_class, EFL_GFX_COLOR_CLASS_LAYER_OUTLINE, r2, g2, b2, a2, ); + result &= _edje_color_class_set_internal(_edje_color_class_hash, color_class, EFL_GFX_COLOR_CLASS_LAYER_SHADOW, r3, g3, b3, a3, ); + + // either of them changes then request an update. + if (result && (normal || outline || shadow)) + efl_observable_observers_update(_edje_color_class_member, color_class, "color_class,set"); + + return result; } EOLIAN Eina_Bool --
[EGIT] [core/efl] master 01/01: edje/style: fix memory leak because of typo.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=cce73a2b4b36b9f4792c29535b8207e788399fe1 commit cce73a2b4b36b9f4792c29535b8207e788399fe1 Author: subhransu mohanty Date: Thu Aug 22 14:22:22 2019 +0900 edje/style: fix memory leak because of typo. Summary: We already have a escaped string for the font_source so this code is unnecessary. Reviewers: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9698 --- src/lib/edje/edje_textblock_styles.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index ece7b76e93..e4ceebecb5 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -151,8 +151,6 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) if (!txt) txt = eina_strbuf_new(); - if (_edje_fontset_append) - fontset = eina_str_escape(_edje_fontset_append); if (ed->file->fonts) fontsource = eina_str_escape(ed->file->path); --
[EGIT] [core/efl] master 01/01: evas/textblock: optmize textblock format parsing.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9e3a0466617dad31c611cc826fa67f66ac08dce1 commit 9e3a0466617dad31c611cc826fa67f66ac08dce1 Author: subhransu mohanty Date: Fri Aug 9 17:36:35 2019 +0900 evas/textblock: optmize textblock format parsing. Summary: textblock format parsing creates/delets eina_TempStr for each token. Eina_TempStr is even worse than malloc/free because it also takes a lock/unlock along with malloc/free each time we create it. Just use a stack bufefr and create string in it if the string is too big then it will fall back to heap which is anyway we are doing right now. Tested this in Tizen List view the number of allocation reduced by 16000. Reviewers: Hermet, ali.alzyod, woohyun Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9534 --- src/lib/evas/canvas/evas_object_textblock.c | 115 +++- 1 file changed, 97 insertions(+), 18 deletions(-) diff --git a/src/lib/evas/canvas/evas_object_textblock.c b/src/lib/evas/canvas/evas_object_textblock.c index e069e04ce7..4f3f4d54eb 100644 --- a/src/lib/evas/canvas/evas_object_textblock.c +++ b/src/lib/evas/canvas/evas_object_textblock.c @@ -1728,13 +1728,13 @@ _format_command_shutdown(void) * @param[in] src the source string - Should not be NULL. */ static int -_format_clean_param(Eina_Tmpstr *s) +_format_clean_param(char *s) { - Eina_Tmpstr *ss; + char *ss; char *ds; int len = 0; - ds = (char*) s; + ds = s; for (ss = s; *ss; ss++, ds++, len++) { if ((*ss == '\\') && *(ss + 1)) ss++; @@ -1752,10 +1752,10 @@ _format_clean_param(Eina_Tmpstr *s) * @param obj the evas object - should not be NULL. * @param fmt The format to populate - should not be NULL. * @param[in] cmd the command to process, should be stringshared. - * @param[in] param the parameter of the command. + * @param[in] param the parameter of the command. may modify the string. */ static void -_format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char *cmd, Eina_Tmpstr *param) +_format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const char *cmd, char *param) { int len; @@ -2847,6 +2847,77 @@ _format_command(Evas_Object *eo_obj, Evas_Object_Textblock_Format *fmt, const ch } } +/* + * @internal + * just to create a constant without using marco + * 2 cacheline is enough for the string we parse + * usually color or color_class strings. + * reduce it if this number is too high. + */ +enum _Internal{ ALLOCATOR_SIZE = 120 }; + +/* + * @internal + * A simple stack allocator which first + * tries to create a string in the stack (buffer + * it holds). if the string size is bigger than its + * buffer capacity it will fall back to creating the + * string on heap. + * USAGE : + * Allocator a; + * _allocator_init(); + * _allocator_make_string(, "hello world", 11); + * ... //use the string + * ._allocator_reset(); + * Always call _allocator_reset() after + * you done with the string. + */ +typedef struct _Allocator +{ + char stack[ALLOCATOR_SIZE]; + char *heap; +} Allocator; + +static inline void +_allocator_init(Allocator* allocator) +{ + if (allocator) allocator->heap = NULL; +} + +static inline void +_allocator_reset(Allocator* allocator) +{ + if (allocator && allocator->heap) + { +free(allocator->heap); +allocator->heap = NULL; + } +} + +static char * +_allocator_make_string(Allocator* allocator, const char* str, size_t size) +{ + if (!allocator) return NULL; + if (!size) return NULL; + + if (size + 1 < ALLOCATOR_SIZE) + { +memcpy(allocator->stack, str, size); +allocator->stack[size] = '\0'; +return allocator->stack; + } + //fallback to heap + if (allocator->heap) free(allocator->heap); + + allocator->heap = malloc(size + 1); + + if (!allocator->heap) return NULL; + + memcpy(allocator->heap, str, size); + allocator->heap[size] = '\0'; + return allocator->heap; +} + /** * @internal * Returns @c EINA_TRUE if the item is a format parameter, @c EINA_FALSE @@ -2872,15 +2943,15 @@ _format_is_param(const char *item) * @param[out] key where to store the key at - Not NULL. * @param[out] val where to store the value at - Not NULL. */ -static void -_format_param_parse(const char *item, const char **key, Eina_Tmpstr **val) +static Eina_Bool +_format_param_parse(const char *item, const char **key, char **val, Allocator *allocator) { const char *start, *end; char *tmp, *s, *d; size_t len; start = strchr(item, '='); - if (!start) return ; + if (!start) return EINA_FALSE; *key = eina_stringshare_add_length(item, start - item); start++; /* Advance after the '=' */ /*
[EGIT] [core/efl] master 01/01: edje/style: optimize style_update function.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e742bf67e441dde4e10d6a01f8aa46406389c2ef commit e742bf67e441dde4e10d6a01f8aa46406389c2ef Author: subhransu mohanty Date: Mon Aug 26 14:18:09 2019 +0900 edje/style: optimize style_update function. Summary: If the style is readonly then we know for sure it dosen't have any text_class/color_class. If a style has text_class tag then call update only once not for each text_class tag it has. Reviewers: ali.alzyod, Hermet, cedric, raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9641 --- src/lib/edje/edje_textblock_styles.c | 84 +++- 1 file changed, 55 insertions(+), 29 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 7ac8bfa4cd..9f74b911db 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -258,16 +258,59 @@ _edje_textblock_style_member_add(Edje *ed, Edje_Style *stl) EINA_LIST_FOREACH(stl->tags, l, tag) { if (tag->text_class) - { - efl_observable_observer_add(_edje_text_class_member, tag->text_class, ed->obj); + efl_observable_observer_add(_edje_text_class_member, tag->text_class, ed->obj); + } +/* Newly added text_class member should be updated + according to the latest text_class's status. */ + _edje_textblock_style_update(ed, stl, EINA_TRUE); +} - /* Newly added text_class member should be updated -according to the latest text_class's status. */ - _edje_textblock_style_update(ed, stl, EINA_TRUE); - } +static inline void +_edje_textblock_style_observer_add(Edje_Style *stl, Efl_Observer* observer) +{ + Eina_List* l; + Edje_Style_Tag *tag; + + EINA_LIST_FOREACH(stl->tags, l, tag) + { +if (tag->text_class) + efl_observable_observer_add(_edje_text_class_member, tag->text_class, observer); + } +} + +static inline void +_edje_textblock_style_observer_del(Edje_Style *stl, Efl_Observer* observer) +{ + Eina_List* l; + Edje_Style_Tag *tag; + + EINA_LIST_FOREACH(stl->tags, l, tag) + { +if (tag->text_class) + efl_observable_observer_del(_edje_text_class_member, tag->text_class, observer); } } +static inline void +_edje_textblock_style_add(Edje *ed, Edje_Style *stl) +{ + if (!stl) return; + + if (stl->readonly) return; + + _edje_textblock_style_observer_add(stl, ed->obj); + + _edje_textblock_style_update(ed, stl, EINA_TRUE); +} + +static inline void +_edje_textblock_style_del(Edje *ed, Edje_Style *stl) +{ + if (!stl) return; + + _edje_textblock_style_observer_del(stl, ed->obj); +} + void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep) { @@ -284,7 +327,8 @@ _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep) desc = (Edje_Part_Description_Text *)pt->default_desc; style = edje_string_get(>text.style); stl = _edje_textblock_style_search(ed, style); - _edje_textblock_style_member_add(ed, stl); + + _edje_textblock_style_add(ed, stl); /* If any other classes exist add them */ for (i = 0; i < pt->other.desc_count; ++i) @@ -292,7 +336,8 @@ _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep) desc = (Edje_Part_Description_Text *)pt->other.desc[i]; style = edje_string_get(>text.style); stl = _edje_textblock_style_search(ed, style); -_edje_textblock_style_member_add(ed, stl); + +_edje_textblock_style_add(ed, stl); } } @@ -311,34 +356,15 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt) stl = _edje_textblock_style_search(ed, style); - if (stl) - { -Edje_Style_Tag *tag; -Eina_List *l; - -EINA_LIST_FOREACH(stl->tags, l, tag) - { - if (tag->text_class) - efl_observable_observer_del(_edje_text_class_member, tag->text_class, ed->obj); - } - } + _edje_textblock_style_del(ed, stl); for (i = 0; i < pt->other.desc_count; ++i) { desc = (Edje_Part_Description_Text *)pt->other.desc[i]; style = edje_string_get(>text.style); stl = _edje_textblock_style_search(ed, style); -if (stl) - { - Edje_Style_Tag *tag; - Eina_List *l; - EINA_LIST_FOREACH(stl->tags, l, tag) - { - if (tag->text_class) -efl_observable_observer_del(_edje_text_class_member, tag->text_class, ed->obj); - } - } +_edje_textblock_style_del(ed, stl); } } --
[EGIT] [core/efl] master 07/08: edje/optimization: keep a readonly flag on edje_style.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d672d55107efba803c928a55252ab00afe2d0ba3 commit d672d55107efba803c928a55252ab00afe2d0ba3 Author: subhransu mohanty Date: Tue Aug 13 03:11:30 2019 + edje/optimization: keep a readonly flag on edje_style. Just to check if the edje style has text_class tag we do lot of pointer hopping by linearly scan through the tags in the style which is not very cache efficient. by keeping a readonly flag we can avoid those acess if the style dosen't have any text_class tags. and if we have those tags then we can start updating the style straight away. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9546 --- src/lib/edje/edje_private.h | 7 ++- src/lib/edje/edje_textblock_styles.c | 27 ++- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 15145aeaa1..0eab189859 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -627,7 +627,12 @@ struct _Edje_Style Eina_List *tags; Evas_Textblock_Style *style; - Eina_Bool cache; + Eina_Bool cache : 1; + /* * read only * true if no text_class and no color_class exits in the style. +* added for performace as we don't have to check all tags to decide if we need to update +* this style or not. +*/ + Eina_Bool readonly : 1; }; struct _Edje_Style_Tag diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index e83a21d227..555cab92c0 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -168,7 +168,6 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) Eina_Strbuf *txt = NULL; Edje_Style_Tag *tag; Edje_Text_Class *tc; - int found = 0; char *fontset = NULL, *fontsource = NULL; if (!ed->file) return; @@ -176,21 +175,12 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) /* Make sure the style is already defined */ if (!stl->style) return; + /* we are sure it dosen't have any text_class */ + if (stl->readonly) return; + /* No need to compute it again and again and again */ if (!force && stl->cache) return; - /* Make sure the style contains a text_class */ - EINA_LIST_FOREACH(stl->tags, l, tag) - { -if (tag->text_class) - { - found = 1; - break; - } - } - - /* No text classes , goto next style */ - if (!found) return; if (!txt) txt = eina_strbuf_new(); @@ -430,7 +420,8 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) EINA_LIST_FOREACH(ed->file->styles, l, stl) { Edje_Style_Tag *tag; -Eina_Bool found = EINA_FALSE; + +if (stl->readonly) continue; EINA_LIST_FOREACH(stl->tags, ll, tag) { @@ -438,12 +429,10 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) if (!strcmp(tag->text_class, text_class)) { - found = EINA_TRUE; + stl->cache = EINA_FALSE; break; } } -if (found) - stl->cache = EINA_FALSE; } } @@ -467,6 +456,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) if (stl->style) break; +stl->readonly = EINA_TRUE; + if (!txt) txt = eina_strbuf_new(); @@ -516,6 +507,8 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) } } eina_strbuf_append(txt, "'"); + + if (tag->text_class) stl->readonly = EINA_FALSE; } if (fontset) free(fontset); if (fontsource) free(fontsource); --
[EGIT] [core/efl] master 01/01: edje: optimize color_class_recursive_find_helper() function
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1b94d90d53dd71457cd92575d9f29c58d76eef75 commit 1b94d90d53dd71457cd92575d9f29c58d76eef75 Author: subhransu mohanty Date: Fri Aug 9 14:02:24 2019 +0900 edje: optimize color_class_recursive_find_helper() function Summary: If the color_class is not overridden by the object level the hash will be empty but still we do the expensive call to _edje_hash_find_helper() find the color_class in an empty hash. by checking if the hash is empty and returning early we save lot of unnecessary hash computaion and lookup. Reviewers: Hermet Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9532 --- src/lib/edje/edje_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 20aeec4a53..4e3cdba15d 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c @@ -5722,6 +5722,8 @@ _edje_color_class_recursive_find_helper(const Edje *ed, Eina_Hash *hash, const c Edje_Color_Tree_Node *ctn = NULL; const char *parent; + if (!eina_hash_population(hash)) return NULL; + cc = _edje_hash_find_helper(hash, color_class); if (cc) return cc; else if (ed->file) --
[EGIT] [core/efl] master 01/01: edje/styles: avoid redundant style tag addition by providing extra checks.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=a880a756cd8e904f32ce2048f8dce7b63f90bebb commit a880a756cd8e904f32ce2048f8dce7b63f90bebb Author: subhransu mohanty Date: Mon Aug 19 19:33:56 2019 +0900 edje/styles: avoid redundant style tag addition by providing extra checks. Summary: we should only add font_size tag if the new size is different. we should only add font tag if there is a new font. Reviewers: ali.alzyod, Hermet, cedric, raster Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9613 --- src/lib/edje/edje_textblock_styles.c | 38 ++-- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index cebbd23677..efe4520921 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -208,44 +208,36 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) { if (fontset) { - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_fallbacks="); + eina_strbuf_append(txt, " font_fallbacks="); eina_strbuf_append(txt, fontset); } if (fontsource) { - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_source="); + eina_strbuf_append(txt, " font_source="); eina_strbuf_append(txt, fontsource); } } -if (!EINA_DBL_EQ(tag->font_size, 0)) +if (tc && tc->size && !EINA_DBL_EQ(tag->font_size, 0)) { - char font_size[32]; - - if (tc && tc->size) - snprintf(font_size, sizeof(font_size), "%f", -(double)_edje_text_size_calc(tag->font_size, tc)); - else - snprintf(font_size, sizeof(font_size), "%f", -tag->font_size); - - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font_size="); - eina_strbuf_append(txt, font_size); + double new_size = _edje_text_size_calc(tag->font_size, tc); + if (!EINA_DBL_EQ(tag->font_size, new_size)) + { + char buffer[32]; + + snprintf(buffer, sizeof(buffer), "%.1f", new_size); + eina_strbuf_append(txt, " font_size="); + eina_strbuf_append(txt, buffer); + } } /* Add font name last to save evas from multiple loads */ -if (tag->font) +if (tc && tc->font && tag->font) { const char *f; char *sfont = NULL; - eina_strbuf_append(txt, " "); - eina_strbuf_append(txt, "font="); - - if (tc) f = _edje_text_font_get(tag->font, tc->font, ); - else f = tag->font; + eina_strbuf_append(txt, " font="); + f = _edje_text_font_get(tag->font, tc->font, ); eina_strbuf_append_escaped(txt, f); if (sfont) free(sfont); --
[EGIT] [core/efl] master 01/01: edje/textblock: Added edje_textblock_style_get() api.
kimcinoo pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5f70cacd921b180a48f586b1dd3700ff9c10b818 commit 5f70cacd921b180a48f586b1dd3700ff9c10b818 Author: subhransu mohanty Date: Thu Aug 29 11:35:24 2019 +0900 edje/textblock: Added edje_textblock_style_get() api. Summary: Now all textblock_style functionality are wrapped under api for easy of optimization. so going forward no one should directly acess the styles from the File . the styles should be acesses by the internal api's provided by edje_textblock_style. Reviewers: Hermet, ali.alzyod, woohyun, kimcinoo Reviewed By: kimcinoo Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9774 --- src/lib/edje/edje_load.c | 23 +-- src/lib/edje/edje_private.h | 7 ++- src/lib/edje/edje_textblock.c| 14 -- src/lib/edje/edje_textblock_styles.c | 25 + 4 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 9c6193a3c1..176cc3bbbc 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -1700,26 +1700,13 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch if (rp->part->default_desc) { Edje_Part_Description_Text *text; -Edje_Style *stl = NULL; -const char *style; +Evas_Textblock_Style *style = NULL; text = (Edje_Part_Description_Text *)rp->part->default_desc; -style = edje_string_get(>text.style); -if (style) - { - Eina_List *l; - - EINA_LIST_FOREACH(ed->file->styles, l, stl) - { - if ((stl->name) && (!strcmp(stl->name, style))) break; - stl = NULL; - } - } -if (stl) - { - if (evas_object_textblock_style_get(rp->object) != stl->style) - evas_object_textblock_style_set(rp->object, stl->style); - } +style = _edje_textblock_style_get(ed, edje_string_get(>text.style)); + +if (evas_object_textblock_style_get(rp->object) != style) + evas_object_textblock_style_set(rp->object, style); } } _edje_entry_init(ed); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index a1af62b23b..55ccd4d621 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2787,12 +2787,17 @@ void _edje_message_queue_process (void); void _edje_message_queue_clear (void); void _edje_message_del (Edje *ed); +// Edje object level textblock style api +Evas_Textblock_Style * _edje_textblock_style_get(Edje *ed, const char *style); void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep); void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt); -void _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class); + +// Edje File level textblock style api void _edje_textblock_style_all_update(Edje *ed); +void _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class); void _edje_textblock_style_parse_and_fix(Edje_File *edf); void _edje_textblock_style_cleanup(Edje_File *edf); + Edje_File *_edje_cache_file_coll_open(const Eina_File *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, Edje *ed); void _edje_cache_coll_clean(Edje_File *edf); void _edje_cache_coll_flush(Edje_File *edf); diff --git a/src/lib/edje/edje_textblock.c b/src/lib/edje/edje_textblock.c index add799f954..c7e58c3148 100644 --- a/src/lib/edje/edje_textblock.c +++ b/src/lib/edje/edje_textblock.c @@ -434,9 +434,8 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, Evas_Coord tw, th; const char *text = ""; const char *style = ""; -Edje_Style *stl = NULL; +Evas_Textblock_Style *stl = NULL; const char *tmp; -Eina_List *l; if (chosen_desc->text.id_source >= 0) { @@ -484,19 +483,14 @@ _edje_part_recalc_single_textblock(FLOAT_T sc, if (ep->typedata.text->text) text = ep->typedata.text->text; } -EINA_LIST_FOREACH(ed->file->styles, l, stl) - { - if ((stl->name) && (!strcmp(stl->name, style))) break; - stl = NULL; - } - if (ep->part->scale) e
[EGIT] [core/efl] master 01/01: edje/style: Enable lazy computaion of styles.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=1e079a7568adc9dfe4cd3733c70f77b8753f5a72 commit 1e079a7568adc9dfe4cd3733c70f77b8753f5a72 Author: subhransu mohanty Date: Fri Aug 23 11:11:05 2019 +0900 edje/style: Enable lazy computaion of styles. Summary: Instead of updating all the styles in an Edje_File just mark them dirty so that subsequent call to style will recompute the new style before returning the style. Reviewers: ali.alzyod, Hermet, raster, cedric Reviewed By: cedric Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9697 --- src/lib/edje/edje_textblock_styles.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index e4ceebecb5..7ac8bfa4cd 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -219,7 +219,11 @@ _edje_textblock_style_update(Edje *ed, Edje_Style *stl, Eina_Bool force) eina_strbuf_free(txt); } -/* Update all evas_styles which are in an edje +/* + * mark all the styles in the Edje_File dirty (except readonly styles)so that + * subsequent request to style will update before giving the style. + * Note: this will enable lazy style computation (only when some + * widget request for new style it will get computed). * * @param ed The edje containing styles which need to be updated */ @@ -232,7 +236,7 @@ _edje_textblock_style_all_update(Edje *ed) if (!ed->file) return; EINA_LIST_FOREACH(ed->file->styles, l, stl) - _edje_textblock_style_update(ed, stl, EINA_FALSE); + if (stl && !stl->readonly) stl->cache = EINA_FALSE; } static inline Edje_Style * --
[EGIT] [core/efl] master 01/05: edje/textblock: Don't add text_class style tag to the final style string
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=384765b08818a63893b6aa001d0bcc481d2366b4 commit 384765b08818a63893b6aa001d0bcc481d2366b4 Author: subhransu mohanty Date: Mon Aug 12 01:24:39 2019 + edje/textblock: Don't add text_class style tag to the final style string Evas_TextBlock_Style has no idea about the text_class tag its a garbage value to it. So keep the text_class tag in the edje level and update the text style property in the final style string when necessary. Because text_class id tends to be unique by removing from the final style string enable it to be shared (string shared string). Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9544 --- src/lib/edje/edje_textblock_styles.c | 5 + 1 file changed, 5 insertions(+) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 6585034292..1b7e94b6a1 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -100,6 +100,11 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) { if (tag_ret) (*tag_ret)->text_class = eina_stringshare_add(val); + + // no need to add text_class tag to style + // as evas_textblock_style has no idea about + // text_class tag. + continue; } else if (!strcmp(key, "font_size")) { --
[EGIT] [core/efl] master 02/02: edje/optimization: keep a style hash for fast retrival of styles
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=10501b170fcf0b17c4b816f320f0d66910e4d707 commit 10501b170fcf0b17c4b816f320f0d66910e4d707 Author: subhransu mohanty Date: Mon Aug 12 23:18:39 2019 + edje/optimization: keep a style hash for fast retrival of styles As edje mostly deals with style string. to get the style data each time it linearly search through list to find out the style which is not very cache friendly so keep a hash to do first lookup with less impact on cache. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9547 --- src/lib/edje/edje_cache.c| 6 ++ src/lib/edje/edje_load.c | 1 + src/lib/edje/edje_private.h | 1 + src/lib/edje/edje_textblock_styles.c | 34 -- 4 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/lib/edje/edje_cache.c b/src/lib/edje/edje_cache.c index 97d82ba58d..c1d39f7543 100644 --- a/src/lib/edje/edje_cache.c +++ b/src/lib/edje/edje_cache.c @@ -300,6 +300,7 @@ _edje_file_open(const Eina_File *f, int *error_ret, time_t mtime, Eina_Bool coll Edje_Color_Class *cc; Edje_Text_Class *tc; Edje_Size_Class *sc; + Edje_Style *stl; Edje_File *edf; Eina_List *l, *ll; Eet_File *ef; @@ -376,6 +377,11 @@ _edje_file_open(const Eina_File *f, int *error_ret, time_t mtime, Eina_Bool coll /* This should be done at edje generation time */ _edje_textblock_style_parse_and_fix(edf); + edf->style_hash = eina_hash_string_small_new(NULL); + EINA_LIST_FOREACH(edf->styles, l, stl) + if (stl->name) + eina_hash_direct_add(edf->style_hash, stl->name, stl); + edf->color_tree_hash = eina_hash_string_small_new(NULL); EINA_LIST_FOREACH(edf->color_tree, l, ctn) EINA_LIST_FOREACH(ctn->color_classes, ll, name) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index c28bfc572c..e831c7598a 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2361,6 +2361,7 @@ _edje_file_free(Edje_File *edf) if (edf->path) eina_stringshare_del(edf->path); if (edf->free_strings && edf->compiler) eina_stringshare_del(edf->compiler); if (edf->free_strings) eina_stringshare_del(edf->id); + eina_hash_free(edf->style_hash); _edje_textblock_style_cleanup(edf); if (edf->ef) eet_close(edf->ef); if (edf->f) eina_file_close(edf->f); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 44dd3fe34c..75a38c1aef 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -572,6 +572,7 @@ struct _Edje_File unsigned intrequires_count; Eina_List *styles; + Eina_Hash *style_hash; Eina_List *color_tree; Eina_Hash *color_tree_hash; diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index aee7f708b7..cb4a9c3a7a 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -240,19 +240,9 @@ _edje_textblock_style_all_update(Edje *ed) static inline Edje_Style * _edje_textblock_style_search(Edje *ed, const char *style) { - Edje_Style *stl = NULL; - Eina_List *l; - if (!style) return NULL; - EINA_LIST_FOREACH(ed->file->styles, l, stl) - { -if ((stl->name) && -(stl->name == style || !strcmp(stl->name, style))) break; -stl = NULL; - } - - return stl; + return eina_hash_find(ed->file->style_hash, style); } static inline void @@ -316,16 +306,9 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt) desc = (Edje_Part_Description_Text *)pt->default_desc; style = edje_string_get(>text.style); - if (style) - { -Eina_List *l; -EINA_LIST_FOREACH(ed->file->styles, l, stl) - { - if ((stl->name) && (!strcmp(stl->name, style))) break; - stl = NULL; - } - } + stl = _edje_textblock_style_search(ed, style); + if (stl) { Edje_Style_Tag *tag; @@ -342,16 +325,7 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt) { desc = (Edje_Part_Description_Text *)pt->other.desc[i]; style = edje_string_get(>text.style); -if (style) - { - Eina_List *l; - - EINA_LIST_FOREACH(ed->file->styles, l, stl) - { - if ((stl->name) && (!strcmp(stl->name, style))) break; - stl = NULL; - } - } +stl = _edje_textblock_style_search(ed, style); if (stl) { Edje_Style_Tag *tag; --
[EGIT] [core/efl] master 01/01: edje/style: Avoid unnecessary evas_textblock_style computation.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7c08d7b97cbb4b1f979e3b01f0a7e150ed093b54 commit 7c08d7b97cbb4b1f979e3b01f0a7e150ed093b54 Author: subhransu mohanty Date: Thu Aug 22 10:53:36 2019 +0900 edje/style: Avoid unnecessary evas_textblock_style computation. Summary: If the style is not readonly we always compute the style again when requested by edje. so this computation is unnecessary. By avoiding the computation here we will avoid style computation of all the styles in the edje that is not readonly hence saving memory. Reviewers: ali.alzyod, Hermet, cedric, raster Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9693 --- src/lib/edje/edje_textblock_styles.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index cb4a9c3a7a..ece7b76e93 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -440,8 +440,9 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf) if (tag->text_class) stl->readonly = EINA_FALSE; } -/* Configure the style */ -evas_textblock_style_set(stl->style, eina_strbuf_string_get(styleBuffer)); +/* Configure the style only if it will never change again*/ +if (stl->readonly) + evas_textblock_style_set(stl->style, eina_strbuf_string_get(styleBuffer)); } if (fontsource) free(fontsource); --
[EGIT] [core/efl] master 01/01: edje/style: refactor to avoid creating temporary strings.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=dafd3dc7b82863c8dbd65105fa53fe612d7a655f commit dafd3dc7b82863c8dbd65105fa53fe612d7a655f Author: subhransu mohanty Date: Mon Aug 19 19:38:35 2019 +0900 edje/style: refactor to avoid creating temporary strings. Summary: param_parse() was creating unnecessary 2 temporary string and destroying it. Reviewers: ali.alzyod, cedric, Hermet, raster Reviewed By: Hermet Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9610 --- src/lib/edje/edje_textblock_styles.c | 44 1 file changed, 10 insertions(+), 34 deletions(-) diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index efe4520921..06fbc1e586 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -1,29 +1,12 @@ #include "edje_private.h" static int -_edje_font_is_embedded(Edje_File *edf, char *font) +_edje_font_is_embedded(Edje_File *edf, const char *font) { if (!eina_hash_find(edf->fonts, font)) return 0; return 1; } -static void -_edje_format_param_parse(char *item, char **key, char **val) -{ - char *p, *k, *v; - - p = strchr(item, '='); - if (!p) return; - - k = malloc(p - item + 1); - strncpy(k, item, p - item); - k[p - item] = 0; - *key = k; - p++; - v = strdup(p); - *val = v; -} - static char * _edje_format_parse(const char **s) { @@ -69,13 +52,6 @@ _edje_format_parse(const char **s) return NULL; } -static int -_edje_format_is_param(char *item) -{ - if (strchr(item, '=')) return 1; - return 0; -} - static char * _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) { @@ -87,16 +63,18 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) s = str; while ((item = _edje_format_parse())) { -if (_edje_format_is_param(item)) +const char *pos = strchr(item, '='); +if (pos) { - char *key = NULL, *val = NULL; + size_t key_len = pos - item; + const char *key = item; + const char *val = pos + 1; - _edje_format_param_parse(item, , ); - if (!strcmp(key, "font_source")) + if (!strncmp(key, "font_source", key_len)) { /* dont allow font sources */ } - else if (!strcmp(key, "text_class")) + else if (!strncmp(key, "text_class", key_len)) { if (tag_ret) (*tag_ret)->text_class = eina_stringshare_add(val); @@ -106,12 +84,12 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) // text_class tag. continue; } - else if (!strcmp(key, "font_size")) + else if (!strncmp(key, "font_size", key_len)) { if (tag_ret) (*tag_ret)->font_size = atof(val); } - else if (!strcmp(key, "font")) /* Fix fonts */ + else if (!strncmp(key, "font", key_len)) /* Fix fonts */ { if (tag_ret) { @@ -137,8 +115,6 @@ _edje_format_reparse(Edje_File *edf, const char *str, Edje_Style_Tag **tag_ret) eina_strbuf_append(txt, s2); free(s2); } - free(key); - free(val); } else { --
[EGIT] [core/efl] master 01/02: edje/style: optimize updation of styles for a given text_style
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=676835458fbdc8702deae06a69b1223db97a525b commit 676835458fbdc8702deae06a69b1223db97a525b Author: subhransu mohanty Date: Tue Aug 20 06:21:10 2019 + edje/style: optimize updation of styles for a given text_style Currently we do 2 pass updation. first we scan through all the styles and check if they have text_style which matches the test_style we need to update then we mark them dirty. then we call style_all_update() to go through the list again and update those styles. By combining them both in a single function we avoid scanning through the whole list again. Reviewed-by: Cedric BAIL Differential Revision: https://phab.enlightenment.org/D9639 --- src/lib/edje/edje_private.h | 2 +- src/lib/edje/edje_smart.c| 3 +-- src/lib/edje/edje_textblock_styles.c | 8 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index f054fa25a2..44dd3fe34c 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -2788,7 +2788,7 @@ void _edje_message_del (Edje *ed); void _edje_textblock_styles_add(Edje *ed, Edje_Real_Part *ep); void _edje_textblock_styles_del(Edje *ed, Edje_Part *pt); -void _edje_textblock_styles_cache_free(Edje *ed, const char *text_class); +void _edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class); void _edje_textblock_style_all_update(Edje *ed); void _edje_textblock_style_parse_and_fix(Edje_File *edf); void _edje_textblock_style_cleanup(Edje_File *edf); diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c index 977832015f..1549962109 100644 --- a/src/lib/edje/edje_smart.c +++ b/src/lib/edje/edje_smart.c @@ -481,8 +481,7 @@ _efl_canvas_layout_efl_observer_update(Eo *obj EINA_UNUSED, Edje *ed, Efl_Object } else if (obs == _edje_text_class_member) { -_edje_textblock_styles_cache_free(ed, key); -_edje_textblock_style_all_update(ed); +_edje_textblock_style_all_update_text_class(ed, key); #ifdef EDJE_CALC_CACHE ed->text_part_change = EINA_TRUE; #endif diff --git a/src/lib/edje/edje_textblock_styles.c b/src/lib/edje/edje_textblock_styles.c index 43d75a5d44..aee7f708b7 100644 --- a/src/lib/edje/edje_textblock_styles.c +++ b/src/lib/edje/edje_textblock_styles.c @@ -366,8 +366,12 @@ _edje_textblock_styles_del(Edje *ed, Edje_Part *pt) } } +/* + * Finds all the styles having text class tag as text_class and + * updates them. + */ void -_edje_textblock_styles_cache_free(Edje *ed, const char *text_class) +_edje_textblock_style_all_update_text_class(Edje *ed, const char *text_class) { Eina_List *l, *ll; Edje_Style *stl; @@ -387,7 +391,7 @@ _edje_textblock_styles_cache_free(Edje *ed, const char *text_class) if (!strcmp(tag->text_class, text_class)) { - stl->cache = EINA_FALSE; + _edje_textblock_style_update(ed, stl, EINA_TRUE); break; } } --
[EGIT] [core/efl] master 07/07: triangulator: add a static_lib for triangulation. idea is to keep all the algorithm for triangulation in one place 1. shape outline triangulation using triangle strips.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=98b0408a4eed5c2beafd4f396b64ca54fb00270f commit 98b0408a4eed5c2beafd4f396b64ca54fb00270f Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Nov 28 11:21:33 2016 -0800 triangulator: add a static_lib for triangulation. idea is to keep all the algorithm for triangulation in one place 1. shape outline triangulation using triangle strips. 2. shape filling using curve flattning and polygon triangulation. Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: raster, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3896 --- src/Makefile_Ector.am | 11 +- src/static_libs/triangulator/triangulator_simple.c | 160 +++ src/static_libs/triangulator/triangulator_simple.h | 43 ++ .../triangulator/triangulator_stroker.c| 527 + .../triangulator/triangulator_stroker.h| 54 +++ 5 files changed, 794 insertions(+), 1 deletion(-) diff --git a/src/Makefile_Ector.am b/src/Makefile_Ector.am index f8b7671..0f8a0a5 100644 --- a/src/Makefile_Ector.am +++ b/src/Makefile_Ector.am @@ -108,6 +108,12 @@ static_libs/rg_etc/rg_etc2.c \ static_libs/rg_etc/rg_etc1.h \ static_libs/rg_etc/etc2_encoder.c +# Triangulator static lib +triangulator_sources = \ +static_libs/triangulator/triangulator_stroker.c \ +static_libs/triangulator/triangulator_simple.c \ +$(NULL) + # And the default software backend lib_ector_libector_la_SOURCES += \ lib/ector/software/ector_renderer_software_gradient_linear.c \ @@ -120,7 +126,8 @@ lib/ector/software/ector_software_surface.c \ lib/ector/software/ector_software_buffer.c \ static_libs/freetype/sw_ft_math.c \ static_libs/freetype/sw_ft_raster.c \ -static_libs/freetype/sw_ft_stroker.c +static_libs/freetype/sw_ft_stroker.c \ +$(triangulator_sources) # And now the gl backend lib_ector_libector_la_SOURCES += \ @@ -152,6 +159,7 @@ lib_ector_libector_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -I$(top_builddir)/src/lib/ector/gl \ -I$(top_srcdir)/src/static_libs/freetype \ -I$(top_srcdir)/src/static_libs/draw \ +-I$(top_srcdir)/src/static_libs/triangulator \ @ECTOR_CFLAGS@ \ -DPACKAGE_BIN_DIR=\"$(bindir)\" \ -DPACKAGE_LIB_DIR=\"$(libdir)\" \ @@ -204,3 +212,4 @@ static_libs/freetype/sw_ft_types.h \ static_libs/draw/draw.h \ static_libs/draw/draw_private.h \ $(ECTOR_GL_SHADERS_GEN) + diff --git a/src/static_libs/triangulator/triangulator_simple.c b/src/static_libs/triangulator/triangulator_simple.c new file mode 100644 index 000..60f7114 --- /dev/null +++ b/src/static_libs/triangulator/triangulator_simple.c @@ -0,0 +1,160 @@ +#include "triangulator_simple.h" + +Triangulator_Simple * +triangulator_simple_new(void) +{ + Triangulator_Simple *st = calloc(1, sizeof(Triangulator_Simple)); + st->vertices = eina_inarray_new(sizeof(float), 0); + st->stops = eina_inarray_new(sizeof(int), 0); + return st; +} + +void +triangulator_simple_free(Triangulator_Simple *st) +{ + eina_inarray_free(st->vertices); + eina_inarray_free(st->stops); +} + +static void +_add_line(Triangulator_Simple *st, const float x, const float y) +{ + float *ptr; + + ptr = eina_inarray_grow(st->vertices, 2); + ptr[0] = x; + ptr[1] = y; + + if (x > st->maxx) + st->maxx = x; + else if (x < st->minx) + st->minx = x; + if (y > st->maxy) + st->maxy = y; +else if (y < st->miny) + st->miny = y; +} + +static void +_calculate_centroid(const Efl_Gfx_Path_Command *cmds, const double *pts, double *cx, double *cy) +{ + double sumx = 0, sumy = 0; + int count = 0; + + sumx += pts[0]; + sumy += pts[1]; + for (cmds++, count++, pts+=2; *cmds != EFL_GFX_PATH_COMMAND_TYPE_END; cmds++) + { +switch (*cmds) + { + case EFL_GFX_PATH_COMMAND_TYPE_LINE_TO: + sumx += pts[0]; + sumy += pts[1]; + pts +=2; + count++; + break; + case EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO: + sumx += pts[0]; + sumy += pts[1]; + sumx += pts[2]; + sumy += pts[3]; + sumx += pts[4]; + sumy += pts[5]; + pts +=6; + count +=3; + break; + case EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO: + case EFL_GFX_PATH_COMMAND_TYPE_CLOSE: + *cx = sumx/count; + *cy = sumy/count; + return; + default: + break; + } + } + // + *cx = sumx/count; + *cy = sumy/count; +} + +void +triangulator_simple_process(Triangulator_Simple *st, const Efl_Gfx_Path_Command *cmds, const double *pts, Eina_Bool convex) +{ + double bw, bh, cx, cy, x, y, t, one_over_threshold_minus_1; + float *ptr; + int
[EGIT] [core/efl] master 01/03: evas/gl: Added support for stencil buffer creation while creating gl Surface.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=16cb5f7af90ea8a47261d0ae48fbbaa4ad2a847f commit 16cb5f7af90ea8a47261d0ae48fbbaa4ad2a847f Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Nov 16 13:14:48 2016 -0800 evas/gl: Added support for stencil buffer creation while creating gl Surface. Reviewers: jpeg, cedric Reviewed By: jpeg, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4404 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- .../evas/engines/gl_common/evas_gl_common.h| 6 +++--- .../evas/engines/gl_common/evas_gl_context.c | 2 +- src/modules/evas/engines/gl_common/evas_gl_image.c | 4 ++-- .../evas/engines/gl_common/evas_gl_texture.c | 22 ++ src/modules/evas/engines/gl_generic/evas_engine.c | 6 +++--- 5 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h index d044c16..8b56abe 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_common.h +++ b/src/modules/evas/engines/gl_common/evas_gl_common.h @@ -351,7 +351,7 @@ struct _Evas_Engine_GL_Context struct _Evas_GL_Texture_Pool { Evas_Engine_GL_Context *gc; - GLuint texture, fb; + GLuint texture, fb, stencil; GLuint intformat, format, dataformat; int w, h; int references; @@ -650,7 +650,7 @@ void evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, in void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt); Evas_GL_Texture *evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im, Eina_Bool disable_atlas); Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, Evas_GL_Image *im); -Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha); +Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil); Evas_GL_Texture *evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im); void evas_gl_common_texture_upload(Evas_GL_Texture *tex, RGBA_Image *im, unsigned int bytes_count); @@ -679,7 +679,7 @@ Evas_GL_Image *evas_gl_common_image_alpha_set(Evas_GL_Image *im, int alpha); void evas_gl_common_image_scale_hint_set(Evas_GL_Image *im, int hint); void evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint); void evas_gl_common_image_cache_flush(Evas_Engine_GL_Context *gc); -Evas_GL_Image*evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha); +Evas_GL_Image*evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil); void evas_gl_common_image_dirty(Evas_GL_Image *im, unsigned int x, unsigned int y, unsigned int w, unsigned int h); void evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im); void evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int npoints, RGBA_Map_Point *p, int smooth, int level); diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c index df2cad2..fbe3b26 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_context.c +++ b/src/modules/evas/engines/gl_common/evas_gl_context.c @@ -1050,7 +1050,7 @@ evas_gl_common_context_new(void) gc->shared->references++; _evas_gl_common_viewport_set(gc); - gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1); + gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1, EINA_FALSE); return gc; diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c index b863bce..99f75be 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_image.c +++ b/src/modules/evas/engines/gl_common/evas_gl_image.c @@ -722,7 +722,7 @@ evas_gl_common_image_free(Evas_GL_Image *im) } Evas_GL_Image * -evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha) +evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, unsigned int h, int alpha, int stencil) { Evas_GL_Image *im; @@ -738,7 +738,7 @@ evas_gl_common_image_surface_new(Evas_Engine_GL_Context *gc, unsigned int w, uns im->alpha = alpha; im->w = w; im->h = h; - im->tex = evas_gl_common_texture_render_new(gc, w, h, alpha); + im->tex
[EGIT] [core/efl] master 01/01: evas/vg: fix handling of stroke width in cairo and native backend
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=355a4e3830207a3bb5cdb88f55a85e917b92bc96 commit 355a4e3830207a3bb5cdb88f55a85e917b92bc96 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Nov 8 12:51:11 2016 +0900 evas/vg: fix handling of stroke width in cairo and native backend T3351 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/ector/cairo/ector_renderer_cairo_shape.c | 2 +- src/lib/ector/software/ector_renderer_software_shape.c | 5 +++-- src/lib/ector/software/ector_software_private.h| 2 +- src/lib/ector/software/ector_software_rasterizer.c | 16 ++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/lib/ector/cairo/ector_renderer_cairo_shape.c b/src/lib/ector/cairo/ector_renderer_cairo_shape.c index 6f67fb6..29eefd8 100644 --- a/src/lib/ector/cairo/ector_renderer_cairo_shape.c +++ b/src/lib/ector/cairo/ector_renderer_cairo_shape.c @@ -205,7 +205,7 @@ _ector_renderer_cairo_shape_ector_renderer_draw(Eo *obj, Ector_Renderer_Cairo_Sh } // Set dash, cap and join - cairo_set_line_width(pd->parent->cairo, (pd->public_shape->stroke.width * pd->public_shape->stroke.scale * 2)); + cairo_set_line_width(pd->parent->cairo, (pd->public_shape->stroke.width * pd->public_shape->stroke.scale)); cairo_set_line_cap(pd->parent->cairo, (cairo_line_cap_t) pd->public_shape->stroke.cap); cairo_set_line_join(pd->parent->cairo, (cairo_line_join_t) pd->public_shape->stroke.join); cairo_stroke(pd->parent->cairo); diff --git a/src/lib/ector/software/ector_renderer_software_shape.c b/src/lib/ector/software/ector_renderer_software_shape.c index 50fcddf..faafe0d 100644 --- a/src/lib/ector/software/ector_renderer_software_shape.c +++ b/src/lib/ector/software/ector_renderer_software_shape.c @@ -543,9 +543,10 @@ _update_rle(Eo *obj, Ector_Renderer_Software_Shape_Data *pd) { ector_software_rasterizer_stroke_set(pd->surface->rasterizer, (pd->public_shape->stroke.width * - pd->public_shape->stroke.scale), + pd->public_shape->stroke.scale), pd->public_shape->stroke.cap, - pd->public_shape->stroke.join); + pd->public_shape->stroke.join, + pd->base->m); if (pd->public_shape->stroke.dash) { diff --git a/src/lib/ector/software/ector_software_private.h b/src/lib/ector/software/ector_software_private.h index 1aa1511..d11ba3a 100644 --- a/src/lib/ector/software/ector_software_private.h +++ b/src/lib/ector/software/ector_software_private.h @@ -108,7 +108,7 @@ void ector_software_rasterizer_init(Software_Rasterizer *rasterizer); void ector_software_rasterizer_done(Software_Rasterizer *rasterizer); void ector_software_rasterizer_stroke_set(Software_Rasterizer *rasterizer, double width, - Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style); + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, Eina_Matrix3 *m); void ector_software_rasterizer_transform_set(Software_Rasterizer *rasterizer, Eina_Matrix3 *t); void ector_software_rasterizer_color_set(Software_Rasterizer *rasterizer, int r, int g, int b, int a); diff --git a/src/lib/ector/software/ector_software_rasterizer.c b/src/lib/ector/software/ector_software_rasterizer.c index cd59eb8..b0ea483 100644 --- a/src/lib/ector/software/ector_software_rasterizer.c +++ b/src/lib/ector/software/ector_software_rasterizer.c @@ -365,11 +365,23 @@ void ector_software_rasterizer_done(Software_Rasterizer *rasterizer) } void ector_software_rasterizer_stroke_set(Software_Rasterizer *rasterizer, double width, - Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style) + Efl_Gfx_Cap cap_style, Efl_Gfx_Join join_style, + Eina_Matrix3 *m) { SW_FT_Stroker_LineCap cap; SW_FT_Stroker_LineJoin join; - int stroke_width = (int)(width * 64); + int stroke_width; + double scale_factor = 1.0; + if (m) + { +// get the minimum scale factor from matrix +scale_factor = m->xx < m->yy ? m->xx : m->yy; + } + width = width * scale_factor; + width = width/2.0; // as free type uses it as the radius of the + // pen not the diameter. + // convert to freetype co-ordinate + stroke_width = (int)(width * 64); switch (cap_style) { --
[EGIT] [core/efl] master 01/01: ector: update the render api eo signeture
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7c51b3de00693f1285d1c7fb0e3391e15ee00be6 commit 7c51b3de00693f1285d1c7fb0e3391e15ee00be6 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Nov 3 13:20:03 2016 +0900 ector: update the render api eo signeture --- src/lib/ector/ector_renderer.eo | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/ector/ector_renderer.eo b/src/lib/ector/ector_renderer.eo index 0f3c66d..e14f963 100644 --- a/src/lib/ector/ector_renderer.eo +++ b/src/lib/ector/ector_renderer.eo @@ -111,7 +111,7 @@ abstract Ector.Renderer (Efl.Object) } } draw @virtual_pure { - return: bool @warn_unused; + return: bool; params { @in op: Efl.Gfx.Render_Op; @in clips: array<ptr(Eina.Rectangle)>; [[array of @Eina.Rectangle clip]] @@ -119,12 +119,12 @@ abstract Ector.Renderer (Efl.Object) } } prepare { - return: bool @warn_unused; + return: bool; params { } } done @virtual_pure { - return: bool @warn_unused; + return: bool; } } implements { --
[EGIT] [core/efl] master 01/06: evas: vg/gradient - add missing legacy api for gradient object creation.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=4f16e16b9449167416f4108c61552c1e48b6d8ca commit 4f16e16b9449167416f4108c61552c1e48b6d8ca Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Oct 25 13:31:45 2016 -0700 evas: vg/gradient - add missing legacy api for gradient object creation. Reviewers: jpeg, Hermet, artem.popov, cedric Reviewed By: artem.popov, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4331 Signed-off-by: Cedric Bail <ced...@osg.samsung.com> --- src/lib/evas/Evas_Legacy.h| 54 +++ src/lib/evas/canvas/evas_vg_gradient_linear.c | 6 +++ src/lib/evas/canvas/evas_vg_gradient_radial.c | 6 +++ 3 files changed, 66 insertions(+) diff --git a/src/lib/evas/Evas_Legacy.h b/src/lib/evas/Evas_Legacy.h index 95d2b20..6a4833c 100644 --- a/src/lib/evas/Evas_Legacy.h +++ b/src/lib/evas/Evas_Legacy.h @@ -3234,6 +3234,42 @@ EAPI void evas_vg_shape_append_svg_path(Eo *obj, const char *svg_path_data); EAPI Eina_Bool evas_vg_shape_interpolate(Eo *obj, const Eo *from, const Eo *to, double pos_map); EAPI Eina_Bool evas_vg_shape_equal_commands(Eo *obj, const Eo *with); +/** + * set a vg object as the fill property + * + * @param obj The object whose fill property gets modified. + * @param f The object content will be used for filling. + * + */ +EAPI void evas_vg_shape_fill_set(Eo *obj, Efl_VG *f); + +/** + * returns the object that is set for the fill property + * + * @param obj The object whose fill property is inspected. + * @return The object that is set as fill property. + * + */ +EAPI Efl_VG* evas_vg_shape_fill_get(const Eo *obj); + +/** + * set a vg object as the stroke fill property + * + * @param obj The object whose stroke fill property gets modified. + * @param f The object content will be used for stroke filling. + * + */ +EAPI void evas_vg_shape_stroke_fill_set(Eo *obj, Efl_VG *f); + +/** + * returns the object that is set for the stroke fill property + * + * @param obj The object whose stroke fill property is inspected. + * @return The object that is set as stroke fill property. + * + */ +EAPI Efl_VG* evas_vg_shape_stroke_fill_get(const Eo *obj); + #include "canvas/efl_vg_shape.eo.legacy.h" /** @@ -3281,6 +3317,15 @@ EAPI Efl_Gfx_Gradient_Spread evas_vg_gradient_spread_get(Eo *obj); #include "canvas/efl_vg_gradient.eo.legacy.h" /** + * Creates a new linear gradient object \. + * + * @param parent The given vector container object. + * @return The created linear gradient object handle. + * + */ +EAPI Efl_VG* evas_vg_gradient_linear_add(Efl_VG *parent); + +/** * * Sets the start point of this linear gradient. * @@ -3323,6 +3368,15 @@ EAPI void evas_vg_gradient_linear_end_get(Eo *obj, double *x, double *y); #include "canvas/efl_vg_gradient_linear.eo.legacy.h" /** + * Creates a new radial gradient object \. + * + * @param parent The given vector container object. + * @return The created radial gradient object handle. + * + */ +EAPI Efl_VG* evas_vg_gradient_radial_add(Efl_VG *parent); + +/** * * Sets the center of this radial gradient. * diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.c b/src/lib/evas/canvas/evas_vg_gradient_linear.c index de81987..a1e9046 100644 --- a/src/lib/evas/canvas/evas_vg_gradient_linear.c +++ b/src/lib/evas/canvas/evas_vg_gradient_linear.c @@ -192,4 +192,10 @@ evas_vg_gradient_linear_end_get(Eo *obj, double *x, double *y) efl_gfx_gradient_linear_end_get(obj, x, y); } +EAPI Efl_VG* +evas_vg_gradient_linear_add(Efl_VG *parent) +{ + return efl_add(EFL_VG_GRADIENT_LINEAR_CLASS, parent); +} + #include "efl_vg_gradient_linear.eo.c" diff --git a/src/lib/evas/canvas/evas_vg_gradient_radial.c b/src/lib/evas/canvas/evas_vg_gradient_radial.c index 9a60d65..a464e2a 100644 --- a/src/lib/evas/canvas/evas_vg_gradient_radial.c +++ b/src/lib/evas/canvas/evas_vg_gradient_radial.c @@ -224,4 +224,10 @@ evas_vg_gradient_radial_focal_get(Eo *obj, double *x, double *y) efl_gfx_gradient_radial_focal_get(obj, x, y); } +EAPI Efl_VG* +evas_vg_gradient_radial_add(Efl_VG *parent) +{ + return efl_add(EFL_VG_GRADIENT_RADIAL_CLASS, parent); +} + #include "efl_vg_gradient_radial.eo.c" --
[EGIT] [core/efl] master 02/02: evas/map: do nothing when same map is set again
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9b7ac51943ba0d6391b75cf2d0318bedee905c63 commit 9b7ac51943ba0d6391b75cf2d0318bedee905c63 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Oct 14 19:45:42 2016 +0900 evas/map: do nothing when same map is set again Reviewers: cedric, Hermet, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4344 --- src/lib/evas/canvas/evas_map.c | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_map.c b/src/lib/evas/canvas/evas_map.c index 66bea1c..ccac223 100644 --- a/src/lib/evas/canvas/evas_map.c +++ b/src/lib/evas/canvas/evas_map.c @@ -51,7 +51,7 @@ _evas_map_calc_map_geometry(Evas_Object *eo_obj) p = obj->map->cur.map->points; p2 = obj->map->prev.map->points; - if (memcmp(p, p2, sizeof(Evas_Map_Point) * + if (memcmp(p, p2, sizeof(Evas_Map_Point) * obj->map->prev.map->count) != 0) ch = EINA_TRUE; if (!ch) @@ -564,6 +564,21 @@ evas_object_map_set(Evas_Object *eo_obj, const Evas_Map *map) { Evas_Object_Protected_Data *obj = EVAS_OBJ_GET_OR_RETURN(eo_obj); + // check if the new map and current map attributes are same + if (map && obj->map->cur.map && + (obj->map->cur.map->alpha == map->alpha) && + (obj->map->cur.map->smooth == map->smooth) && + (obj->map->cur.map->move_sync.enabled == map->move_sync.enabled) && + (obj->map->cur.map->count == map->count)) + { +const Evas_Map_Point *p1, *p2; +p1 = obj->map->cur.map->points; +p2 = map->points; +if (memcmp(p1, p2, sizeof(Evas_Map_Point) * + map->count) == 0) + return; + } + evas_object_async_block(obj); if ((!map) || (map->count < 4)) { --
[EGIT] [core/efl] master 01/01: evas/module: add a new module in vg_saver for eet
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=8b7f060946a4268316792902409bda2fea00fd32 commit 8b7f060946a4268316792902409bda2fea00fd32 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Oct 14 15:52:51 2016 +0900 evas/module: add a new module in vg_saver for eet Reviewers: cedric, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4350 --- src/Makefile_Evas.am | 23 - src/lib/evas/Evas_Loader.h| 3 +- src/lib/evas/file/evas_module.c | 27 -- src/lib/evas/include/evas_private.h | 5 ++ src/modules/evas/vg_savers/eet/evas_vg_save_eet.c | 60 +++ 5 files changed, 112 insertions(+), 6 deletions(-) diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 6fcb319..26cdd79 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1501,6 +1501,7 @@ bin_evas_evas_cserve2_slave_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ -DEVAS_MODULE_NO_ENGINES=1 \ -DEVAS_MODULE_NO_IMAGE_SAVERS=1 \ -DEVAS_MODULE_NO_VG_LOADERS=1 \ +-DEVAS_MODULE_NO_VG_SAVERS=1 \ @EVAS_CFLAGS@ bin_evas_evas_cserve2_slave_LDADD = @EVAS_CSERVE2_SLAVE_LIBS@ @USE_EINA_LIBS@ @USE_EMILE_LIBS@ @@ -1556,7 +1557,7 @@ endif if BUILD_VG_LOADER_EET if EVAS_STATIC_BUILD_VG_EET -lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/eet/evas_vg_load_eet.c +lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/eet/evas_vg_load_eet.c modules/evas/vg_savers/eet/evas_vg_save_eet.c lib_evas_libevas_la_CPPFLAGS += @evas_vg_loader_eet_cflags@ lib_evas_libevas_la_LIBADD += @evas_vg_loader_eet_libs@ else @@ -1579,6 +1580,26 @@ modules_evas_vg_loaders_eet_module_la_LIBADD = \ modules_evas_vg_loaders_eet_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ modules_evas_vg_loaders_eet_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ modules_evas_vg_loaders_eet_module_la_LIBTOOLFLAGS = --tag=disable-static + +vgsavereetpkgdir = $(libdir)/evas/modules/vg_savers/eet/$(MODULE_ARCH) +vgsavereetpkg_LTLIBRARIES = modules/evas/vg_savers/eet/module.la + +# Workaround for broken parallel install support in automake (relink issue) +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328 +install_vgsavereetpkgLTLIBRARIES = install-vgloadereetpkgLTLIBRARIES +$(install_vgsavereetpkgLTLIBRARIES): install-libLTLIBRARIES + +modules_evas_vg_savers_eet_module_la_SOURCES = modules/evas/vg_savers/eet/evas_vg_save_eet.c +modules_evas_vg_savers_eet_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ +-I$(top_srcdir)/src/lib/evas/include \ +@EVAS_CFLAGS@ \ +@evas_vg_saver_eet_cflags@ +modules_evas_vg_savers_eet_module_la_LIBADD = \ +@USE_EVAS_LIBS@ \ +@evas_vg_saver_eet_libs@ +modules_evas_vg_savers_eet_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ +modules_evas_vg_savers_eet_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ +modules_evas_vg_savers_eet_module_la_LIBTOOLFLAGS = --tag=disable-static endif endif diff --git a/src/lib/evas/Evas_Loader.h b/src/lib/evas/Evas_Loader.h index b414014..a5d138b 100644 --- a/src/lib/evas/Evas_Loader.h +++ b/src/lib/evas/Evas_Loader.h @@ -79,7 +79,8 @@ typedef enum _Evas_Module_Type EVAS_MODULE_TYPE_IMAGE_LOADER = 1, EVAS_MODULE_TYPE_IMAGE_SAVER = 2, EVAS_MODULE_TYPE_OBJECT = 3, - EVAS_MODULE_TYPE_VG_LOADER = 4 + EVAS_MODULE_TYPE_VG_LOADER = 4, + EVAS_MODULE_TYPE_VG_SAVER = 5 } Evas_Module_Type; typedef struct _Evas_Module_ApiEvas_Module_Api; diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c index ea4f5c2..612507d 100644 --- a/src/lib/evas/file/evas_module.c +++ b/src/lib/evas/file/evas_module.c @@ -24,8 +24,13 @@ #define EVAS_MODULE_NO_VG_LOADERS 0 #endif +#ifndef EVAS_MODULE_NO_VG_SAVERS +#define EVAS_MODULE_NO_VG_SAVERS 0 +#endif + -static Eina_Hash *evas_modules[5] = { +static Eina_Hash *evas_modules[6] = { + NULL, NULL, NULL, NULL, @@ -155,6 +160,10 @@ EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, xpm); EVAS_EINA_STATIC_MODULE_DEFINE(image_loader, tgv); #endif +#if !EVAS_MODULE_NO_VG_SAVERS +EVAS_EINA_STATIC_MODULE_DEFINE(vg_saver, eet); +#endif + #if !EVAS_MODULE_NO_IMAGE_SAVERS EVAS_EINA_STATIC_MODULE_DEFINE(image_saver, eet); EVAS_EINA_STATIC_MODULE_DEFINE(image_saver, jpeg); @@ -264,6 +273,11 @@ static const struct { EVAS_EINA_STATIC_MODULE_USE(image_loader, tgv), #endif #endif +#if !EVAS_MODULE_NO_VG_SAVERS +#ifdef EVAS_STATIC_BUILD_VG_EET + EVAS_EINA_STATIC_MODULE_USE(vg_saver, eet), +#endif +#endif #if !EVAS_MODULE_NO_IMAGE_SAVERS #ifdef EVAS_STATIC_BUILD_EET EVAS_EINA_STATIC_MODULE_USE(image_saver, eet), @@ -301,6 +315,7 @@ evas_module_init(void) evas_modules[EVAS_MODULE_TYPE_IMAGE_SAVER] = eina_hash_string_small_new(/* FIXME: Add a function to cleanup stuff. */ NULL); evas_modules[EVAS_MODULE_TYPE_OBJECT] = eina_hash_string_small_new(/* FIXME: Add a function to c
[EGIT] [core/efl] master 02/02: evas/module: add a new module in vg_loader for eet
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=45b103eb0a3a91238f6ee1d66ccb2614925a2e64 commit 45b103eb0a3a91238f6ee1d66ccb2614925a2e64 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Oct 13 17:09:39 2016 +0900 evas/module: add a new module in vg_loader for eet Reviewers: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4347 --- configure.ac | 3 ++ m4/evas_check_loader.m4| 16 ++ src/Makefile_Evas.am | 31 +-- src/lib/evas/file/evas_module.c| 4 ++ src/modules/evas/vg_loaders/eet/evas_vg_load_eet.c | 60 ++ 5 files changed, 110 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 0b7adba..0794852 100644 --- a/configure.ac +++ b/configure.ac @@ -2391,6 +2391,8 @@ case "$host_os" in esac ARG_ENABLE_EVAS_VG_LOADER(SVG, static) +ARG_ENABLE_EVAS_VG_LOADER(EET, static) + ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static) ARG_ENABLE_EVAS_IMAGE_LOADER(Eet, static) @@ -2713,6 +2715,7 @@ AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_COMMON], [test "x${have_static_evas_engine_ ## Vg Loaders EVAS_CHECK_VG_LOADER([SVG], [${want_evas_vg_loader_svg}]) +EVAS_CHECK_VG_LOADER([EET], [${want_evas_vg_loader_eet}]) ## Image Loaders diff --git a/m4/evas_check_loader.m4 b/m4/evas_check_loader.m4 index 5bf9277..b574931 100644 --- a/m4/evas_check_loader.m4 +++ b/m4/evas_check_loader.m4 @@ -42,6 +42,22 @@ AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4]) ]) +dnl use: EVAS_CHECK_VG_LOADER_DEP_EET(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) + +AC_DEFUN([EVAS_CHECK_VG_LOADER_DEP_EET], +[ + +have_dep="yes" +evas_vg_loader_[]$1[]_cflags="" +evas_vg_loader_[]$1[]_libs="" + +AC_SUBST([evas_vg_loader_$1_cflags]) +AC_SUBST([evas_vg_loader_$1_libs]) + +AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4]) + +]) + dnl use: ARG_ENABLE_EVAS_IMAGE_LOADER(loader, default_value) AC_DEFUN([ARG_ENABLE_EVAS_IMAGE_LOADER], diff --git a/src/Makefile_Evas.am b/src/Makefile_Evas.am index 369e3eb..0b9e79e 100644 --- a/src/Makefile_Evas.am +++ b/src/Makefile_Evas.am @@ -1531,10 +1531,6 @@ 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_LIBADD += @evas_vg_loader_svg_libs@ -if EVAS_CSERVE2 -bin_evas_evas_cserve2_slave_CPPFLAGS += @evas_vg_loader_svg_cflags@ -bin_evas_evas_cserve2_slave_LDADD += @evas_vg_loader_svg_libs@ -endif else vgloadersvgpkgdir = $(libdir)/evas/modules/vg_loaders/svg/$(MODULE_ARCH) vgloadersvgpkg_LTLIBRARIES = modules/evas/vg_loaders/svg/module.la @@ -1558,6 +1554,33 @@ modules_evas_vg_loaders_svg_module_la_LIBTOOLFLAGS = --tag=disable-static endif endif +if BUILD_VG_LOADER_EET +if EVAS_STATIC_BUILD_VG_EET +lib_evas_libevas_la_SOURCES += modules/evas/vg_loaders/eet/evas_vg_load_eet.c +lib_evas_libevas_la_CPPFLAGS += @evas_vg_loader_eet_cflags@ +lib_evas_libevas_la_LIBADD += @evas_vg_loader_eet_libs@ +else +vgloadereetpkgdir = $(libdir)/evas/modules/vg_loaders/eet/$(MODULE_ARCH) +vgloadereetpkg_LTLIBRARIES = modules/evas/vg_loaders/eet/module.la + +# Workaround for broken parallel install support in automake (relink issue) +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7328 +install_vgloadereetpkgLTLIBRARIES = install-vgloadereetpkgLTLIBRARIES +$(install_vgloadereetpkgLTLIBRARIES): install-libLTLIBRARIES + +modules_evas_vg_loaders_eet_module_la_SOURCES = modules/evas/vg_loaders/eet/evas_vg_load_eet.c +modules_evas_vg_loaders_eet_module_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl \ +-I$(top_srcdir)/src/lib/evas/include \ +@EVAS_CFLAGS@ \ +@evas_vg_loader_eet_cflags@ +modules_evas_vg_loaders_eet_module_la_LIBADD = \ +@USE_EVAS_LIBS@ \ +@evas_vg_loader_eet_libs@ +modules_evas_vg_loaders_eet_module_la_DEPENDENCIES = @USE_EVAS_INTERNAL_LIBS@ +modules_evas_vg_loaders_eet_module_la_LDFLAGS = -module @EFL_LTMODULE_FLAGS@ +modules_evas_vg_loaders_eet_module_la_LIBTOOLFLAGS = --tag=disable-static +endif +endif if BUILD_LOADER_BMP diff --git a/src/lib/evas/file/evas_module.c b/src/lib/evas/file/evas_module.c index f8d2787..ea4f5c2 100644 --- a/src/lib/evas/file/evas_module.c +++ b/src/lib/evas/file/evas_module.c @@ -130,6 +130,7 @@ EVAS_EINA_STATIC_MODULE_DEFINE(engine, software_x11); #endif #if !EVAS_MODULE_NO_VG_LOADERS +EVAS_EINA_STATIC_MODULE_DEFINE(vg_loader, eet); EVAS_EINA_STATIC_MODULE_DEFINE(vg_loader, svg); #endif @@ -203,6 +204,9 @@ static const struct { #ifdef EVAS_STATIC_BUILD_VG_SVG EVAS_EINA_STATIC_MODULE_USE(vg_loader, svg), #endif +#ifdef EVAS_STATIC_BUILD_VG_EET + EVAS_EINA_STATIC_MODULE_USE(vg_loader, eet), +#endif #endif #if !EVAS_MODULE_
[EGIT] [core/efl] master 02/02: evas/module: Added a new module vg_loader for svg
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0d9b168146f2b505d298a763d5bfaa6918074366 commit 0d9b168146f2b505d298a763d5bfaa6918074366 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Oct 12 18:39:10 2016 +0900 evas/module: Added a new module vg_loader for svg Reviewers: cedric, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4346 --- configure.ac | 6 ++ m4/evas_check_loader.m4| 96 ++ src/Makefile_Evas.am | 35 src/lib/evas/Evas_Loader.h | 3 +- src/lib/evas/file/evas_module.c| 21 - src/lib/evas/include/evas_private.h| 7 ++ src/modules/evas/vg_loaders/svg/evas_vg_load_svg.c | 60 ++ 7 files changed, 226 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0192122..0b7adba 100644 --- a/configure.ac +++ b/configure.ac @@ -2390,6 +2390,8 @@ case "$host_os" in ;; esac +ARG_ENABLE_EVAS_VG_LOADER(SVG, static) + ARG_ENABLE_EVAS_IMAGE_LOADER(BMP, static) ARG_ENABLE_EVAS_IMAGE_LOADER(Eet, static) ARG_ENABLE_EVAS_IMAGE_LOADER(Generic, [${want_generic}]) @@ -2708,6 +2710,9 @@ fi AM_CONDITIONAL([EVAS_STATIC_BUILD_GL_COMMON], [test "x${have_static_evas_engine_gl_common}" = "xyes"]) +## Vg Loaders + +EVAS_CHECK_VG_LOADER([SVG], [${want_evas_vg_loader_svg}]) ## Image Loaders @@ -5994,6 +5999,7 @@ echo "Emile...: yes (${features_emile})" echo "Eet.: yes" echo "Evas: yes (${features_evas})" echo " Engines...: ${features_evas_engine}" +echo " Vg Loaders: ${features_evas_vg_loader}" echo " Image Loaders.: ${features_evas_loader}" if test "x${have_pixman}" = "xyes" ; then echo " Pixman: ${features_evas_pixman}" diff --git a/m4/evas_check_loader.m4 b/m4/evas_check_loader.m4 index b2f5c5a..5bf9277 100644 --- a/m4/evas_check_loader.m4 +++ b/m4/evas_check_loader.m4 @@ -1,4 +1,47 @@ +dnl use: ARG_ENABLE_EVAS_VG_LOADER(loader, default_value) + +AC_DEFUN([ARG_ENABLE_EVAS_VG_LOADER], +[dnl +m4_pushdef([DOWN], m4_tolower([$1]))dnl + +AC_ARG_ENABLE([vg-loader-[]DOWN], + [AC_HELP_STRING([--enable-vg-loader-[]DOWN], [enable $1 vg loader. @<:@default=$2@:>@])], + [ + if test "x${enableval}" = "xyes" ; then + want_evas_vg_loader_[]DOWN="yes" + else + if test "x${enableval}" = "xstatic" ; then +want_evas_vg_loader_[]DOWN="static" + else +if test "x${enableval}" = "xauto" ; then + want_evas_vg_loader_[]DOWN="auto" +else + want_evas_vg_loader_[]DOWN="no" +fi + fi + fi + ], + [want_evas_vg_loader_[]DOWN="$2"]) +m4_popdef([DOWN])dnl +]) + +dnl use: EVAS_CHECK_VG_LOADER_DEP_SVG(loader, want_static[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) + +AC_DEFUN([EVAS_CHECK_VG_LOADER_DEP_SVG], +[ + +have_dep="yes" +evas_vg_loader_[]$1[]_cflags="" +evas_vg_loader_[]$1[]_libs="" + +AC_SUBST([evas_vg_loader_$1_cflags]) +AC_SUBST([evas_vg_loader_$1_libs]) + +AS_IF([test "x${have_dep}" = "xyes"], [$3], [$4]) + +]) + dnl use: ARG_ENABLE_EVAS_IMAGE_LOADER(loader, default_value) AC_DEFUN([ARG_ENABLE_EVAS_IMAGE_LOADER], @@ -592,3 +635,56 @@ AM_CONDITIONAL(EVAS_STATIC_BUILD_[]UP, [test "x${want_static_loader}" = "xyes"]) m4_popdef([UP])dnl m4_popdef([DOWN])dnl ]) + +dnl use: EVAS_CHECK_VG_LOADER(loader, want_loader, macro) +AC_DEFUN([EVAS_CHECK_VG_LOADER], +[dnl +m4_pushdef([UP], m4_toupper([$1]))dnl +m4_pushdef([DOWN], m4_tolower([$1]))dnl + +want_loader="$2" +want_static_loader="no" +have_loader="no" +have_evas_vg_loader_[]DOWN="no" + +AC_MSG_CHECKING([whether to enable $1 vg loader]) +AC_MSG_RESULT([${want_loader}]) + +if test "x${want_loader}" = "xyes" -o "x${want_loader}" = "xstatic" -o "x${want_loader}" = "xauto"; then + m4_default([EVAS_CHECK_VG_LOADER_DEP_]m4_defn([UP]))(DOWN, ${want_loader}, [have_loader="yes"], [have_loader="no"]) +fi + +if test "x${have_loader}" = "xno"; then + if test "x${want_loader}" = "xyes" -o "x${want_loader}" = "xstatic"; then + AC_MSG_ERROR([$1 dependencies not found]) + fi +fi + +AC_MSG_CHECKING([whether $1 vg loader will be built]) +AC_MSG_RESULT([${have_loader}]) + +if test "x${have_loader}" = "xyes" ; then + if test "x${want_l
[EGIT] [tools/expedite] master 01/01: fixed the build break because of api change.
hermet pushed a commit to branch master. http://git.enlightenment.org/tools/expedite.git/commit/?id=525879533ad1ae9b7e4ae4857d08378636ccf2f1 commit 525879533ad1ae9b7e4ae4857d08378636ccf2f1 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Oct 10 14:09:23 2016 +0900 fixed the build break because of api change. Summary: NOTE: need to check if the api replacements are correct or not Reviewers: Hermet, jpeg Differential Revision: https://phab.enlightenment.org/D4329 --- src/bin/image_data_argb.c | 18 +++--- src/bin/image_data_argb_alpha.c| 18 ++ src/bin/image_data_ycbcr601pl.c| 2 +- .../image_data_ycbcr601pl_map_nearest_solid_rotate.c | 5 - src/bin/image_data_ycbcr601pl_map_solid_rotate.c | 5 - src/bin/image_data_ycbcr601pl_wide_stride.c| 7 +-- 6 files changed, 35 insertions(+), 20 deletions(-) diff --git a/src/bin/image_data_argb.c b/src/bin/image_data_argb.c index b96ab75..5707f36 100644 --- a/src/bin/image_data_argb.c +++ b/src/bin/image_data_argb.c @@ -23,6 +23,7 @@ static void _setup(void) int i; Evas_Object *o; void *pixels; + Eina_Slice slice; pixels = malloc(sizeof (int) * 640 * 480); for (i = 0; i < 1; i++) @@ -34,7 +35,8 @@ static void _setup(void) efl_gfx_fill_set(o, 0, 0, 640, 480); efl_gfx_size_set(o, 640, 480); efl_gfx_visible_set(o, EINA_TRUE); -efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB); +slice = (Eina_Slice)EINA_SLICE_STR(pixels); +efl_gfx_buffer_copy_set(o_images[i], , 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB, 0); } free(pixels); done = 0; @@ -52,9 +54,11 @@ static void _loop(double t, int f) { int i, st; Evas_Coord x, y, w, h; + Eina_Rw_Slice rw_slice; + for (i = 0; i < 1; i++) { -unsigned int *data, *p; +unsigned int result, *p; int length; w = 640; @@ -64,17 +68,17 @@ static void _loop(double t, int f) efl_gfx_position_set(o_images[i], x, y); efl_gfx_size_set(o_images[i], w, h); efl_gfx_fill_set(o_images[i], 0, 0, w, h); -data = efl_gfx_buffer_map(o_images[i], , +result = efl_gfx_buffer_map(o_images[i], _slice, EFL_GFX_BUFFER_ACCESS_MODE_WRITE, - 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB, + 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB, 0, ); -if (!data) +if (!result) { fprintf(stderr, "ERROR: Failed to map image!\n"); continue; } st = st >> 2; -p = data; +p = rw_slice.mem; for (y = 0; y < h; y++) { for (x = 0; x < w; x++) @@ -84,7 +88,7 @@ static void _loop(double t, int f) } p += (st - w); } -efl_gfx_buffer_unmap(o_images[i], data, length); +efl_gfx_buffer_unmap(o_images[i], _slice); efl_gfx_buffer_update_add(o_images[i], 0, 0, w, h); } FPS_STD(NAME); diff --git a/src/bin/image_data_argb_alpha.c b/src/bin/image_data_argb_alpha.c index 0493c95..a4cdabe 100644 --- a/src/bin/image_data_argb_alpha.c +++ b/src/bin/image_data_argb_alpha.c @@ -34,7 +34,7 @@ static void _setup(void) efl_gfx_fill_set(o, 0, 0, 640, 480); efl_gfx_size_set(o, 640, 480); efl_gfx_visible_set(o, EINA_TRUE); -efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB); +efl_gfx_buffer_copy_set(o_images[i], pixels, 640, 480, 640 * sizeof (int), EFL_GFX_COLORSPACE_ARGB, 0); } free(pixels); done = 0; @@ -52,10 +52,12 @@ static void _loop(double t, int f) { int i, st; Evas_Coord x, y, w, h; + Eina_Rw_Slice rw_slice; + for (i = 0; i < 1; i++) { -unsigned int *data, *p; -int a, r, g, b, length; +unsigned int result, *p; +int a, r, g, b; w = 640; h = 480; @@ -64,17 +66,17 @@ static void _loop(double t, int f) efl_gfx_position_set(o_images[i], x, y); efl_gfx_size_set(o_images[i], w, h); efl_gfx_fill_set(o_images[i], 0, 0, w, h); -data = efl_gfx_buffer_map(o_images[i], , +result = efl_gfx_buffer_map(o_images[i], _slice, EFL_GFX_BUFFER_ACCESS_MODE_WRITE, - 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB, + 0, 0, 0, 0, EFL_GFX_COLORSPACE_ARGB, 0, ); -if (!data) +if (!result) { fprintf(stderr, "ERROR: Failed
[EGIT] [core/efl] master 01/01: evas/vg: renamed the legacy vg shape apis
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=cf779b44e07f411ab5768eb2b216aca9dc9e453e commit cf779b44e07f411ab5768eb2b216aca9dc9e453e Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Oct 5 11:07:11 2016 +0900 evas/vg: renamed the legacy vg shape apis Reviewers: Hermet, cedric, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4284 --- src/examples/evas/evas-vg-batman.c | 10 - src/examples/evas/evas-vg-simple.c | 16 +++--- src/lib/edje/edje_load.c| 16 +++--- src/lib/evas/Evas_Legacy.h | 42 ++--- src/lib/evas/canvas/evas_vg_shape.c | 42 ++--- 5 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/examples/evas/evas-vg-batman.c b/src/examples/evas/evas-vg-batman.c index 9d7892e..c125b24 100644 --- a/src/examples/evas/evas-vg-batman.c +++ b/src/examples/evas/evas-vg-batman.c @@ -79,7 +79,7 @@ _animator(void *data EINA_UNUSED, double pos) { int next = (animation_position + 1) % (sizeof (batmans_path) / sizeof (batmans_path[0])); - evas_vg_shape_shape_interpolate(batman, + evas_vg_shape_interpolate(batman, batmans_vg[animation_position], batmans_vg[next], ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0)); @@ -140,7 +140,7 @@ main(void) evas_vg_node_color_set(batmans_vg[i], 120, 120, 120, 255); evas_vg_shape_stroke_join_set(batmans_vg[i], EFL_GFX_JOIN_ROUND); } -evas_vg_shape_shape_append_svg_path(batmans_vg[i], batmans_path[i]); +evas_vg_shape_append_svg_path(batmans_vg[i], batmans_path[i]); } animation = ecore_animator_timeline_add(1, _animator, NULL); @@ -154,7 +154,7 @@ main(void) circle = evas_vg_shape_add(root); - evas_vg_shape_shape_append_circle(circle, WIDTH / 2, HEIGHT / 2, 200); + evas_vg_shape_append_circle(circle, WIDTH / 2, HEIGHT / 2, 200); evas_vg_node_color_set(circle, 255, 255, 255, 255); evas_vg_shape_stroke_width_set(circle, 1); evas_vg_shape_stroke_color_set(circle, 255, 0, 0, 255); @@ -162,8 +162,8 @@ main(void) batman = evas_vg_shape_add(root); evas_vg_node_color_set(batman, 0, 0, 0, 255); evas_vg_node_origin_set(batman, 100, 150); - evas_vg_shape_shape_append_move_to(batman, 256, 213); - evas_vg_shape_shape_dup(batman, batmans_vg[0]); + evas_vg_shape_append_move_to(batman, 256, 213); + evas_vg_shape_dup(batman, batmans_vg[0]); ecore_main_loop_begin(); diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c index 17bf3f0..9524e94 100644 --- a/src/examples/evas/evas-vg-simple.c +++ b/src/examples/evas/evas-vg-simple.c @@ -105,7 +105,7 @@ vector_set(int x, int y, int w, int h) //evas_vg_node_transformation_set(root, ); Efl_VG *bg = efl_add(EFL_VG_SHAPE_CLASS, root, efl_vg_name_set(efl_added, "bg")); - evas_vg_shape_shape_append_rect(bg, 0, 0 , vg_w, vg_h, 0, 0); + evas_vg_shape_append_rect(bg, 0, 0 , vg_w, vg_h, 0, 0); evas_vg_node_origin_set(bg, 0,0); evas_vg_shape_stroke_width_set(bg, 1.0); evas_vg_node_color_set(bg, 80, 80, 80, 80); @@ -114,7 +114,7 @@ vector_set(int x, int y, int w, int h) Efl_VG *rgradient = efl_add(EFL_VG_GRADIENT_RADIAL_CLASS, NULL, efl_vg_name_set(efl_added, "rgradient")); Efl_VG *lgradient = efl_add(EFL_VG_GRADIENT_LINEAR_CLASS, NULL, efl_vg_name_set(efl_added, "lgradient")); - evas_vg_shape_shape_append_arc(shape, 0, 0, 100, 100, 25, 330); + evas_vg_shape_append_arc(shape, 0, 0, 100, 100, 25, 330); Efl_Gfx_Gradient_Stop stops[3]; stops[0].r = 255; @@ -154,7 +154,7 @@ vector_set(int x, int y, int w, int h) evas_vg_shape_stroke_color_set(shape, 0, 0, 255, 128); Efl_VG *rect = efl_add(EFL_VG_SHAPE_CLASS, root, efl_vg_name_set(efl_added, "rect")); - evas_vg_shape_shape_append_rect(rect, 0, 0, 100, 100, 0, 0); + evas_vg_shape_append_rect(rect, 0, 0, 100, 100, 0, 0); evas_vg_node_origin_set(rect, 100, 100); evas_vg_shape_fill_set(rect, lgradient); evas_vg_shape_stroke_width_set(rect, 2.0); @@ -162,7 +162,7 @@ vector_set(int x, int y, int w, int h) evas_vg_shape_stroke_color_set(rect, 255, 255, 255, 255); Efl_VG *rect1 = efl_add(EFL_VG_SHAPE_CLASS, root, efl_vg_name_set(efl_added, "rect1")); - evas_vg_shape_shape_append_rect(rect1, 0, 0, 70, 70, 0, 0); + evas_vg_shape_append_rect(rect1, 0, 0, 70, 70, 0, 0); evas_vg_node_origin_set(rect1, 50, 70); evas_vg_shape_stroke_scale_set(rect1, 2); evas_vg_shape_stroke_width_set(rect1, 8.0); @@ -170,7 +170,7 @@ vector_set(int x, int y, int w, int h) evas_vg_shape_stroke_color_set(rect1, 0, 100, 80, 100); Efl_VG *circle = efl_
[EGIT] [core/efl] master 01/03: ector: make the ector objects as shared object after eo changes. As ector objects are acessed by draw thread we need to create it as shared object in order to access it
raster pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d54b5fba6c7e7f13ca63a47fc177e4d141995a8d commit d54b5fba6c7e7f13ca63a47fc177e4d141995a8d Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Sep 28 15:28:27 2016 +0900 ector: make the ector objects as shared object after eo changes. As ector objects are acessed by draw thread we need to create it as shared object in order to access it from other thread. Note: there is some performance lag... Summary: make ector object as shared eo object to acess from other thread. Reviewers: cedric, jpeg, raster Reviewed By: jpeg, raster Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4319 --- src/lib/evas/canvas/evas_vg_gradient_linear.c | 2 ++ src/lib/evas/canvas/evas_vg_gradient_radial.c | 2 ++ src/lib/evas/canvas/evas_vg_shape.c | 2 ++ src/modules/evas/engines/gl_generic/evas_engine.c | 2 ++ src/modules/evas/engines/software_generic/evas_engine.c | 2 ++ 5 files changed, 10 insertions(+) diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.c b/src/lib/evas/canvas/evas_vg_gradient_linear.c index 11fb903..de81987 100644 --- a/src/lib/evas/canvas/evas_vg_gradient_linear.c +++ b/src/lib/evas/canvas/evas_vg_gradient_linear.c @@ -74,7 +74,9 @@ _efl_vg_gradient_linear_render_pre(Eo *obj, if (!nd->renderer) { +efl_domain_current_push(EFL_ID_DOMAIN_SHARED); nd->renderer = ector_surface_renderer_factory_new(s, ECTOR_RENDERER_GRADIENT_LINEAR_MIXIN); +efl_domain_current_pop(); } ector_renderer_transformation_set(nd->renderer, current); diff --git a/src/lib/evas/canvas/evas_vg_gradient_radial.c b/src/lib/evas/canvas/evas_vg_gradient_radial.c index a83c016..9a60d65 100644 --- a/src/lib/evas/canvas/evas_vg_gradient_radial.c +++ b/src/lib/evas/canvas/evas_vg_gradient_radial.c @@ -90,7 +90,9 @@ _efl_vg_gradient_radial_render_pre(Eo *obj, if (!nd->renderer) { +efl_domain_current_push(EFL_ID_DOMAIN_SHARED); nd->renderer = ector_surface_renderer_factory_new(s, ECTOR_RENDERER_GRADIENT_RADIAL_MIXIN); +efl_domain_current_pop(); } ector_renderer_transformation_set(nd->renderer, current); diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c index 2f47f27..9b48ab3 100644 --- a/src/lib/evas/canvas/evas_vg_shape.c +++ b/src/lib/evas/canvas/evas_vg_shape.c @@ -135,7 +135,9 @@ _efl_vg_shape_render_pre(Eo *obj EINA_UNUSED, if (!nd->renderer) { +efl_domain_current_push(EFL_ID_DOMAIN_SHARED); nd->renderer = ector_surface_renderer_factory_new(s, ECTOR_RENDERER_SHAPE_MIXIN); +efl_domain_current_pop(); } ector_renderer_transformation_set(nd->renderer, current); diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 5c5417f..61b4a60 100644 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -2489,6 +2489,7 @@ eng_ector_create(void *data EINA_UNUSED) Ector_Surface *ector; const char *ector_backend; ector_backend = getenv("ECTOR_BACKEND"); + efl_domain_current_push(EFL_ID_DOMAIN_SHARED); if (ector_backend && !strcasecmp(ector_backend, "default")) { ector = efl_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL); @@ -2503,6 +2504,7 @@ eng_ector_create(void *data EINA_UNUSED) ector = efl_add(ECTOR_CAIRO_SOFTWARE_SURFACE_CLASS, NULL); use_cairo = EINA_TRUE; } + efl_domain_current_pop(); return ector; } diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c index 2755b48..7ab8ba4 100644 --- a/src/modules/evas/engines/software_generic/evas_engine.c +++ b/src/modules/evas/engines/software_generic/evas_engine.c @@ -4254,6 +4254,7 @@ eng_ector_create(void *data EINA_UNUSED) Ector_Surface *ector; const char *ector_backend; ector_backend = getenv("ECTOR_BACKEND"); + efl_domain_current_push(EFL_ID_DOMAIN_SHARED); if (ector_backend && !strcasecmp(ector_backend, "default")) { ector = efl_add(ECTOR_SOFTWARE_SURFACE_CLASS, NULL); @@ -4264,6 +4265,7 @@ eng_ector_create(void *data EINA_UNUSED) ector = efl_add(ECTOR_CAIRO_SOFTWARE_SURFACE_CLASS, NULL); use_cairo = EINA_TRUE; } + efl_domain_current_pop(); return ector; } --
[EGIT] [core/efl] master 02/02: edje: updated the start index of vector resource from 1 to 0
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d458101a410a6ffc92d2e59f920a6246f833999f commit d458101a410a6ffc92d2e59f920a6246f833999f Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Aug 3 17:34:50 2016 -0700 edje: updated the start index of vector resource from 1 to 0 Reviewers: cedric, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4205 Signed-off-by: Cedric Bail <ced...@osg.samsung.com> --- src/bin/edje/edje_cc_handlers.c | 6 +++--- src/lib/edje/edje_calc.c| 4 ++-- src/lib/edje/edje_edit.c| 2 ++ src/lib/edje/edje_load.c| 5 - 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 2f6481c..de5b138 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -2330,7 +2330,7 @@ _handle_vector_image(void) name = parse_str(0); - ed->vg.id = 0; + ed->vg.id = -1; for (i = 0; i < edje_file->image_dir->vectors_count; ++i) { @@ -2342,7 +2342,7 @@ _handle_vector_image(void) } } - if (!ed->vg.id) + if (ed->vg.id < 0) error_and_abort(NULL, "Failed to find the vector resource :%s", name); free(name); @@ -2410,7 +2410,7 @@ st_images_vector(void) vector = edje_file->image_dir->vectors + edje_file->image_dir->vectors_count - 1; vector->entry = tmp; - vector->id = edje_file->image_dir->vectors_count; + vector->id = edje_file->image_dir->vectors_count - 1; } diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 66b1cee..64db709 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3269,7 +3269,7 @@ 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 w, h; - int new_svg = 0; + int new_svg = -1; Efl_VG *root_vg; Eina_Matrix3 matrix; Edje_Vector_Data *start, *end; @@ -3288,7 +3288,7 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U new_svg = next_state->vg.id; } } - if (new_svg) // animation with svg id change + if (new_svg >= 0) // animation with svg id change { start = _edje_ref_vector_data(ed, chosen_desc->vg.id); end = _edje_ref_vector_data(ed, new_svg); diff --git a/src/lib/edje/edje_edit.c b/src/lib/edje/edje_edit.c index 972ea88..f704a05 100644 --- a/src/lib/edje/edje_edit.c +++ b/src/lib/edje/edje_edit.c @@ -3142,6 +3142,8 @@ _edje_edit_real_part_add(Evas_Object *obj, const char *name, Edje_Part_Type type { rp->type = EDJE_PART_TYPE_VECTOR; rp->typedata.vector = calloc(1, sizeof(Edje_Real_Part_Vector)); +if (rp->typedata.vector) + rp->typedata.vector->cur.svg_id = -1; rp->object = evas_object_vg_add(ed->base->evas); } else if (ep->type == EDJE_PART_TYPE_IMAGE || ep->type == EDJE_PART_TYPE_PROXY) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 0d43704..10602e4 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -734,7 +734,10 @@ _edje_object_file_set_internal(Evas_Object *obj, const Eina_File *file, const ch case EDJE_PART_TYPE_VECTOR: rp->type = EDJE_PART_TYPE_VECTOR; rp->typedata.vector = calloc(1, sizeof(Edje_Real_Part_Vector)); - if (!rp->typedata.vector) memerr = EINA_TRUE; + if (!rp->typedata.vector) + memerr = EINA_TRUE; + else + rp->typedata.vector->cur.svg_id = -1; break; case EDJE_PART_TYPE_GROUP: --
[EGIT] [core/efl] master 05/05: edje: throw error when vector resource not found.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e077e923722be0e4a674f0ac3dc07814b3c96003 commit e077e923722be0e4a674f0ac3dc07814b3c96003 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Aug 1 13:24:34 2016 +0900 edje: throw error when vector resource not found. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4202 --- src/bin/edje/edje_cc_handlers.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 6f91af6..2f6481c 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -2330,7 +2330,7 @@ _handle_vector_image(void) name = parse_str(0); - ed->vg.id = -1; + ed->vg.id = 0; for (i = 0; i < edje_file->image_dir->vectors_count; ++i) { @@ -2342,6 +2342,9 @@ _handle_vector_image(void) } } + if (!ed->vg.id) + error_and_abort(NULL, "Failed to find the vector resource :%s", name); + free(name); } --
[EGIT] [core/efl] master 04/05: edje: Fix handling of polygon and polyline node.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=7af272d93ce49bcddb4f5171da1180a2157bf6c9 commit 7af272d93ce49bcddb4f5171da1180a2157bf6c9 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Aug 1 13:23:44 2016 +0900 edje: Fix handling of polygon and polyline node. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4203 --- src/bin/edje/edje_svg_loader.c | 12 +++- src/lib/edje/edje_data.c | 4 +++- src/lib/edje/edje_load.c | 3 ++- src/lib/edje/edje_private.h| 1 + 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index 93e30b8..bf9c37d 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -1134,7 +1134,13 @@ static Eina_Bool _attr_parse_polygon_node(void *data, const char *key, const char *value) { Svg_Node *node = data; - Svg_Polygon_Node *polygon = &(node->node.polygon); + Svg_Polygon_Node *polygon = NULL; + + if (node->type == SVG_NODE_POLYGON) + polygon = &(node->node.polygon); + else + polygon = &(node->node.polyline); + if (!strcmp(key, "points")) { @@ -1368,6 +1374,10 @@ _copy_attribute(Svg_Node *to, Svg_Node *from) to->node.polygon.points_count = from->node.polygon.points_count; to->node.polygon.points = calloc(to->node.polygon.points_count, sizeof(double)); break; +case SVG_NODE_POLYLINE: + to->node.polyline.points_count = from->node.polyline.points_count; + to->node.polyline.points = calloc(to->node.polyline.points_count, sizeof(double)); + break; default: break; } diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c index a2f4a77..b5e7b7f 100644 --- a/src/lib/edje/edje_data.c +++ b/src/lib/edje/edje_data.c @@ -361,6 +361,7 @@ _eet_for_polygon_node(void) EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(, Svg_Polygon_Node); eet = eet_data_descriptor_stream_new(); + EET_DATA_DESCRIPTOR_ADD_BASIC(eet, Svg_Polygon_Node, "points_count", points_count, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC_VAR_ARRAY(eet, Svg_Polygon_Node, "points", points, EET_T_DOUBLE); return eet; } @@ -389,7 +390,7 @@ struct { SVG_NODE_CIRCLE, "circle" }, { SVG_NODE_ELLIPSE, "ellipse" }, { SVG_NODE_POLYGON, "polygon" }, - { SVG_NODE_POLYLINE, "polygon" }, + { SVG_NODE_POLYLINE, "polyline" }, { SVG_NODE_RECT, "rect" }, { SVG_NODE_PATH, "path" }, { SVG_NODE_UNKNOWN, NULL } @@ -474,6 +475,7 @@ _edje_svg_node_eet(void) EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "rect", _edje_edd_edje_rect_node); EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "path", _edje_edd_edje_path_node); EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "polygon", _edje_edd_edje_polygon_node); + EET_DATA_DESCRIPTOR_ADD_MAPPING(eet_union, "polyline", _edje_edd_edje_polygon_node); EET_DATA_DESCRIPTOR_ADD_UNION(_edje_edd_edje_vg_node, Svg_Node, "node", node, type, eet_union); diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index acacf37..89683a5 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2518,7 +2518,8 @@ _create_vg_node(Svg_Node *node, Efl_VG *parent) _add_polyline(vg, node->node.polygon.points, node->node.polygon.points_count, EINA_TRUE); break; case SVG_NODE_POLYLINE: - _add_polyline(vg, node->node.polygon.points, node->node.polygon.points_count, EINA_FALSE); + vg = evas_vg_shape_add(parent); + _add_polyline(vg, node->node.polyline.points, node->node.polyline.points_count, EINA_FALSE); break; case SVG_NODE_ELLIPSE: vg = evas_vg_shape_add(parent); diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index da75f17..fd53254 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -3247,6 +3247,7 @@ struct _Svg_Node Svg_Circle_Node circle; Svg_Ellipse_Node ellipse; Svg_Polygon_Node polygon; +Svg_Polygon_Node polyline; Svg_Rect_Node rect; Svg_Path_Node path; }node; --
[EGIT] [core/efl] master 01/01: edje: fixed issue with applying transformation and stroke width
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e3ed888aa994d96007da15be89649a92c12bcbae commit e3ed888aa994d96007da15be89649a92c12bcbae Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jul 26 14:31:44 2016 +0900 edje: fixed issue with applying transformation and stroke width Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4192 --- src/lib/edje/edje_calc.c| 21 +++ src/lib/edje/edje_load.c| 49 ++--- src/lib/edje/edje_private.h | 2 ++ 3 files changed, 47 insertions(+), 25 deletions(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index b4a04c4..ca7a2cd 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3295,20 +3295,10 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U end = _edje_ref_vector_data(ed, new_svg); // for start vector -sx = w/start->w; -sy = h/start->h; -eina_matrix3_identity(); -eina_matrix3_scale(, sx, sy); -eina_matrix3_translate(, -start->x, -start->y); -evas_vg_node_transformation_set(start->vg, ); +_apply_transformation(start->vg, w, h, start); // for end vector -sx = w/end->w; -sy = h/end->h; -eina_matrix3_identity(); -eina_matrix3_scale(, sx, sy); -eina_matrix3_translate(, -end->x, -end->y); -evas_vg_node_transformation_set(end->vg, ); +_apply_transformation(end->vg, w, h, end); // do the interpolation if (!evas_vg_node_interpolate(ep->typedata.vector->cur.vg, start->vg, end->vg, pos)) @@ -3327,12 +3317,7 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U { if (ep->typedata.vector->cur.svg_id == chosen_desc->vg.id) // no svg file change { - sx = w/ep->typedata.vector->cur.w; - sy = h/ep->typedata.vector->cur.h; - eina_matrix3_identity(); - eina_matrix3_scale(, sx, sy); - eina_matrix3_translate(, -ep->typedata.vector->cur.x, -ep->typedata.vector->cur.y); - evas_vg_node_transformation_set(ep->typedata.vector->cur.vg, ); + _apply_transformation(ep->typedata.vector->cur.vg, w, h, >typedata.vector->cur); return; } else diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 50a1a3b..fbf85fb 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2440,7 +2440,8 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg) } // apply the stroke style property - evas_vg_shape_stroke_width_set(vg, style->stroke.width); + //@TODO HACK, fix the below api to take the stroke width as pixels + evas_vg_shape_stroke_width_set(vg, style->stroke.width/2.0); 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); @@ -2602,6 +2603,45 @@ _edje_ref_vector_data(Edje *ed, int svg_id) return vector; } +static void +_apply_stroke_scale(Efl_VG *node, double scale) +{ + Efl_VG *child; + Eina_Iterator *itr; + + if (eo_isa(node, EFL_VG_CONTAINER_CLASS)) + { +itr = efl_vg_container_children_get(node); +EINA_ITERATOR_FOREACH(itr, child) + _apply_stroke_scale(child, scale); +eina_iterator_free(itr); + } + else + { + evas_vg_shape_stroke_scale_set(node, scale); + } +} + +void +_apply_transformation(Efl_VG *root, double w, double h, Edje_Vector_Data *vg_data) +{ + double sx, sy, scale; + Eina_Matrix3 m; + + sx = w/vg_data->w; + sy = h/vg_data->h; + scale = sx < sy ? sx: sy; + eina_matrix3_identity(); + // allign hcenter and vcenter + //@TODO take care of the preserveaspectratio attribute + eina_matrix3_translate(, (w - vg_data->w * scale)/2.0, (h - vg_data->h * scale)/2.0); + eina_matrix3_scale(, scale, scale); + eina_matrix3_translate(, -vg_data->x, -vg_data->y); + evas_vg_node_transformation_set(root, ); + _apply_stroke_scale(root, scale); +} + + void _edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height, Edje_Vector_Data *data) @@ -2623,12 +2663,7 @@ _edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height, if (vector->w && vector->h) { -sx = width/vector->w; -sy = height/vector->h; -eina_matrix3_identity(); -eina_matrix3_scale(, sx, sy); -eina_matrix3_translate(, -vector->x, -vector->y); -evas_vg_node_transformation_set(root
[EGIT] [core/efl] master 05/06: edje: fixed issue with vector part state inheritance.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=12e09d2d2a78394f41c80a25c10b63c3db35d7e1 commit 12e09d2d2a78394f41c80a25c10b63c3db35d7e1 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jul 26 11:33:26 2016 +0900 edje: fixed issue with vector part state inheritance. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4190 --- src/bin/edje/edje_cc_handlers.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index de249e4..6f91af6 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -8275,7 +8275,10 @@ st_collections_group_parts_part_description_inherit(void) } case EDJE_PART_TYPE_VECTOR: { - // TODO + Edje_Part_Description_Vector *ied = (Edje_Part_Description_Vector *) ed; + Edje_Part_Description_Vector *iparent = (Edje_Part_Description_Vector *) parent; + ied->vg.set = iparent->vg.set; + ied->vg.id = iparent->vg.id; break; } } --
[EGIT] [core/efl] master 04/06: example/evas: update evas vg example.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=f38dbd39f50a5c7db42b4a3ebdc6324041092631 commit f38dbd39f50a5c7db42b4a3ebdc6324041092631 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jul 26 11:33:10 2016 +0900 example/evas: update evas vg example. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4189 --- src/examples/evas/evas-vg-batman.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/examples/evas/evas-vg-batman.c b/src/examples/evas/evas-vg-batman.c index f17636d..9d7892e 100644 --- a/src/examples/evas/evas-vg-batman.c +++ b/src/examples/evas/evas-vg-batman.c @@ -79,9 +79,9 @@ _animator(void *data EINA_UNUSED, double pos) { int next = (animation_position + 1) % (sizeof (batmans_path) / sizeof (batmans_path[0])); - evas_vg_shape_shape_interpolate(batman, - batmans_vg[next], + evas_vg_shape_shape_interpolate(batman, batmans_vg[animation_position], + batmans_vg[next], ecore_animator_pos_map(pos, ECORE_POS_MAP_SINUSOIDAL, 0.0, 0.0)); if (pos == 1.0) --
[EGIT] [core/efl] master 06/06: example/edje: updated vg example with interpolation usecase
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=56398a2035a0b5bd51de121e6c81e246cbe5987d commit 56398a2035a0b5bd51de121e6c81e246cbe5987d Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jul 26 11:45:13 2016 +0900 example/edje: updated vg example with interpolation usecase Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4191 --- src/examples/edje/Makefile.am | 4 src/examples/edje/batman1.svg | 3 +++ src/examples/edje/batman2.svg | 3 +++ src/examples/edje/favorite_off.svg | 13 + src/examples/edje/favorite_on.svg | 11 +++ src/examples/edje/svg.edc | 34 +++--- 6 files changed, 57 insertions(+), 11 deletions(-) diff --git a/src/examples/edje/Makefile.am b/src/examples/edje/Makefile.am index a9b06b1..46232f1 100644 --- a/src/examples/edje/Makefile.am +++ b/src/examples/edje/Makefile.am @@ -118,6 +118,10 @@ venus.svg \ lineargrad1.svg \ radialgrad1.svg \ yadis.svg \ +favorite_on.svg \ +favorite_off.svg \ +batman1.svg \ +batman2.svg \ en_IN/domain_name.po \ hi_IN/domain_name.po \ ta_IN/domain_name.mo \ diff --git a/src/examples/edje/batman1.svg b/src/examples/edje/batman1.svg new file mode 100644 index 000..7a9d229 --- /dev/null +++ b/src/examples/edje/batman1.svg @@ -0,0 +1,3 @@ +http://www.w3.org/2000/svg; stroke-linejoin="round" viewBox="50 -100 500 500"> + + diff --git a/src/examples/edje/batman2.svg b/src/examples/edje/batman2.svg new file mode 100644 index 000..852764b --- /dev/null +++ b/src/examples/edje/batman2.svg @@ -0,0 +1,3 @@ +http://www.w3.org/2000/svg; stroke-linejoin="round" viewBox="50 -100 500 500"> + + diff --git a/src/examples/edje/favorite_off.svg b/src/examples/edje/favorite_off.svg new file mode 100644 index 000..71bbc64 --- /dev/null +++ b/src/examples/edje/favorite_off.svg @@ -0,0 +1,13 @@ + + +http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;> +http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; x="0px" y="0px" +width="80px" height="80px" viewBox="-14 -14 80 80" enable-background="new -14 -14 80 80" xml:space="preserve"> + + diff --git a/src/examples/edje/favorite_on.svg b/src/examples/edje/favorite_on.svg new file mode 100644 index 000..c34b320 --- /dev/null +++ b/src/examples/edje/favorite_on.svg @@ -0,0 +1,11 @@ + + +http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd;> +http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; x="0px" y="0px" +width="80px" height="80px" viewBox="-14 -14 80 80" enable-background="new -14 -14 80 80" xml:space="preserve"> + + diff --git a/src/examples/edje/svg.edc b/src/examples/edje/svg.edc index a9a98e4..208d95b 100644 --- a/src/examples/edje/svg.edc +++ b/src/examples/edje/svg.edc @@ -1,4 +1,4 @@ -#define SVG_PART(bg, vg, rel1x, rel1y, rel2x, rel2y,svg_id)\ +#define SVG_PART_INTERPOLATE(bg, vg, rel1x, rel1y, rel2x, rel2y,id1, id2)\ rect { bg; \ description { state: "default" 0.0; \ color: 255 255 255 255; \ @@ -7,38 +7,40 @@ rel1.offset: 1 1; \ rel2.offset: -1 -1; \ } \ -description { state: "clicked" 0.0; \ - inherit: "default" 0.0; \ - rel1.relative: 0.0 0.0; \ - rel2.relative: 1.0 1.0; \ -} \ }\ vector { vg;\ description { state: "default" 0.0; \ color: 255 255 255 255; \ rel1.to: bg; \ rel2.to: bg; \ - image.normal: svg_id; \ + min: 130 130; \ + max: 130 130; \ + image.normal: id1; \ } \ description { state: "clicked" 0.0; \ inherit: "default" 0.0; \ + image.normal: id2; \ + min: 150 150; \ + max: 150 150; \ } \ } +#define SVG_PART(bg, vg, rel1x, rel1y, rel2x, rel2y,id1)\ + SVG_PART_INTERPOLATE(bg, vg, rel1x, rel1y, rel2x, rel2y,id1, id1) #define SVG_PROGRAM(bg, vg) \ program { bg; \ signal: "mouse,down,1"; \ source: vg; \ action: STATE_SET "clicked"; \ -transition: LINEAR 0.5; \ -target: bg; \ +transition: LINEAR .2; \ +target: vg; \ }\ program { vg; \ signal: "mouse,up,1"; \ source: vg; \ action: STATE_SET "default"; \ -transitio
[EGIT] [core/efl] master 03/06: efl/interface: fixed the shape interpolation implementation.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0023f20d85f5237448aed177d2ca9c2195063bbb commit 0023f20d85f5237448aed177d2ca9c2195063bbb Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jul 26 11:32:59 2016 +0900 efl/interface: fixed the shape interpolation implementation. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4188 --- src/lib/efl/interfaces/efl_gfx_shape.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 11b38a6..d0e3cad 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -271,13 +271,13 @@ _efl_gfx_shape_equal_commands_internal(Efl_Gfx_Shape_Data *a, static inline double interpolate(double from, double to, double pos_map) { - return (from * pos_map) + (to * (1.0 - pos_map)); + return (from * (1.0 - pos_map)) + (to * pos_map); } static inline int interpolatei(int from, int to, double pos_map) { - return (from * pos_map) + (to * (1.0 - pos_map)); + return (from * (1.0 - pos_map)) + (to * pos_map); } typedef struct _Efl_Gfx_Property Efl_Gfx_Property; @@ -399,11 +399,19 @@ _efl_gfx_shape_interpolate(Eo *obj, Efl_Gfx_Shape_Data *pd, } - efl_gfx_shape_stroke_scale_set(obj, interpolate(property_to.scale, property_from.scale, pos_map)); - efl_gfx_shape_stroke_color_set(obj, interpolatei(property_to.r, property_from.r, pos_map), interpolatei(property_to.g, property_from.g, pos_map), interpolatei(property_to.b, property_from.b, pos_map), interpolatei(property_to.a, property_from.a, pos_map)); - efl_gfx_color_set(obj, interpolatei(property_to.fr, property_from.fr, pos_map), interpolatei(property_to.fg, property_from.fg, pos_map), interpolatei(property_to.fb, property_from.fb, pos_map), interpolatei(property_to.fa, property_from.fa, pos_map)); - efl_gfx_shape_stroke_width_set(obj, interpolate(property_to.w, property_from.w, pos_map)); - efl_gfx_shape_stroke_location_set(obj, interpolate(property_to.centered, property_from.centered, pos_map)); + efl_gfx_shape_stroke_scale_set(obj, interpolate(property_from.scale, property_to.scale, pos_map)); + efl_gfx_shape_stroke_color_set(obj, + interpolatei(property_from.r, property_to.r, pos_map), + interpolatei(property_from.g, property_to.g, pos_map), + interpolatei(property_from.b, property_to.b, pos_map), + interpolatei(property_from.a, property_to.a, pos_map)); + efl_gfx_color_set(obj, + interpolatei(property_from.fr, property_to.fr, pos_map), + interpolatei(property_from.fg, property_to.fg, pos_map), + interpolatei(property_from.fb, property_to.fb, pos_map), + interpolatei(property_from.fa, property_to.fa, pos_map)); + efl_gfx_shape_stroke_width_set(obj, interpolate(property_from.w, property_to.w, pos_map)); + efl_gfx_shape_stroke_location_set(obj, interpolate(property_from.centered, property_to.centered, pos_map)); efl_gfx_shape_stroke_dash_set(obj, dash, property_to.dash_length); efl_gfx_shape_stroke_cap_set(obj, pos_map < 0.5 ? property_from.c : property_to.c); efl_gfx_shape_stroke_join_set(obj, pos_map < 0.5 ? property_from.j : property_to.j); --
[EGIT] [core/efl] master 02/02: edje/svg: added _edje_svg_node_free() function
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9be9da17bfacaa4d43f2ba145a6be3f214cd0a2f commit 9be9da17bfacaa4d43f2ba145a6be3f214cd0a2f Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jul 7 16:29:21 2016 +0900 edje/svg: added _edje_svg_node_free() function Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4143 --- src/bin/edje/edje_cc_out.c | 1 + src/lib/edje/edje_load.c| 73 + src/lib/edje/edje_private.h | 1 + 3 files changed, 75 insertions(+) diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index f164361..0f969fa 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -1271,6 +1271,7 @@ data_write_vectors(Eet_File *ef, int *vector_num) *vector_num += 1; eina_file_close(f); found = EINA_TRUE; + _edje_svg_node_free(root); break; } if (!found) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 69feb92..98a89c9 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2566,6 +2566,7 @@ _edje_ref_vector_data(Edje *ed, int svg_id) } vector->vg = root; ed->vector_cache = eina_list_append(ed->vector_cache, vector); + _edje_svg_node_free(node); return vector; } @@ -2659,3 +2660,75 @@ edje_3d_object_add(Evas_Object *obj, Eo **root_node, Eo *scene) return EINA_TRUE; } + +static void +_svg_style_gradient_free(Svg_Style_Gradient *grad) +{ + Efl_Gfx_Gradient_Stop *stop; + + if (!grad) return; + + eina_stringshare_del(grad->id); + eina_stringshare_del(grad->ref); + free(grad->radial); + free(grad->linear); + + EINA_LIST_FREE(grad->stops, stop) + { +free(stop); + } + free(grad); +} + +static void +_node_style_free(Svg_Style_Property *style) +{ + if (!style) return; + + _svg_style_gradient_free(style->fill.paint.gradient); + eina_stringshare_del(style->fill.paint.url); + _svg_style_gradient_free(style->stroke.paint.gradient); + eina_stringshare_del(style->stroke.paint.url); + free(style); +} + +EAPI void +_edje_svg_node_free(Svg_Node *node) +{ + Svg_Node *child; + Svg_Style_Gradient *grad; + + if (!node) return; + + EINA_LIST_FREE(node->child, child) + { +_edje_svg_node_free(child); + } + + eina_stringshare_del(node->id); + free(node->transform); + _node_style_free(node->style); + switch (node->type) + { +case SVG_NODE_PATH: + eina_stringshare_del(node->node.path.path); + break; +case SVG_NODE_POLYGON: +case SVG_NODE_POLYLINE: + free(node->node.polygon.points); + break; +case SVG_NODE_DOC: + _edje_svg_node_free(node->node.doc.defs); + break; +case SVG_NODE_DEFS: + EINA_LIST_FREE(node->node.defs.gradients, grad) + { +_svg_style_gradient_free(grad); + } + break; +default: + break; + } + free(node); +} + diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index 3b06513..9faded9 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -3273,6 +3273,7 @@ void _edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height, Edje_Vector_Data * _edje_ref_vector_data(Edje *ed, int svg_id); +EAPI void _edje_svg_node_free(Svg_Node *node); #ifdef HAVE_LIBREMIX #include --
[EGIT] [core/efl] master 01/02: svg/loader: use stringshare instead of malloc for storing string.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=80413dda8c8797e719881f9df070ded9b24b88db commit 80413dda8c8797e719881f9df070ded9b24b88db Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jul 7 16:27:17 2016 +0900 svg/loader: use stringshare instead of malloc for storing string. Reviewers: cedric, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4142 --- src/bin/edje/edje_svg_loader.c | 24 src/lib/edje/edje_private.h| 10 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index 51224b1..93e30b8 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -57,12 +57,12 @@ _skip_space(const char *str, const char *end) return (char *)str; } -static inline char * +static inline Eina_Stringshare * _copy_id(const char* str) { if (str == NULL) return NULL; - return strdup(str); + return eina_stringshare_add(str); } static const char * @@ -210,7 +210,7 @@ _parse_dash_array(const char *str, Efl_Gfx_Dash** dash, int *length) } #endif -static char * +static Eina_Stringshare * _id_from_url(const char *url) { char tmp[50]; @@ -230,7 +230,7 @@ static char * } tmp[i] = '\0'; - return strdup(tmp); + return eina_stringshare_add(tmp); } static unsigned char @@ -407,7 +407,7 @@ static const struct { }; static inline void -_to_color(const char *str, int *r, int *g, int *b, char** ref) +_to_color(const char *str, int *r, int *g, int *b, Eina_Stringshare** ref) { unsigned int i, len = strlen(str); char *red, *green, *blue; @@ -953,7 +953,7 @@ _attr_parse_path_node(void *data, const char *key, const char *value) if (!strcmp(key, "d")) { -path->path = strdup(value); +path->path = eina_stringshare_add(value); } else if (!strcmp(key, "style")) { @@ -1240,13 +1240,13 @@ _create_rect_node(Svg_Node *parent, const char *buf, unsigned buflen) return node; } -static char * +static Eina_Stringshare * _id_from_href(const char *href) { href = _skip_space(href, NULL); if ((*href) == '#') href++; - return strdup(href); + return eina_stringshare_add(href); } static Svg_Node* @@ -1266,7 +1266,7 @@ _get_defs_node(Svg_Node *node) } static Svg_Node* -_find_child_by_id(Svg_Node *node, char *id) +_find_child_by_id(Svg_Node *node, const char *id) { Eina_List *l; Svg_Node *child; @@ -1362,7 +1362,7 @@ _copy_attribute(Svg_Node *to, Svg_Node *from) to->node.rect.ry = from->node.rect.ry; break; case SVG_NODE_PATH: - to->node.path.path = strdup(from->node.path.path); + to->node.path.path = eina_stringshare_add(from->node.path.path); break; case SVG_NODE_POLYGON: to->node.polygon.points_count = from->node.polygon.points_count; @@ -1397,7 +1397,7 @@ static Eina_Bool _attr_parse_use_node(void *data, const char *key, const char *value) { Svg_Node *defs, *node_from, *node = data; - char *id; + Eina_Stringshare *id; if (!strcmp(key, "xlink:href")) { @@ -1405,7 +1405,7 @@ _attr_parse_use_node(void *data, const char *key, const char *value) defs = _get_defs_node(node); node_from = _find_child_by_id(defs, id); _clone_node(node_from, node); -free(id); +eina_stringshare_del(id); } else { diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h index b7d1637..3b06513 100644 --- a/src/lib/edje/edje_private.h +++ b/src/lib/edje/edje_private.h @@ -3122,7 +3122,7 @@ struct _Svg_Rect_Node struct _Svg_Path_Node { - char *path; + Eina_Stringshare *path; }; struct _Svg_Polygon_Node @@ -3157,8 +3157,8 @@ struct _Svg_Radial_Gradient struct _Svg_Style_Gradient { Svg_Gradient_Type type; - char *id; - char *ref; + Eina_Stringshare *id; + Eina_Stringshare *ref; Efl_Gfx_Gradient_Spread spread; Eina_List *stops; // Efl_Gfx_Gradient_Stop Svg_Radial_Gradient *radial; @@ -3173,7 +3173,7 @@ struct _Svg_Paint Eina_Bool none; Eina_Bool cur_color; Svg_Style_Gradient *gradient; - char *url; + Eina_Stringshare*url; }; enum _Svg_Fill_Flags @@ -3234,7 +3234,7 @@ struct _Svg_Node Svg_Node_Typetype; Svg_Node*parent; Eina_List *child; - char*id; + Eina_Stringshare*id; Svg_Style_Property *style; Eina_Matrix3*transform; union --
[EGIT] [core/efl] master 02/02: svg/example: updated svg example with gradient svg files
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0fc151cddc4cdb50661d11a124d42a9d42fa9875 commit 0fc151cddc4cdb50661d11a124d42a9d42fa9875 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jul 7 11:20:11 2016 +0900 svg/example: updated svg example with gradient svg files Reviewers: cedric, Hermet, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4139 --- src/examples/edje/lineargrad1.svg | 20 + src/examples/edje/radialgrad1.svg | 19 + src/examples/edje/svg.edc | 52 ++- src/examples/edje/tiger.svg | 829 ++ src/examples/edje/venus.svg | 5 + src/examples/edje/yadis.svg | 16 + 6 files changed, 924 insertions(+), 17 deletions(-) diff --git a/src/examples/edje/lineargrad1.svg b/src/examples/edje/lineargrad1.svg new file mode 100644 index 000..c7cb0c5 --- /dev/null +++ b/src/examples/edje/lineargrad1.svg @@ -0,0 +1,20 @@ +http://www.w3.org/2000/svg; viewBox="0 0 100 100"> + + + + + + + + \ No newline at end of file diff --git a/src/examples/edje/radialgrad1.svg b/src/examples/edje/radialgrad1.svg new file mode 100644 index 000..cae0575 --- /dev/null +++ b/src/examples/edje/radialgrad1.svg @@ -0,0 +1,19 @@ +http://www.w3.org/2000/svg; viewBox="0 0 100 100"> + + + + + + + + \ No newline at end of file diff --git a/src/examples/edje/svg.edc b/src/examples/edje/svg.edc index 700db34..a9a98e4 100644 --- a/src/examples/edje/svg.edc +++ b/src/examples/edje/svg.edc @@ -61,27 +61,40 @@ collections { vector: "scion.svg"; vector: "eee.svg"; vector: "google.svg"; - + vector: "tiger.svg"; + vector: "venus.svg"; + vector: "lineargrad1.svg"; + vector: "radialgrad1.svg"; + vector: "yadis.svg"; } group { name: "svg-test"; parts { - SVG_PART("bg1", "vg1", 0.0, 0.0, .25, .25,"dst.svg") - SVG_PART("bg2", "vg2", 0.25, 0.0, .5, .25,"atom.svg") - SVG_PART("bg3", "vg3", 0.5, 0.0, .75, .25,"bojo.svg") - SVG_PART("bg4", "vg4", 0.75, 0.0, 1.0, .25,"bzrfeed.svg") - SVG_PART("bg5", "vg5", 0.0, 0.25, .25, .5,"yinyang.svg") - SVG_PART("bg6", "vg6", 0.25, 0.25, .5, .5,"ubuntu.svg") - SVG_PART("bg7", "vg7", 0.5, 0.25, .75, .5,"duke.svg") - SVG_PART("bg8", "vg8", 0.75, 0.25, 1.0, .5,"cartman.svg") - SVG_PART("bg9", "vg9", 0.0, 0.5, .25, .75,"ibm.svg") - SVG_PART("bg10", "vg10", 0.25, 0.5, .5, .75,"hg0.svg") - SVG_PART("bg11", "vg11", 0.5, 0.5, .75, .75,"fsm.svg") - SVG_PART("bg12", "vg12", 0.75, 0.5, 1.0, .75,"osa.svg") - SVG_PART("bg13", "vg13", 0.0, 0.75, .25, 1.0,"wikimedia.svg") - SVG_PART("bg14", "vg14", 0.25, 0.75, .5, 1.0,"scion.svg") - SVG_PART("bg15", "vg15", 0.5, 0.75, .75, 1.0,"eee.svg") - SVG_PART("bg16", "vg16", 0.75, 0.75, 1.0, 1.0,"google.svg") + SVG_PART("bg1", "vg1", 0.0, 0.0, .2, .2,"dst.svg") + SVG_PART("bg2", "vg2", 0.2, 0.0, .4, .2,"atom.svg") + SVG_PART("bg3", "vg3", 0.4, 0.0, .6, .2,"bojo.svg") + SVG_PART("bg4", "vg4", 0.6, 0.0, 0.8, .2,"bzrfeed.svg") + SVG_PART("bg5", "vg5", 0.8, 0.0, 1.0, .2,"yinyang.svg") + + SVG_PART("bg6", "vg6", 0.0, 0.2, .2, .4,"ibm.svg") + SVG_PART("bg7", "vg7", 0.2, 0.2, .4, .4,"ubuntu.svg") + SVG_PART("bg8", "vg8", 0.4, 0.2, .6, .4,"hg0.svg") + SVG_PART("bg9", "vg9", 0.6, 0.2, .8, .4,"duke.svg") + SVG_PART("bg10", "vg10", 0.8, 0.2, 1.0, .4,"cartman.svg") + + SVG_PART("bg11", "vg11", 0.0, 0.4, .2, .6,"fsm.svg") + SVG_PART("bg12", "vg12", 0.2, 0.4, .4, .6,"osa.svg") + SVG_PART("bg13", "vg13", 0.4, 0.4, .6, .6,"wikimedia.svg") + SVG_PART("bg14", "vg14", 0.6, 0.4, .8, .6,"eee.svg") + SVG_PART(&
[EGIT] [core/efl] master 01/02: svg/loader: parse the style attribute in doc node
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9d6582413a6791554d9b5780669570bccf2e9868 commit 9d6582413a6791554d9b5780669570bccf2e9868 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jul 7 11:20:04 2016 +0900 svg/loader: parse the style attribute in doc node Reviewers: cedric, Hermet, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4138 --- src/bin/edje/edje_svg_loader.c | 28 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index 0dc5d13..51224b1 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -659,27 +659,39 @@ parse_length(const char *str, Svg_Length_Type *type) return value; } +static Eina_Bool _parse_style_attr(void *data, const char *key, const char *value); +static Eina_Bool _attr_style_node(void *data, const char *str); + static Eina_Bool _attr_parse_svg_node(void *data, const char *key, const char *value) { - Svg_Doc_Node *node = data; + Svg_Node *node = data; + Svg_Doc_Node *doc = &(node->node.doc); Svg_Length_Type type; // @TODO handle lenght unit. if (!strcmp(key, "width")) { -node->width = parse_length(value, ); +doc->width = parse_length(value, ); } else if (!strcmp(key, "height")) { -node->height = parse_length(value, ); +doc->height = parse_length(value, ); } else if (!strcmp(key, "viewBox")) { -if (_parse_number(, >vx)) - if (_parse_number(, >vy)) -if (_parse_number(, >vw)) - _parse_number(, >vh); +if (_parse_number(, >vx)) + if (_parse_number(, >vy)) +if (_parse_number(, >vw)) + _parse_number(, >vh); + } + else if (!strcmp(key, "style")) + { +_attr_style_node(node, value); + } + else + { +_parse_style_attr(node, key, value); } return EINA_TRUE; } @@ -923,7 +935,7 @@ _create_svg_node(Svg_Node *parent, const char *buf, unsigned buflen) Svg_Node *node = _create_node(parent, SVG_NODE_DOC); eina_simple_xml_attributes_parse(buf, buflen, -_attr_parse_svg_node, >node.doc); +_attr_parse_svg_node, node); return node; } --
[EGIT] [core/efl] master 01/01: svg/loader: refactored the copy of structure.
hermet pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=18fd4453d0d390d626f9e15c01f002a34f074bdd commit 18fd4453d0d390d626f9e15c01f002a34f074bdd Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jul 7 10:42:03 2016 +0900 svg/loader: refactored the copy of structure. Reviewers: cedric, jpeg, Hermet Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4137 --- src/bin/edje/edje_svg_loader.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index 8870c41..0dc5d13 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -1281,11 +1281,7 @@ _clone_grad_stops(Eina_List *from) Efl_Gfx_Gradient_Stop *new_stop; new_stop = calloc(1, sizeof(Efl_Gfx_Gradient_Stop)); -new_stop->r = stop->r; -new_stop->g = stop->g; -new_stop->b = stop->b; -new_stop->a = stop->a; - +memcpy(new_stop, stop, sizeof(Efl_Gfx_Gradient_Stop)); res = eina_list_append(res, new_stop); } @@ -1308,19 +1304,12 @@ _clone_gradient(Svg_Style_Gradient *from) if (grad->type == SVG_LINEAR_GRADIENT) { grad->linear = calloc(1, sizeof(Svg_Linear_Gradient)); -grad->linear->x1 = from->linear->x1; -grad->linear->y1 = from->linear->y1; -grad->linear->x2 = from->linear->x2; -grad->linear->y1 = from->linear->y2; +memcpy(grad->linear, from->linear, sizeof(Svg_Linear_Gradient)); } else if (grad->type == SVG_RADIAL_GRADIENT) { grad->radial = calloc(1, sizeof(Svg_Radial_Gradient)); -grad->radial->cx = from->radial->cx; -grad->radial->cy = from->radial->cy; -grad->radial->fx = from->radial->fx; -grad->radial->fy = from->radial->fy; -grad->radial->r = from->radial->r; +memcpy(grad->radial, from->radial, sizeof(Svg_Radial_Gradient)); } return grad; --
[EGIT] [core/efl] master 04/05: edje: fix parsing and and visualizing gradients.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=522b82b026e9233b0724beb697096ac53f148064 commit 522b82b026e9233b0724beb697096ac53f148064 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Jul 6 12:51:56 2016 -0700 edje: fix parsing and and visualizing gradients. Reviewers: jpeg, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4126 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/bin/edje/edje_svg_loader.c | 148 + src/lib/edje/edje_data.c | 4 +- src/lib/edje/edje_load.c | 33 + src/lib/edje/edje_private.h| 4 +- 4 files changed, 155 insertions(+), 34 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index e8880e0..8870c41 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -1269,6 +1269,29 @@ _find_child_by_id(Svg_Node *node, char *id) return NULL; } +static Eina_List * +_clone_grad_stops(Eina_List *from) +{ + Efl_Gfx_Gradient_Stop *stop; + Eina_List *l; + Eina_List *res = NULL; + + EINA_LIST_FOREACH(from, l, stop) + { +Efl_Gfx_Gradient_Stop *new_stop; + +new_stop = calloc(1, sizeof(Efl_Gfx_Gradient_Stop)); +new_stop->r = stop->r; +new_stop->g = stop->g; +new_stop->b = stop->b; +new_stop->a = stop->a; + +res = eina_list_append(res, new_stop); + } + + return res; +} + static Svg_Style_Gradient * _clone_gradient(Svg_Style_Gradient *from) { @@ -1279,8 +1302,9 @@ _clone_gradient(Svg_Style_Gradient *from) grad= calloc(1, sizeof(Svg_Style_Gradient)); grad->type = from->type; grad->id = _copy_id(from->id); + grad->ref = _copy_id(from->ref); grad->spread = from->spread; - grad->stops = eina_list_clone(from->stops); + grad->stops = _clone_grad_stops(from->stops); if (grad->type == SVG_LINEAR_GRADIENT) { grad->linear = calloc(1, sizeof(Svg_Linear_Gradient)); @@ -1313,9 +1337,6 @@ _copy_attribute(Svg_Node *to, Svg_Node *from) } // copy style attribute; memcpy(to->style, from->style, sizeof(Svg_Style_Property)); - // copy gradient - to->style->fill.gradient = _clone_gradient(from->style->fill.gradient); - to->style->stroke.gradient = _clone_gradient(from->style->stroke.gradient); // copy node attribute switch (from->type) @@ -1448,6 +1469,23 @@ static const struct { FIND_FACTORY(group, group_tags); FIND_FACTORY(graphics, graphics_tags); +Efl_Gfx_Gradient_Spread +_parse_spread_value(const char *value) +{ + Efl_Gfx_Gradient_Spread spread = EFL_GFX_GRADIENT_SPREAD_PAD; + + if (!strcmp(value, "reflect")) + { +spread = EFL_GFX_GRADIENT_SPREAD_REFLECT; + } + else if (!strcmp(value, "repeat")) + { +spread = EFL_GFX_GRADIENT_SPREAD_REPEAT; + } + + return spread; +} + static void _handle_radial_cx_attr(Svg_Radial_Gradient* radial, const char *value) { @@ -1512,7 +1550,17 @@ _attr_parse_radial_gradient_node(void *data, const char *key, const char *value) } if (!strcmp(key, "id")) - grad->id = _copy_id(value); + { +grad->id = _copy_id(value); + } + else if (!strcmp(key, "spreadMethod")) + { +grad->spread = _parse_spread_value(value); + } + else if (!strcmp(key, "xlink:href")) + { +grad->ref = _id_from_href(value); + } return EINA_TRUE; } @@ -1547,6 +1595,12 @@ _attr_parse_stops(void *data, const char *key, const char *value) { _to_color(value, >r, >g, >b, NULL); } + else if (!strcmp(key, "style")) + { +eina_simple_xml_attribute_w3c_parse(value, +_attr_parse_stops, data); + } + return EINA_TRUE; } @@ -1599,7 +1653,7 @@ _attr_parse_linear_gradient_node(void *data, const char *key, const char *value) unsigned int i; int sz = strlen(key); - for (i = 0; i < sizeof (radial_tags) / sizeof(linear_tags[0]); i++) + for (i = 0; i < sizeof (linear_tags) / sizeof(linear_tags[0]); i++) if (linear_tags[i].sz - 1 == sz && !strncmp(linear_tags[i].tag, key, sz)) { linear_tags[i].tag_handler(linear, value); @@ -1610,6 +1664,14 @@ _attr_parse_linear_gradient_node(void *data, const char *key, const char *value) { grad->id = _copy_id(value); } + else if (!strcmp(key, "spreadMethod")) + { +grad->spread = _parse_spread_value(value); + } + else if (!strcmp(key, "xlink:href")) + { +grad->ref = _id_from_href(value); + } return EINA_TRUE; } @@ -1763,11 +1825,6 @@ _
[EGIT] [core/efl] master 01/02: elm_frame: updated the eo prefix and documentation
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=53035f23e6d4d0cfc93356c1776d8a2a58d18f91 commit 53035f23e6d4d0cfc93356c1776d8a2a58d18f91 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Jul 4 20:10:29 2016 +0900 elm_frame: updated the eo prefix and documentation Summary: No idea what else can be done with this widget. Reviewers: jpeg, cedric, woohyun Subscribers: raster, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3930 --- src/Makefile_Elementary.am | 10 ++--- src/lib/elementary/Makefile.am | 10 ++--- src/lib/elementary/{elm_frame.c => efl_ui_frame.c} | 46 +++--- .../elementary/{elm_frame.eo => efl_ui_frame.eo} | 10 +++-- .../{elm_frame_legacy.h => efl_ui_frame_legacy.h} | 2 +- .../{elm_widget_frame.h => efl_ui_widget_frame.h} | 24 +-- src/lib/elementary/elm_frame.h | 4 +- src/lib/elementary/elm_frame_eo.h | 1 - 8 files changed, 55 insertions(+), 52 deletions(-) diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index 12d5961..9011b24 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -30,7 +30,7 @@ elm_public_eolian_files = \ lib/elementary/efl_ui_flip.eo \ lib/elementary/efl_ui_flip_internal_part.eo \ lib/elementary/elm_flipselector.eo \ - lib/elementary/elm_frame.eo \ + lib/elementary/efl_ui_frame.eo \ lib/elementary/elm_gengrid.eo \ lib/elementary/elm_gengrid_pan.eo \ lib/elementary/elm_genlist.eo \ @@ -228,7 +228,7 @@ includesunstable_HEADERS = \ lib/elementary/elm_widget_fileselector_entry.h \ lib/elementary/efl_ui_widget_flip.h \ lib/elementary/elm_widget_flipselector.h \ - lib/elementary/elm_widget_frame.h \ + lib/elementary/efl_ui_widget_frame.h \ lib/elementary/elm_widget_gengrid.h \ lib/elementary/elm_widget_genlist.h \ lib/elementary/elm_widget_glview.h \ @@ -395,8 +395,8 @@ includesub_HEADERS = \ lib/elementary/elm_focus_item.h \ lib/elementary/elm_font.h \ lib/elementary/elm_frame.h \ - lib/elementary/elm_frame_eo.h \ - lib/elementary/elm_frame_legacy.h \ + lib/elementary/efl_ui_frame.eo.h \ + lib/elementary/efl_ui_frame_legacy.h \ lib/elementary/elm_gen.h \ lib/elementary/elm_general.h \ lib/elementary/elm_gengrid.h \ @@ -612,7 +612,7 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/efl_ui_internal_text_interactive.c \ lib/elementary/elm_flipselector.c \ lib/elementary/elm_font.c \ - lib/elementary/elm_frame.c \ + lib/elementary/efl_ui_frame.c \ lib/elementary/elm_gengrid.c \ lib/elementary/elm_genlist.c \ lib/elementary/elm_gesture_layer.c \ diff --git a/src/lib/elementary/Makefile.am b/src/lib/elementary/Makefile.am index 3b8cd0e..53739bd 100644 --- a/src/lib/elementary/Makefile.am +++ b/src/lib/elementary/Makefile.am @@ -34,7 +34,7 @@ elm_eolian_files = \ efl_ui_flip.eo \ efl_ui_flip_internal_part.eo \ elm_flipselector.eo \ - elm_frame.eo \ + efl_ui_frame.eo \ elm_gengrid.eo \ elm_gengrid_pan.eo \ elm_genlist.eo \ @@ -185,7 +185,7 @@ includesunstable_HEADERS = \ elm_widget_fileselector_entry.h \ efl_ui_widget_flip.h \ elm_widget_flipselector.h \ - elm_widget_frame.h \ + efl_ui_widget_frame.h \ elm_widget_gengrid.h \ elm_widget_genlist.h \ elm_widget_glview.h \ @@ -340,8 +340,8 @@ includesub_HEADERS = \ elm_focus_item.h \ elm_font.h \ elm_frame.h \ - elm_frame_eo.h \ - elm_frame_legacy.h \ + efl_ui_frame.eo.h \ + efl_ui_frame_legacy.h \ elm_gen.h \ elm_general.h \ elm_gengrid.h \ @@ -548,7 +548,7 @@ libelementary_la_SOURCES = \ efl_ui_flip.c \ elm_flipselector.c \ elm_font.c \ - elm_frame.c \ + efl_ui_frame.c \ elm_gengrid.c \ elm_genlist.c \ elm_gesture_layer.c \ diff --git a/src/lib/elementary/elm_frame.c b/src/lib/elementary/efl_ui_frame.c similarity index 74% rename from src/lib/elementary/elm_frame.c rename to src/lib/elementary/efl_ui_frame.c index b89d5a2..7d8a0bb 100644 --- a/src/lib/elementary/elm_frame.c +++ b/src/lib/elementary/efl_ui_frame.c @@ -7,12 +7,12 @@ #include #include "elm_priv.h" -#include "elm_widget_frame.h" +#include "efl_ui_widget_frame.h" #include "elm_widget_layout.h" -#define MY_CLASS ELM_FRAME_CLASS +#define MY_CLASS EFL_UI_FRAME_CLASS -#define MY_CLASS_NAME "Elm_Frame" +#define MY_CLASS_NAME "Efl_Ui_Frame" #define MY_CLASS_NAME_LEGACY "elm_fram
[EGIT] [core/efl] master 01/03: evas vg: don't apply transformation to the origin point
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=6e6c85293e221685614b77cfb0fe34998c8a8542 commit 6e6c85293e221685614b77cfb0fe34998c8a8542 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Jun 24 15:15:43 2016 +0900 evas vg: don't apply transformation to the origin point Summary: Which will apply translate property twice once to shape and once to origin. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4086 --- src/lib/evas/canvas/evas_vg_shape.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c index f4d74da..2aec11b 100644 --- a/src/lib/evas/canvas/evas_vg_shape.c +++ b/src/lib/evas/canvas/evas_vg_shape.c @@ -129,14 +129,11 @@ _efl_vg_shape_render_pre(Eo *obj EINA_UNUSED, { Efl_VG_Shape_Data *pd = data; Efl_VG_Data *fill, *stroke_fill, *stroke_marker, *mask; - double xn = nd->x, yn = nd->y ; if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ; nd->flags = EFL_GFX_CHANGE_FLAG_NONE; - if(parent) eina_matrix3_point_transform(parent, nd->x, nd->y, , ); - EFL_VG_COMPUTE_MATRIX(current, parent, nd); fill = _evas_vg_render_pre(pd->fill, s, current); @@ -150,7 +147,7 @@ _efl_vg_shape_render_pre(Eo *obj EINA_UNUSED, } ector_renderer_transformation_set(nd->renderer, current); - ector_renderer_origin_set(nd->renderer, xn, yn); + ector_renderer_origin_set(nd->renderer, nd->x, nd->y); ector_renderer_color_set(nd->renderer, nd->r, nd->g, nd->b, nd->a); ector_renderer_visibility_set(nd->renderer, nd->visibility); ector_renderer_mask_set(nd->renderer, mask ? mask->renderer : NULL); --
[EGIT] [core/efl] master 02/03: edje: fix the order of applying transformation when creating vg tree.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=48d3abf84bdf355fb62a6db745e908cbd8ded1c0 commit 48d3abf84bdf355fb62a6db745e908cbd8ded1c0 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Jun 24 15:15:54 2016 +0900 edje: fix the order of applying transformation when creating vg tree. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4087 --- src/lib/edje/edje_calc.c | 6 +++--- src/lib/edje/edje_load.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 7c0e98a..2bf8204 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3288,16 +3288,16 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U sx = w/start->w; sy = h/start->h; eina_matrix3_identity(); -eina_matrix3_translate(, -start->x, -start->y); eina_matrix3_scale(, sx, sy); +eina_matrix3_translate(, -start->x, -start->y); evas_vg_node_transformation_set(start->vg, ); // for end vector sx = w/end->w; sy = h/end->h; eina_matrix3_identity(); -eina_matrix3_translate(, -end->x, -end->y); eina_matrix3_scale(, sx, sy); +eina_matrix3_translate(, -end->x, -end->y); evas_vg_node_transformation_set(end->vg, ); // do the interpolation @@ -3320,8 +3320,8 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U sx = w/ep->typedata.vector->cur.w; sy = h/ep->typedata.vector->cur.h; eina_matrix3_identity(); - eina_matrix3_translate(, -ep->typedata.vector->cur.x, -ep->typedata.vector->cur.y); eina_matrix3_scale(, sx, sy); + eina_matrix3_translate(, -ep->typedata.vector->cur.x, -ep->typedata.vector->cur.y); evas_vg_node_transformation_set(ep->typedata.vector->cur.vg, ); return; } diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 8e71e9b6..facc9ae 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2589,8 +2589,8 @@ _edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height, sx = width/vector->w; sy = height/vector->h; eina_matrix3_identity(); -eina_matrix3_translate(, -vector->x, -vector->y); eina_matrix3_scale(, sx, sy); +eina_matrix3_translate(, -vector->x, -vector->y); evas_vg_node_transformation_set(root, ); } --
[EGIT] [core/efl] master 03/03: svg/example: upload the correct svg file
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3ce7aee940ac3dc0c1c38bd99efd08f5ab045da0 commit 3ce7aee940ac3dc0c1c38bd99efd08f5ab045da0 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Fri Jun 24 15:16:03 2016 +0900 svg/example: upload the correct svg file Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4088 --- src/examples/edje/dst.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/edje/dst.svg b/src/examples/edje/dst.svg index 16d1baa..bce75d8 100755 --- a/src/examples/edje/dst.svg +++ b/src/examples/edje/dst.svg @@ -1,5 +1,5 @@ http://www.w3.org/2000/svg; viewBox="0 0 100 100" > - + --
[EGIT] [core/efl] master 07/11: edje/svg: add few error message reagrding parsing and storing of svg file.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=de7809a868249e25cbc5422fd0b93748a87d01f4 commit de7809a868249e25cbc5422fd0b93748a87d01f4 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 23 10:12:20 2016 -0700 edje/svg: add few error message reagrding parsing and storing of svg file. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4077 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/bin/edje/edje_cc_out.c | 10 +- src/lib/edje/edje_load.c | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index f3116ac..5c07fbb 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -1243,6 +1243,7 @@ data_write_vectors(Eet_File *ef, int *vector_num) Eina_File *f = NULL; Edje_Vector_Directory_Entry *vector; Eina_Strbuf *buf; + Eina_Bool found = EINA_FALSE; if (!((edje_file) && (edje_file->image_dir))) return; @@ -1261,13 +1262,20 @@ data_write_vectors(Eet_File *ef, int *vector_num) f = eina_file_open(eina_strbuf_string_get(buf), EINA_FALSE); if (!f) continue; root = _svg_load(f, NULL); + if(!root) + 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); - eet_data_write(ef, svg_node_eet, eina_strbuf_string_get(buf), root, compress_mode); + if(!eet_data_write(ef, svg_node_eet, eina_strbuf_string_get(buf), root, compress_mode)) + 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; break; } +if (!found) + error_and_abort(ef, "Unable to find the svg :%s", vector->entry); +found = EINA_FALSE; } eina_strbuf_free(buf); diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 951e36b..8e71e9b6 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2545,6 +2545,7 @@ _edje_ref_vector_data(Edje *ed, int svg_id) if (!node || (node->type != SVG_NODE_DOC)) { +ERR("Failed to read Data from Eet for svg : %d", svg_id); root = NULL; } else --
[EGIT] [core/efl] master 08/11: canvas/vg: fix the reference issue in evas_vg objects.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e73533ebbcbd98f426e477125166e938a911fc15 commit e73533ebbcbd98f426e477125166e938a911fc15 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 23 10:15:41 2016 -0700 canvas/vg: fix the reference issue in evas_vg objects. Reviewers: jpeg, cedric Reviewed By: cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4079 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/lib/evas/canvas/evas_vg_container.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c index fc11bec..3374a9b 100644 --- a/src/lib/evas/canvas/evas_vg_container.c +++ b/src/lib/evas/canvas/evas_vg_container.c @@ -171,7 +171,7 @@ _efl_vg_container_efl_vg_dup(Eo *obj, { // By setting parent, we automatically reference // this new object as a child of obj. Magic at work ! -(void) eo_add_ref(eo_class_get(child), obj, efl_vg_dup(eo_self, child)); +(void) eo_add(eo_class_get(child), obj, efl_vg_dup(eo_self, child)); } } --
[EGIT] [core/efl] master 09/11: edje: handle named color in svg.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=96fc367a440a095bb8b76698bc9c46d1da9aeb0b commit 96fc367a440a095bb8b76698bc9c46d1da9aeb0b Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 23 10:17:28 2016 -0700 edje: handle named color in svg. Reviewers: jpeg, cedric Reviewed By: jpeg, cedric Subscribers: conr2d, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4080 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/bin/edje/edje_svg_loader.c | 164 - 1 file changed, 162 insertions(+), 2 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index cd620db..e8880e0 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -253,10 +253,163 @@ _color_parser(const char *value, char **end) return lrint(r); } +static const struct { + const char *name; + unsigned int value; +} colors[] = { + { "aliceblue", 0xfff0f8ff }, + { "antiquewhite", 0xfffaebd7 }, + { "aqua", 0xff00 }, + { "aquamarine", 0xff7fffd4 }, + { "azure", 0xfff0 }, + { "beige", 0xfff5f5dc }, + { "bisque", 0xe4c4 }, + { "black", 0xff00 }, + { "blanchedalmond", 0xebcd }, + { "blue", 0xffff }, + { "blueviolet", 0xff8a2be2 }, + { "brown", 0xffa52a2a }, + { "burlywood", 0xffdeb887 }, + { "cadetblue", 0xff5f9ea0 }, + { "chartreuse", 0xff7fff00 }, + { "chocolate", 0xffd2691e }, + { "coral", 0x7f50 }, + { "cornflowerblue", 0xff6495ed }, + { "cornsilk", 0xf8dc }, + { "crimson", 0xffdc143c }, + { "cyan", 0xff00 }, + { "darkblue", 0xff8b }, + { "darkcyan", 0xff008b8b }, + { "darkgoldenrod", 0xffb8860b }, + { "darkgray", 0xffa9a9a9 }, + { "darkgrey", 0xffa9a9a9 }, + { "darkgreen", 0xff006400 }, + { "darkkhaki", 0xffbdb76b }, + { "darkmagenta", 0xff8b008b }, + { "darkolivegreen", 0xff556b2f }, + { "darkorange", 0x8c00 }, + { "darkorchid", 0xff9932cc }, + { "darkred", 0xff8b }, + { "darksalmon", 0xffe9967a }, + { "darkseagreen", 0xff8fbc8f }, + { "darkslateblue", 0xff483d8b }, + { "darkslategray", 0xff2f4f4f }, + { "darkslategrey", 0xff2f4f4f }, + { "darkturquoise", 0xff00ced1 }, + { "darkviolet", 0xff9400d3 }, + { "deeppink", 0x1493 }, + { "deepskyblue", 0xff00bfff }, + { "dimgray", 0xff696969 }, + { "dimgrey", 0xff696969 }, + { "dodgerblue", 0xff1e90ff }, + { "firebrick", 0xffb2 }, + { "floralwhite", 0xfaf0 }, + { "forestgreen", 0xff228b22 }, + { "fuchsia", 0x00ff }, + { "gainsboro", 0xffdcdcdc }, + { "ghostwhite", 0xfff8f8ff }, + { "gold", 0xd700 }, + { "goldenrod", 0xffdaa520 }, + { "gray", 0xff808080 }, + { "grey", 0xff808080 }, + { "green", 0xff008000 }, + { "greenyellow", 0xffadff2f }, + { "honeydew", 0xfff0fff0 }, + { "hotpink", 0x69b4 }, + { "indianred", 0xffcd5c5c }, + { "indigo", 0xff4b0082 }, + { "ivory", 0xfff0 }, + { "khaki", 0xfff0e68c }, + { "lavender", 0xffe6e6fa }, + { "lavenderblush", 0xf0f5 }, + { "lawngreen", 0xff7cfc00 }, + { "lemonchiffon", 0xfacd }, + { "lightblue", 0xffadd8e6 }, + { "lightcoral", 0xfff08080 }, + { "lightcyan", 0xffe0 }, + { "lightgoldenrodyellow", 0xfffafad2 }, + { "lightgray", 0xffd3d3d3 }, + { "lightgrey", 0xffd3d3d3 }, + { "lightgreen", 0xff90ee90 }, + { "lightpink", 0xb6c1 }, + { "lightsalmon", 0xa07a }, + { "lightseagreen", 0xff20b2aa }, + { "lightskyblue", 0xff87cefa }, + { "lightslategray", 0xff778899 }, + { "lightslategrey", 0xff778899 }, + { "lightsteelblue", 0xffb0c4de }, + { "lightyellow", 0xffe0 }, + { "lime", 0xff00ff00 }, + { "limegreen", 0xff32cd32 }, + { "linen", 0xfffaf0e6 }, + { "magenta", 0x00ff }, + { "maroon", 0xff80 }, + { "mediumaquamarine", 0xff66cdaa }, + { "mediumblue", 0xffcd }, + { "mediumorchid", 0xffba55d3 }, + { "mediumpurple", 0xff9370d8 }, + { "mediumseagreen", 0xff3cb371 }, + { "mediumslateblue", 0xff7b68ee },
[EGIT] [core/efl] master 02/04: svg/loader : Added parsing support for use and def node.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=c2fbac0f1f6731fe487fa2d6b3216d1ffe1eb7f4 commit c2fbac0f1f6731fe487fa2d6b3216d1ffe1eb7f4 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 23 17:35:55 2016 +0900 svg/loader : Added parsing support for use and def node. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4078 --- src/bin/edje/edje_svg_loader.c | 193 - src/lib/edje/edje_private.h| 1 + 2 files changed, 191 insertions(+), 3 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index e659e93..cd620db 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -742,7 +742,8 @@ static Svg_Node * _create_defs_node(Svg_Node *parent EINA_UNUSED, const char *buf EINA_UNUSED, unsigned buflen EINA_UNUSED) { Svg_Node *node = _create_node(NULL, SVG_NODE_DEFS); - + eina_simple_xml_attributes_parse(buf, buflen, +NULL, node); return node; } @@ -1067,6 +1068,180 @@ _create_rect_node(Svg_Node *parent, const char *buf, unsigned buflen) return node; } +static char * +_id_from_href(const char *href) +{ + href = _skip_space(href, NULL); + if ((*href) == '#') + href++; + return strdup(href); +} + +static Svg_Node* +_get_defs_node(Svg_Node *node) +{ + if (!node) return NULL; + + while (node->parent != NULL) + { +node = node->parent; + } + + if (node->type == SVG_NODE_DOC) + return node->node.doc.defs; + + return NULL; +} + +static Svg_Node* +_find_child_by_id(Svg_Node *node, char *id) +{ + Eina_List *l; + Svg_Node *child; + + if (!node) return NULL; + + EINA_LIST_FOREACH(node->child, l, child) + { +if ((child->id != NULL) && !strcmp(child->id, id)) + return child; + } + return NULL; +} + +static Svg_Style_Gradient * +_clone_gradient(Svg_Style_Gradient *from) +{ + Svg_Style_Gradient *grad; + + if (!from) return NULL; + + grad= calloc(1, sizeof(Svg_Style_Gradient)); + grad->type = from->type; + grad->id = _copy_id(from->id); + grad->spread = from->spread; + grad->stops = eina_list_clone(from->stops); + if (grad->type == SVG_LINEAR_GRADIENT) + { +grad->linear = calloc(1, sizeof(Svg_Linear_Gradient)); +grad->linear->x1 = from->linear->x1; +grad->linear->y1 = from->linear->y1; +grad->linear->x2 = from->linear->x2; +grad->linear->y1 = from->linear->y2; + } + else if (grad->type == SVG_RADIAL_GRADIENT) + { +grad->radial = calloc(1, sizeof(Svg_Radial_Gradient)); +grad->radial->cx = from->radial->cx; +grad->radial->cy = from->radial->cy; +grad->radial->fx = from->radial->fx; +grad->radial->fy = from->radial->fy; +grad->radial->r = from->radial->r; + } + + return grad; +} + +static void +_copy_attribute(Svg_Node *to, Svg_Node *from) +{ + // copy matrix attribute + if (from->transform) + { +to->transform = calloc(1, sizeof(Eina_Matrix3)); +eina_matrix3_copy(to->transform, from->transform); + } + // copy style attribute; + memcpy(to->style, from->style, sizeof(Svg_Style_Property)); + // copy gradient + to->style->fill.gradient = _clone_gradient(from->style->fill.gradient); + to->style->stroke.gradient = _clone_gradient(from->style->stroke.gradient); + + // copy node attribute + switch (from->type) + { +case SVG_NODE_CIRCLE: + to->node.circle.cx = from->node.circle.cx; + to->node.circle.cy = from->node.circle.cy; + to->node.circle.r = from->node.circle.r; + break; +case SVG_NODE_ELLIPSE: + to->node.ellipse.cx = from->node.ellipse.cx; + to->node.ellipse.cy = from->node.ellipse.cy; + to->node.ellipse.rx = from->node.ellipse.rx; + to->node.ellipse.ry = from->node.ellipse.ry; + break; +case SVG_NODE_RECT: + to->node.rect.x = from->node.rect.x; + to->node.rect.y = from->node.rect.y; + to->node.rect.w = from->node.rect.w; + to->node.rect.h = from->node.rect.h; + to->node.rect.rx = from->node.rect.rx; + to->node.rect.ry = from->node.rect.ry; + break; +case SVG_NODE_PATH: + to->node.path.path = strdup(from->node.path.path); + break; +case SVG_NODE_POLYGON: + to->node.polygon.points_count = from->node.polygon.points_count;
[EGIT] [core/efl] master 03/04: svg/example: fixed typo in svg file name
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e2fad3f22fe2313e827e3661d782bf8519265746 commit e2fad3f22fe2313e827e3661d782bf8519265746 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 23 17:36:09 2016 +0900 svg/example: fixed typo in svg file name Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4076 --- src/examples/edje/svg.edc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/examples/edje/svg.edc b/src/examples/edje/svg.edc index d458f45..ab62e34 100644 --- a/src/examples/edje/svg.edc +++ b/src/examples/edje/svg.edc @@ -69,7 +69,7 @@ collections { SVG_PART("bg1", "vg1", 0.0, 0.0, .25, .25,"dst.svg") SVG_PART("bg2", "vg2", 0.25, 0.0, .5, .25,"atom.svg") SVG_PART("bg3", "vg3", 0.5, 0.0, .75, .25,"bojo.svg") - SVG_PART("bg4", "vg4", 0.75, 0.0, 1.0, .25,"bzrfreed.svg") + SVG_PART("bg4", "vg4", 0.75, 0.0, 1.0, .25,"bzrfeed.svg") SVG_PART("bg5", "vg5", 0.0, 0.25, .25, .5,"yinyang.svg") SVG_PART("bg6", "vg6", 0.25, 0.25, .5, .5,"ubuntu.svg") SVG_PART("bg7", "vg7", 0.5, 0.25, .75, .5,"duke.svg") --
[EGIT] [core/efl] master 01/01: svg_loader: Fixed the parsing of style attribute in g node as well as inheriting style attribute from parent.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=d8760275646849d289809bb6971f1ece550ac145 commit d8760275646849d289809bb6971f1ece550ac145 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 23 10:11:46 2016 +0900 svg_loader: Fixed the parsing of style attribute in g node as well as inheriting style attribute from parent. Reviewers: jpeg, cedric Reviewed By: cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4070 --- src/bin/edje/edje_svg_loader.c | 84 ++ src/lib/edje/edje_data.c | 2 + src/lib/edje/edje_private.h| 29 ++- 3 files changed, 113 insertions(+), 2 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index e97118d..e659e93 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -60,6 +60,8 @@ _skip_space(const char *str, const char *end) static inline char * _copy_id(const char* str) { + if (str == NULL) return NULL; + return strdup(str); } @@ -552,6 +554,7 @@ static void _handle_fill_attr(Svg_Node* node, const char *value) { Svg_Style_Property *style = node->style; + style->fill.flags |= SVG_FILL_FLAGS_PAINT; _handle_paint_attr(>fill.paint, value); } @@ -559,42 +562,49 @@ static void _handle_stroke_attr(Svg_Node* node, const char *value) { Svg_Style_Property *style = node->style; + style->stroke.flags |= SVG_STROKE_FLAGS_PAINT; _handle_paint_attr(>stroke.paint, value); } static void _handle_stroke_opacity_attr(Svg_Node* node, const char *value) { + node->style->stroke.flags |= SVG_STROKE_FLAGS_OPACITY; node->style->stroke.opacity = _to_opacity(value); } static void _handle_stroke_width_attr(Svg_Node* node, const char *value) { + node->style->stroke.flags |= SVG_STROKE_FLAGS_WIDTH; node->style->stroke.width = _to_double(value); } static void _handle_stroke_linecap_attr(Svg_Node* node, const char *value) { + node->style->stroke.flags |= SVG_STROKE_FLAGS_CAP; node->style->stroke.cap = _to_line_cap(value); } static void _handle_stroke_linejoin_attr(Svg_Node* node, const char *value) { + node->style->stroke.flags |= SVG_STROKE_FLAGS_JOIN; node->style->stroke.join = _to_line_join(value); } static void _handle_fill_rule_attr(Svg_Node* node, const char *value) { + node->style->fill.flags |= SVG_FILL_FLAGS_FILL_RULE; node->style->fill.fill_rule = _to_fill_rule(value); } static void _handle_fill_opacity_attr(Svg_Node* node, const char *value) { + node->style->fill.flags |= SVG_FILL_FLAGS_OPACITY; node->style->fill.opacity = _to_opacity(value); } @@ -678,6 +688,10 @@ _attr_parse_g_node(void *data, const char *key, const char *value) { node->id = _copy_id(value); } + else + { +_parse_style_attr(node, key, value); + } return EINA_TRUE; } @@ -1443,6 +1457,72 @@ _evas_svg_loader_parser(void *data, Eina_Simple_XML_Type type, return EINA_TRUE; } +static void +_inherit_style(Svg_Style_Property *child, Svg_Style_Property *parent) +{ + if (parent == NULL) + return; + // inherit the property of parent if not present in child. + // fill + if (!(child->fill.flags & SVG_FILL_FLAGS_PAINT)) + { +child->fill.paint.r = parent->fill.paint.r; +child->fill.paint.g = parent->fill.paint.g; +child->fill.paint.b = parent->fill.paint.b; +child->fill.paint.none = parent->fill.paint.none; +child->fill.paint.cur_color = parent->fill.paint.cur_color; +child->fill.paint.url = _copy_id(parent->fill.paint.url); + } + if (!(child->fill.flags & SVG_FILL_FLAGS_OPACITY)) + { +child->fill.opacity = parent->fill.opacity; + } + if (!(child->fill.flags & SVG_FILL_FLAGS_FILL_RULE)) + { +child->fill.fill_rule = parent->fill.fill_rule; + } + // stroke + if (!(child->stroke.flags & SVG_STROKE_FLAGS_PAINT)) + { +child->stroke.paint.r = parent->stroke.paint.r; +child->stroke.paint.g = parent->stroke.paint.g; +child->stroke.paint.b = parent->stroke.paint.b; +child->stroke.paint.none = parent->stroke.paint.none; +child->stroke.paint.cur_color = parent->stroke.paint.cur_color; +child->stroke.paint.url = _copy_id(parent->stroke.paint.url); + } + if (!(child->stroke.flags & SVG_STROKE_FLAGS_OPACITY)) + { +child->stroke.opacity = parent->stroke.opacity; + } + if (!(child->stroke.flags & SVG_STROKE_FLAGS_WIDTH)) + { +child->stroke.width = parent->stroke.width; + } + if (!(child->stroke.flag
[EGIT] [core/efl] master 04/06: efl/interface: fixed scubic_to and quad_to implementation.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=22f97be785d1a64545b28ab663aeb96d0caa58cc commit 22f97be785d1a64545b28ab663aeb96d0caa58cc Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jun 21 14:42:35 2016 +0900 efl/interface: fixed scubic_to and quad_to implementation. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4063 --- src/lib/efl/interfaces/efl_gfx_shape.c | 25 ++--- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_shape.c b/src/lib/efl/interfaces/efl_gfx_shape.c index 6a23dd4..415265f 100644 --- a/src/lib/efl/interfaces/efl_gfx_shape.c +++ b/src/lib/efl/interfaces/efl_gfx_shape.c @@ -521,12 +521,23 @@ _efl_gfx_shape_append_scubic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, double current_ctrl_x = 0, current_ctrl_y = 0; current_x = pd->current.x; - current_y = pd->current.x; + current_y = pd->current.y; current_ctrl_x = pd->current_ctrl.x; current_ctrl_y = pd->current_ctrl.y; - - ctrl_x0 = 2 * current_x - current_ctrl_x; - ctrl_y0 = 2 * current_y - current_ctrl_y; + // if previous command is cubic then use reflection point of current control point + // as the first control point + if ((pd->commands_count > 1) && + (pd->commands[pd->commands_count-2] == EFL_GFX_PATH_COMMAND_TYPE_CUBIC_TO)) + { +ctrl_x0 = 2 * current_x - current_ctrl_x; +ctrl_y0 = 2 * current_y - current_ctrl_y; + } + else + { +// use currnt point as the 1st control point +ctrl_x0 = current_x; +ctrl_y0 = current_y; + } _efl_gfx_shape_append_cubic_to(obj, pd, ctrl_x0, ctrl_y0, ctrl_x, ctrl_y, x, y); @@ -563,7 +574,7 @@ _efl_gfx_shape_append_squadratic_to(Eo *obj, Efl_Gfx_Shape_Data *pd, double current_ctrl_x = 0, current_ctrl_y = 0; current_x = pd->current.x; - current_y = pd->current.x; + current_y = pd->current.y; current_ctrl_x = pd->current_ctrl.x; current_ctrl_y = pd->current_ctrl.y; @@ -1208,7 +1219,6 @@ _efl_gfx_path_parse_pair_to(const char *content, char **end, x += *current_x; y += *current_y; } - func(obj, pd, x, y); content = *end; @@ -1355,8 +1365,9 @@ _efl_gfx_path_parse_quad_to(const char *content, char **end, { x += *current_x; y += *current_y; + ctrl_x0 += *current_x; + ctrl_y0 += *current_y; } - func(obj, pd, x, y, ctrl_x0, ctrl_y0); content = *end; --
[EGIT] [core/efl] master 05/06: svg: added support for parsing and showing of polyline data.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=3ab15990d31d9529617371510eed596f7b77d1e7 commit 3ab15990d31d9529617371510eed596f7b77d1e7 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jun 21 14:42:43 2016 +0900 svg: added support for parsing and showing of polyline data. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4064 --- src/bin/edje/edje_svg_loader.c | 13 - src/lib/edje/edje_data.c | 1 + src/lib/edje/edje_load.c | 26 +++--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index ea3126d..e97118d 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -978,6 +978,16 @@ _create_polygon_node(Svg_Node *parent, const char *buf, unsigned buflen) return node; } +static Svg_Node * +_create_polyline_node(Svg_Node *parent, const char *buf, unsigned buflen) +{ + Svg_Node *node = _create_node(parent, SVG_NODE_POLYLINE); + + eina_simple_xml_attributes_parse(buf, buflen, +_attr_parse_polygon_node, node); + return node; +} + #define RECT_DEF(Name, Field) \ { #Name, sizeof (#Name), offsetof(Svg_Rect_Node, Field)} @@ -1055,7 +1065,8 @@ static const struct { TAG_DEF(ellipse), TAG_DEF(path), TAG_DEF(polygon), - TAG_DEF(rect) + TAG_DEF(rect), + TAG_DEF(polyline), }; static const struct { diff --git a/src/lib/edje/edje_data.c b/src/lib/edje/edje_data.c index bca1610..c6a4e5d 100644 --- a/src/lib/edje/edje_data.c +++ b/src/lib/edje/edje_data.c @@ -387,6 +387,7 @@ struct { SVG_NODE_CIRCLE, "circle" }, { SVG_NODE_ELLIPSE, "ellipse" }, { SVG_NODE_POLYGON, "polygon" }, + { SVG_NODE_POLYLINE, "polygon" }, { SVG_NODE_RECT, "rect" }, { SVG_NODE_PATH, "path" }, { SVG_NODE_UNKNOWN, NULL } diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 95c507f..951e36b 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2438,10 +2438,24 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg) } static void +_add_polyline(Efl_VG *vg, double *array, int size, Eina_Bool polygon) +{ + int i; + + if (size < 2) return; + + evas_vg_shape_shape_append_move_to(vg, array[0], array[1]); + for (i=2; i < size; i+=2) + evas_vg_shape_shape_append_line_to(vg, array[i], array[i+1]); + + if (polygon) + evas_vg_shape_shape_append_close(vg); +} + +static void _create_vg_node(Svg_Node *node, Efl_VG *parent) { Efl_VG *vg = NULL; - int i; Svg_Node *child; Eina_List *l; @@ -2464,12 +2478,10 @@ _create_vg_node(Svg_Node *node, Efl_VG *parent) break; case SVG_NODE_POLYGON: vg = evas_vg_shape_add(parent); - for (i=0; i < node->node.polygon.points_count; i+=2) - { -if (!i) - evas_vg_shape_shape_append_move_to(vg, node->node.polygon.points[i], node->node.polygon.points[i+1]); -evas_vg_shape_shape_append_line_to(vg, node->node.polygon.points[i], node->node.polygon.points[i+1]); - } + _add_polyline(vg, node->node.polygon.points, node->node.polygon.points_count, EINA_TRUE); + break; +case SVG_NODE_POLYLINE: + _add_polyline(vg, node->node.polygon.points, node->node.polygon.points_count, EINA_FALSE); break; case SVG_NODE_ELLIPSE: vg = evas_vg_shape_add(parent); --
[EGIT] [core/efl] master 03/06: edje/example: Added example for testing vector part with svg images.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=a4e6d46d8a32ab97c495452205c2f28a823e23d8 commit a4e6d46d8a32ab97c495452205c2f28a823e23d8 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue Jun 21 14:42:28 2016 +0900 edje/example: Added example for testing vector part with svg images. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4062 --- src/examples/edje/Makefile.am | 25 +++-- src/examples/edje/atom.svg | 14 + src/examples/edje/bozo.svg | 15 ++ src/examples/edje/bzrfeed.svg | 23 + src/examples/edje/cartman.svg | 11 src/examples/edje/dst.svg | 15 ++ src/examples/edje/duke.svg | 25 + src/examples/edje/eee.svg | 4 ++ src/examples/edje/fsm.svg | 20 src/examples/edje/google.svg| 4 ++ src/examples/edje/hg0.svg | 10 src/examples/edje/ibm.svg | 44 src/examples/edje/osa.svg | 19 +++ src/examples/edje/scion.svg | 9 src/examples/edje/svg-test.c| 111 src/examples/edje/svg.edc | 104 + src/examples/edje/ubuntu.svg| 26 ++ src/examples/edje/wikimedia.svg | 5 ++ src/examples/edje/yinyang.svg | 6 +++ 19 files changed, 487 insertions(+), 3 deletions(-) diff --git a/src/examples/edje/Makefile.am b/src/examples/edje/Makefile.am index 5d4f15d..f418cab 100644 --- a/src/examples/edje/Makefile.am +++ b/src/examples/edje/Makefile.am @@ -50,7 +50,8 @@ box_example.edc \ embryo_tween_anim.edc \ embryo_set_state_anim.edc \ bezier-transition-example.edc \ -textblock-hyphen.edc +textblock-hyphen.edc \ +svg.edc DIST_EDCS = $(EDCS) @@ -85,6 +86,22 @@ red.png \ test.png \ Vera.ttf \ duck.wav \ +dst.svg \ +atom.svg \ +bojo.svg \ +bzrfeed.svg \ +yinyang.svg \ +ubuntu.svg \ +duke.svg \ +cartman.svg \ +ibm.svg \ +hg0.svg \ +fsm.svg \ +osa.svg \ +wikimedia.svg \ +scion.svg \ +eee.svg \ +google.svg \ en_IN/domain_name.po \ hi_IN/domain_name.po \ ta_IN/domain_name.mo \ @@ -111,7 +128,8 @@ signals2.c \ edje-swallow2.c \ edje-multisense.c \ edje-edit-part-box.c \ -edje-textblock-hyphenation.c +edje-textblock-hyphenation.c \ +svg-test.c EXTRA_DIST = $(DIST_EDCS) $(DATA_FILES) @@ -181,7 +199,8 @@ edje-basic2 \ signals2 \ edje-swallow2 \ edje-edit-part-box \ -edje-textblock-hyphenation +edje-textblock-hyphenation \ +svg-test if ENABLE_MULTISENSE EXTRA_PROGRAMS += edje-multisense diff --git a/src/examples/edje/atom.svg b/src/examples/edje/atom.svg new file mode 100755 index 000..4dff5e3 --- /dev/null +++ b/src/examples/edje/atom.svg @@ -0,0 +1,14 @@ +http://www.w3.org/2000/svg; viewBox="-52 -53 100 100" stroke-width="2"> + + + + + + + + + + + + + diff --git a/src/examples/edje/bozo.svg b/src/examples/edje/bozo.svg new file mode 100755 index 000..fe62615 --- /dev/null +++ b/src/examples/edje/bozo.svg @@ -0,0 +1,15 @@ +http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/xlink; viewBox="0 0 100 100"> + http://www.tbray.org/ongoing/When/200x/2004/01/11/PostelPilgrim;> + + + + + + + + + + + diff --git a/src/examples/edje/bzrfeed.svg b/src/examples/edje/bzrfeed.svg new file mode 100755 index 000..e5d210f --- /dev/null +++ b/src/examples/edje/bzrfeed.svg @@ -0,0 +1,23 @@ +http://www.w3.org/2000/svg; stroke-linejoin="round" viewBox="0 0 100 100"> + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/examples/edje/cartman.svg b/src/examples/edje/cartman.svg new file mode 100755 index 000..d4b2740 --- /dev/null +++ b/src/examples/edje/cartman.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/src/examples/edje/dst.svg b/src/examples/edje/dst.svg new file mode 100755 index 000..16d1baa --- /dev/null +++ b/src/examples/edje/dst.svg @@ -0,0 +1,15 @@ +http://www.w3.org/2000/svg; viewBox="0 0 100 100" > + + + + + + + + + + + + + + diff --git a/src/examples/edje/duke.svg b/src/examples/edje/duke.svg new file mode 100755 index 000..64cdcf8 --- /dev/null +++ b/src/examples/edje/duke.svg @@ -0,0 +1,25 @@ +http://www.w3.org/2000/svg; viewBox="0 0 75 136"> + + + + diff --git a/src/examples/edje/eee.svg b/src/examples/edje/eee.svg new file mode 100644 index 000..c23875e --- /dev/null +++ b/src/examples/edje/eee.svg @@ -0,0 +1,4 @@ +http://www.w3.org/2000/svg;> + + \ No newline at end of file diff --git a/src/examples/edje/fsm.svg b/src/examples/edje/fsm.svg new file mode 100644 index 000..f059954 --- /dev/
[EGIT] [core/efl] master 01/01: edje_load: fixed adding ellipse shape data.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=b6e86c39e50ce24320d2cb120519ca022242551d commit b6e86c39e50ce24320d2cb120519ca022242551d Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Jun 20 10:13:03 2016 +0900 edje_load: fixed adding ellipse shape data. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4053 --- src/lib/edje/edje_load.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index 74fb072..0c1605e 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2473,7 +2473,10 @@ _create_vg_node(Svg_Node *node, Efl_VG *parent) break; case SVG_NODE_ELLIPSE: vg = evas_vg_shape_add(parent); - evas_vg_shape_shape_append_circle(vg, node->node.ellipse.cx, node->node.ellipse.cy, node->node.ellipse.rx); + evas_vg_shape_shape_append_arc(vg, node->node.ellipse.cx - node->node.ellipse.rx, + node->node.ellipse.cy - node->node.ellipse.ry, + 2*node->node.ellipse.rx, 2*node->node.ellipse.ry, 0, 360); + evas_vg_shape_shape_append_close(vg); break; case SVG_NODE_CIRCLE: vg = evas_vg_shape_add(parent); --
[EGIT] [core/efl] master 03/04: edje_cc_out : fix possible buffer overrun
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=5eca781a3bbafa39ae45825bd017418bf7c5c6ef commit 5eca781a3bbafa39ae45825bd017418bf7c5c6ef Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 16 15:28:07 2016 +0900 edje_cc_out : fix possible buffer overrun Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4044 --- src/bin/edje/edje_cc_out.c | 17 ++--- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/bin/edje/edje_cc_out.c b/src/bin/edje/edje_cc_out.c index eb708d9..f3116ac 100644 --- a/src/bin/edje/edje_cc_out.c +++ b/src/bin/edje/edje_cc_out.c @@ -1240,15 +1240,14 @@ data_write_vectors(Eet_File *ef, int *vector_num) Eet_Data_Descriptor *svg_node_eet; Eina_List *ll; char *s; - char buf[PATH_MAX]; - char id_str[15]; Eina_File *f = NULL; Edje_Vector_Directory_Entry *vector; + Eina_Strbuf *buf; if (!((edje_file) && (edje_file->image_dir))) return; svg_node_eet = _edje_svg_node_eet(); - + buf = eina_strbuf_new(); for (i = 0; i < edje_file->image_dir->vectors_count; i++) { if (!beta) @@ -1257,17 +1256,21 @@ data_write_vectors(Eet_File *ef, int *vector_num) vector = _file->image_dir->vectors[i]; EINA_LIST_FOREACH(img_dirs, ll, s) { - snprintf(buf, sizeof(buf), "%s/%s", s, vector->entry); - f = eina_file_open(buf, EINA_FALSE); + 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); if (!f) continue; root = _svg_load(f, NULL); - snprintf(id_str, sizeof(id_str), "edje/vectors/%i", vector->id); - eet_data_write(ef, svg_node_eet, id_str, root, compress_mode); + eina_strbuf_reset(buf); + eina_strbuf_append_printf(buf, "edje/vectors/%i", vector->id); + eet_data_write(ef, svg_node_eet, eina_strbuf_string_get(buf), root, compress_mode); *vector_num += 1; eina_file_close(f); break; } } + eina_strbuf_free(buf); + } static void --
[EGIT] [core/efl] master 02/04: svg_loader: Fixed color attribute parser
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=67e400a3c91b3a0e59cac083a3023c75242ff7ef commit 67e400a3c91b3a0e59cac083a3023c75242ff7ef Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 16 15:26:28 2016 +0900 svg_loader: Fixed color attribute parser Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4049 --- src/bin/edje/edje_svg_loader.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index 7ee5404..9f76db2 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -260,14 +260,15 @@ _to_color(const char *str, int *r, int *g, int *b, char** ref) if (len == 4 && str[0] == '#') { +// case for "#456" should be interprete as "#445566" if (isxdigit(str[1]) && isxdigit(str[2]) && isxdigit(str[3])) { - char tmp[2] = { '\0', '\0' }; - tmp[0] = str[1]; *r = strtol(tmp, NULL, 16); - tmp[0] = str[2]; *g = strtol(tmp, NULL, 16); - tmp[0] = str[3]; *b = strtol(tmp, NULL, 16); + char tmp[3] = { '\0', '\0', '\0' }; + tmp[0] = str[1]; tmp[1] = str[1]; *r = strtol(tmp, NULL, 16); + tmp[0] = str[2]; tmp[1] = str[2]; *g = strtol(tmp, NULL, 16); + tmp[0] = str[3]; tmp[1] = str[3]; *b = strtol(tmp, NULL, 16); } } else if (len == 7 && str[0] == '#') --
[EGIT] [core/efl] master 01/04: edje_load : return if we can't decode the vector data.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=39452ff8488d2189f93d610064682529b3b88fa7 commit 39452ff8488d2189f93d610064682529b3b88fa7 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 16 15:26:08 2016 +0900 edje_load : return if we can't decode the vector data. Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4050 --- src/lib/edje/edje_load.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib/edje/edje_load.c b/src/lib/edje/edje_load.c index e6231a9..5ca19e5 100644 --- a/src/lib/edje/edje_load.c +++ b/src/lib/edje/edje_load.c @@ -2453,6 +2453,7 @@ _edje_dupe_vector_data(Edje *ed, int svg_id, double width, double height, if (!vector->vg) { data->vg = NULL; +return; } root = evas_vg_container_add(NULL); --
[EGIT] [core/efl] master 04/04: svg_loader: fixed parsing of transformation attribute
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=285c387ae2a6ea0c85a8f60fac7c360c22d23e76 commit 285c387ae2a6ea0c85a8f60fac7c360c22d23e76 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 16 15:32:42 2016 +0900 svg_loader: fixed parsing of transformation attribute Reviewers: cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4048 --- src/bin/edje/edje_svg_loader.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index 9f76db2..8f155b3 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -376,7 +376,7 @@ _parse_transformation_matrix(const char *value) { unsigned int i; double points[8]; - int sz, pt_count = 0; + int pt_count = 0; double sx, sy; Matrix_State state = SVG_MATRIX_UNKNOWN; Eina_Matrix3 *matrix = calloc(1, sizeof(Eina_Matrix3)); @@ -391,9 +391,8 @@ _parse_transformation_matrix(const char *value) ++str; continue; } -sz = end - str; for (i = 0; i < sizeof (matrix_tags) / sizeof(matrix_tags[0]); i++) - if (matrix_tags[i].sz - 1 == sz && !strncmp(matrix_tags[i].tag, str, sz)) + if (!strncmp(matrix_tags[i].tag, str, matrix_tags[i].sz -1)) { state = matrix_tags[i].state; str += (matrix_tags[i].sz -1); @@ -436,12 +435,12 @@ _parse_transformation_matrix(const char *value) { if (pt_count == 1) { - eina_matrix3_rotate(matrix, points[0]); + eina_matrix3_rotate(matrix, points[0] * (M_PI/180.0)); } else if (pt_count == 3) { eina_matrix3_translate(matrix, points[1], points[2]); - eina_matrix3_rotate(matrix, points[0]); + eina_matrix3_rotate(matrix, points[0] * (M_PI/180.0)); eina_matrix3_translate(matrix, -points[1], -points[2]); } else --
[EGIT] [core/efl] master 01/02: edje : fix the typo in svg loader.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=ef84367fa9e97c1c6ae72a5bbdafd4a5f1272e83 commit ef84367fa9e97c1c6ae72a5bbdafd4a5f1272e83 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 9 13:26:33 2016 +0900 edje : fix the typo in svg loader. Reviewers: SanghyeonLee, cedric, jpeg Reviewed By: jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4027 --- src/bin/edje/edje_svg_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/edje/edje_svg_loader.c b/src/bin/edje/edje_svg_loader.c index 1ded253..29cd788 100644 --- a/src/bin/edje/edje_svg_loader.c +++ b/src/bin/edje/edje_svg_loader.c @@ -1067,7 +1067,7 @@ static const struct { int sz = strlen(name); \ \ for (i = 0; i < sizeof (Tags_Array) / sizeof(Tags_Array[0]); i++) \ - if (group_tags[i].sz - 1 == sz && !strncmp(Tags_Array[i].tag, name, sz)) \ + if (Tags_Array[i].sz - 1 == sz && !strncmp(Tags_Array[i].tag, name, sz)) \ { \ return Tags_Array[i].tag_handler; \ } \ --
[EGIT] [core/efl] master 02/02: edje: cached the vg tree generation and fixed the interpolation betwwen two vg tree.
jpeg pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e38cf1f85f8957bd2fa17972572a0d39c09298bf commit e38cf1f85f8957bd2fa17972572a0d39c09298bf Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu Jun 9 13:49:56 2016 +0900 edje: cached the vg tree generation and fixed the interpolation betwwen two vg tree. Reviewers: cedric, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4028 --- src/lib/edje/edje_calc.c| 174 +--- src/lib/edje/edje_load.c| 103 -- src/lib/edje/edje_private.h | 25 +-- 3 files changed, 130 insertions(+), 172 deletions(-) diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index 5b2f4ab..382e6d7 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c @@ -3260,8 +3260,10 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U { int w, h; int new_svg = 0; - Efl_VG *vg_tree, *root_vg; - double sx, sy, vx, vy, vw, vh; + Efl_VG *root_vg; + double sx, sy; + Eina_Matrix3 matrix; + Edje_Vector_Data *start, *end; evas_object_geometry_get(ep->object, NULL, NULL, , ); @@ -3279,74 +3281,42 @@ _edje_svg_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3 EINA_U } if (new_svg) // animation with svg id change { -Efl_VG *container; -if (ep->typedata.vector->cache.svg_id != new_svg) - { - //create it - vg_tree = _edje_create_vg_tree(ed->file->ef, new_svg, w, h, , , , ); - if (vg_tree) - { - //1. clear the cache - if (ep->typedata.vector->cache.vg) -{ - eo_unref(ep->typedata.vector->cache.vg); - ep->typedata.vector->cache.vg = NULL; - ep->typedata.vector->cache.svg_id = 0; -} - //2. update current - ep->typedata.vector->cache.svg_id = new_svg; - ep->typedata.vector->cache.x = vx; - ep->typedata.vector->cache.y = vy; - ep->typedata.vector->cache.w = vw; - ep->typedata.vector->cache.h = vh; - ep->typedata.vector->cache.vg = vg_tree; - } - } -// just do the interpolation -if (eo_parent_get(ep->typedata.vector->cur.vg)) - { - // remove it from the hirarchy - eo_ref(ep->typedata.vector->cur.vg); - eo_parent_set(ep->typedata.vector->cur.vg, NULL); - } -// create a container -container = evas_vg_container_add(NULL); -// reset the matrix. -Eina_Matrix3 matrix; -sx = w/ep->typedata.vector->cur.w; -sy = h/ep->typedata.vector->cur.h; -// for current vg +start = _edje_ref_vector_data(ed, chosen_desc->vg.id); +end = _edje_ref_vector_data(ed, new_svg); + +// for start vector +sx = w/start->w; +sy = h/start->h; eina_matrix3_identity(); -eina_matrix3_translate(, -ep->typedata.vector->cur.x, -ep->typedata.vector->cur.y); +eina_matrix3_translate(, -start->x, -start->y); eina_matrix3_scale(, sx, sy); -evas_vg_node_transformation_set(ep->typedata.vector->cur.vg, ); -// for next vg -sx = w/ep->typedata.vector->cache.w; -sy = h/ep->typedata.vector->cache.h; +evas_vg_node_transformation_set(start->vg, ); + +// for end vector +sx = w/end->w; +sy = h/end->h; eina_matrix3_identity(); -eina_matrix3_translate(, -ep->typedata.vector->cache.x, -ep->typedata.vector->cache.y); +eina_matrix3_translate(, -end->x, -end->y); eina_matrix3_scale(, sx, sy); -evas_vg_node_transformation_set(ep->typedata.vector->cache.vg, ); +evas_vg_node_transformation_set(end->vg, ); + // do the interpolation -if (evas_vg_node_interpolate(container, ep->typedata.vector->cur.vg, ep->typedata.vector->cache.vg, pos)) - { - // can interpolate between two svg file - eo_parent_set(container, root_vg); - } -else +if (!evas_vg_node_interpolate(ep->typedata.vector->cur.vg, start->vg, end->vg, pos)) { - // can't interpolate between 2 shape - // keep the current vg tree - eo_parent_set(ep->typedata.vector->cur.vg, root_vg); - // delete the container - eo_unref(container); + ERR(" Can't interpolate check the svg file
[EGIT] [core/efl] master 01/01: edje: add new svg part to edc
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=62c0a4ef087ea71355961e030b0620a60b77a026 commit 62c0a4ef087ea71355961e030b0620a60b77a026 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Jun 8 11:26:07 2016 -0700 edje: add new svg part to edc Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: jpeg, cedric, Hermet Differential Revision: https://phab.enlightenment.org/D3894 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/Makefile_Edje.am| 1 + src/bin/edje/edje_cc_handlers.c | 124 + src/bin/edje/edje_cc_out.c | 45 + src/bin/edje/edje_convert.c | 3 + src/bin/edje/edje_inspector.c | 2 + src/lib/edje/Edje_Common.h | 3 +- src/lib/edje/edje_cache.c | 2 + src/lib/edje/edje_calc.c| 196 src/lib/edje/edje_convert.c | 3 + src/lib/edje/edje_data.c| 22 - src/lib/edje/edje_edit.c| 7 ++ src/lib/edje/edje_load.c| 121 + src/lib/edje/edje_lua.c | 1 + src/lib/edje/edje_private.h | 43 - 14 files changed, 570 insertions(+), 3 deletions(-) diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am index f85f7d9..b213db5 100644 --- a/src/Makefile_Edje.am +++ b/src/Makefile_Edje.am @@ -95,6 +95,7 @@ lib/edje/edje_var.c \ lib/edje/edje_signal.c \ lib/edje/edje_containers.c + lib_edje_libedje_la_CPPFLAGS = -I$(top_builddir)/src/lib/efl $(EDJE_COMMON_CPPFLAGS) lib_edje_libedje_la_LIBADD = @EDJE_LIBS@ lib_edje_libedje_la_DEPENDENCIES = @EDJE_INTERNAL_LIBS@ diff --git a/src/bin/edje/edje_cc_handlers.c b/src/bin/edje/edje_cc_handlers.c index 0fa5a4f..0435713 100644 --- a/src/bin/edje/edje_cc_handlers.c +++ b/src/bin/edje/edje_cc_handlers.c @@ -533,11 +533,16 @@ static void st_collections_group_mouse(void); static void st_collections_group_nomouse(void); static void st_collections_group_broadcast(void); static void st_collections_group_nobroadcast(void); + +static void st_images_vector(void); +static void _handle_vector_image(void); + /*/ #define IMAGE_STATEMENTS(PREFIX) \ {PREFIX"images.image", st_images_image}, \ + {PREFIX"images.vector", st_images_vector}, \ {PREFIX"images.set.name", st_images_set_name}, \ {PREFIX"images.set.image.image", st_images_set_image_image}, \ {PREFIX"images.set.image.size", st_images_set_image_size}, \ @@ -1520,6 +1525,7 @@ New_Object_Handler object_handlers[] = proxy{} spacer{} snapshot{} + vector{} part { desc { } @@ -1547,6 +1553,7 @@ New_Object_Handler object_handlers_short[] = {"collections.group.parts.proxy", ob_collections_group_parts_part_short}, {"collections.group.parts.spacer", ob_collections_group_parts_part_short}, {"collections.group.parts.part.desc", ob_collections_group_parts_part_desc}, + {"collections.group.parts.vector", ob_collections_group_parts_part_short}, }; New_Nested_Handler nested_handlers[] = { @@ -1565,6 +1572,7 @@ New_Nested_Handler nested_handlers_short[] = { {"collections.group.parts", "external", NULL, edje_cc_handlers_hierarchy_pop }, {"collections.group.parts", "proxy", NULL, edje_cc_handlers_hierarchy_pop }, {"collections.group.parts", "spacer", NULL, edje_cc_handlers_hierarchy_pop }, + {"collections.group.parts", "vector", NULL, edje_cc_handlers_hierarchy_pop }, }; /*/ @@ -1922,6 +1930,15 @@ _edje_part_description_alloc(unsigned char type, const char *collection, const c result = >common; break; } + case EDJE_PART_TYPE_VECTOR: +{ + Edje_Part_Description_Vector *ed; + + ed = mem_alloc(SZ(Edje_Part_Description_Vector)); + + result = >common; + break; +} } if (!result) @@ -2292,6 +2309,99 @@ st_images_image(void) } } + +static void +_handle_vector_image(void) +{ + Edje_Part_Description_Vector *ed; + unsigned int i = 0; + char *name; + + ed = (Edje_Part_Description_Vector*) current_desc; + + name = parse_str(0); + + ed->vg.id = -1; + + for (i = 0; i < edje_file->image_dir->vectors_count; ++i) + { +if (!strcmp(edje_file->image_dir->vectors[i].entry, name)) + { + ed->vg.set = EINA_TRUE; + ed->vg.id = edje_file->image_dir->vectors[i].id; + break; + } + } + + free(name); +} + +/** @edcsubsection{toplevel_images, + * Images} */ + +/** +@page edcref + +@block +images +@context +vector { +vector: &qu
[EGIT] [core/efl] master 01/02: edje: add svg support to parse and store a svg file as a vector object in .edj.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=698135b8e4a59ef08dc0c0e957ef073df2ef5296 commit 698135b8e4a59ef08dc0c0e957ef073df2ef5296 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Wed Jun 8 10:26:38 2016 -0700 edje: add svg support to parse and store a svg file as a vector object in .edj. Summary: This is the svg loader which will parse the svg file and store it in a intermediate structure. It provides the helper function to get EET descriptor to save the structure into eet file. NOTE: Not all svg attributes are handled yet. but most common attributes are handled . Reviewers: Hermet, cedric Subscribers: Hermet, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3868 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/Makefile_Edje.am |3 +- src/bin/edje/edje_cc.h |3 + src/bin/edje/edje_svg_loader.c | 1472 src/lib/edje/edje_data.c | 409 +++ src/lib/edje/edje_private.h| 225 ++ 5 files changed, 2111 insertions(+), 1 deletion(-) diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am index 8dc400c..f85f7d9 100644 --- a/src/Makefile_Edje.am +++ b/src/Makefile_Edje.am @@ -163,7 +163,8 @@ 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_multisense_convert.c \ +bin/edje/edje_svg_loader.c bin_edje_edje_cc_CPPFLAGS = -I$(top_builddir)/src/lib/efl $(EDJE_COMMON_CPPFLAGS) bin_edje_edje_cc_LDADD = $(USE_EDJE_BIN_LIBS) bin_edje_edje_cc_DEPENDENCIES = \ diff --git a/src/bin/edje/edje_cc.h b/src/bin/edje/edje_cc.h index a097d8e..ad930c9 100644 --- a/src/bin/edje/edje_cc.h +++ b/src/bin/edje/edje_cc.h @@ -257,6 +257,9 @@ 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 new file mode 100644 index 000..2ab2b4d --- /dev/null +++ b/src/bin/edje/edje_svg_loader.c @@ -0,0 +1,1472 @@ +#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 char * +_copy_id(const char* str) +{ + char *id = malloc(strlen(str)); + + strcpy(id, str); + return id; +} + +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; +} + +/* 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 inline Efl_Gfx_Cap +_to_line_cap(const char *st
[EGIT] [core/efl] master 07/07: efl_ui_flip: renamed elm_flip to efl_ui_flip and updated the eo class
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=cd6c0ab2c7dbaf3d0c3812f200bc6fe4735576e8 commit cd6c0ab2c7dbaf3d0c3812f200bc6fe4735576e8 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Mon Jun 6 16:50:26 2016 -0700 efl_ui_flip: renamed elm_flip to efl_ui_flip and updated the eo class Reviewers: woohyun, raster, jpeg, cedric Reviewed By: jpeg, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3933 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/Makefile_Elementary.am | 11 +- src/lib/elementary/Makefile.am | 12 +- src/lib/elementary/{elm_flip.c => efl_ui_flip.c} | 391 - src/lib/elementary/{elm_flip.eo => efl_ui_flip.eo} | 49 +-- src/lib/elementary/efl_ui_flip_internal_part.eo| 10 + src/lib/elementary/efl_ui_flip_legacy.h| 124 +++ .../{elm_widget_flip.h => efl_ui_widget_flip.h}| 26 +- src/lib/elementary/elm_flip.h | 4 +- src/lib/elementary/elm_flip_eo.h | 1 - src/lib/elementary/elm_flip_legacy.h | 25 -- 10 files changed, 502 insertions(+), 151 deletions(-) diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am index db805c7..a08dab0 100644 --- a/src/Makefile_Elementary.am +++ b/src/Makefile_Elementary.am @@ -27,7 +27,8 @@ elm_public_eolian_files = \ lib/elementary/elm_fileselector.eo \ lib/elementary/elm_fileselector_button.eo \ lib/elementary/elm_fileselector_entry.eo \ - lib/elementary/elm_flip.eo \ + lib/elementary/efl_ui_flip.eo \ + lib/elementary/efl_ui_flip_internal_part.eo \ lib/elementary/elm_flipselector.eo \ lib/elementary/elm_frame.eo \ lib/elementary/elm_gengrid.eo \ @@ -210,7 +211,7 @@ includesunstable_HEADERS = \ lib/elementary/elm_widget_fileselector.h \ lib/elementary/elm_widget_fileselector_button.h \ lib/elementary/elm_widget_fileselector_entry.h \ - lib/elementary/elm_widget_flip.h \ + lib/elementary/efl_ui_widget_flip.h \ lib/elementary/elm_widget_flipselector.h \ lib/elementary/elm_widget_frame.h \ lib/elementary/elm_widget_gengrid.h \ @@ -369,8 +370,8 @@ includesub_HEADERS = \ lib/elementary/elm_entry_legacy.h \ lib/elementary/elm_finger.h \ lib/elementary/elm_flip.h \ - lib/elementary/elm_flip_eo.h \ - lib/elementary/elm_flip_legacy.h \ + lib/elementary/efl_ui_flip.eo.h \ + lib/elementary/efl_ui_flip_legacy.h \ lib/elementary/elm_flipselector.h \ lib/elementary/elm_flipselector_eo.h \ lib/elementary/elm_flipselector_legacy.h \ @@ -592,7 +593,7 @@ lib_elementary_libelementary_la_SOURCES = \ lib/elementary/elm_dbus_menu.c \ lib/elementary/elm_diskselector.c \ lib/elementary/elm_entry.c \ - lib/elementary/elm_flip.c \ + lib/elementary/efl_ui_flip.c \ lib/elementary/elm_flipselector.c \ lib/elementary/elm_font.c \ lib/elementary/elm_frame.c \ diff --git a/src/lib/elementary/Makefile.am b/src/lib/elementary/Makefile.am index 51ccc88..364bc85 100644 --- a/src/lib/elementary/Makefile.am +++ b/src/lib/elementary/Makefile.am @@ -31,7 +31,8 @@ elm_eolian_files = \ elm_fileselector.eo \ elm_fileselector_button.eo \ elm_fileselector_entry.eo \ - elm_flip.eo \ + efl_ui_flip.eo \ + efl_ui_flip_internal_part.eo \ elm_flipselector.eo \ elm_frame.eo \ elm_gengrid.eo \ @@ -181,7 +182,7 @@ includesunstable_HEADERS = \ elm_widget_fileselector.h \ elm_widget_fileselector_button.h \ elm_widget_fileselector_entry.h \ - elm_widget_flip.h \ + efl_ui_widget_flip.h \ elm_widget_flipselector.h \ elm_widget_frame.h \ elm_widget_gengrid.h \ @@ -329,8 +330,9 @@ includesub_HEADERS = \ elm_entry_legacy.h \ elm_finger.h \ elm_flip.h \ - elm_flip_eo.h \ - elm_flip_legacy.h \ + efl_ui_flip_legacy.h\ + efl_ui_flip.eo.h \ + efl_ui_flip_internal_part.eo.h \ elm_flipselector.h \ elm_flipselector_eo.h \ elm_flipselector_legacy.h \ @@ -541,7 +543,7 @@ libelementary_la_SOURCES = \ elm_dbus_menu.c \ elm_diskselector.c \ elm_entry.c \ - elm_flip.c \ + efl_ui_flip.c \ elm_flipselector.c \ elm_font.c \ elm_frame.c \ diff --git a/src/lib/elementary/elm_flip.c b/src/lib/elementary/efl_ui_flip.c similarity index 82% rename from src/lib/elementary/elm_flip.c rename to src/lib/elementary/efl_ui_flip.c index adeddd5..748397a 100644 --- a/src/lib/elementary/elm_flip.c +++ b/src/lib/elementary/efl_ui_flip.c @@ -6,15 +6,15 @@ #include #include "elm_priv.h&quo
[EGIT] [core/efl] master 07/07: evas: updated evas_vg_sample with the appen_arc() api as well as _shape_dup() api test.
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=fbde2778af469c43311a8fb343f52cd2e1488ce4 commit fbde2778af469c43311a8fb343f52cd2e1488ce4 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Tue May 31 14:42:37 2016 -0700 evas: updated evas_vg_sample with the appen_arc() api as well as _shape_dup() api test. Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3966 Signed-off-by: Cedric BAIL <ced...@osg.samsung.com> --- src/examples/evas/evas-vg-simple.c | 365 ++--- 1 file changed, 16 insertions(+), 349 deletions(-) diff --git a/src/examples/evas/evas-vg-simple.c b/src/examples/evas/evas-vg-simple.c index 329e7a7..305df03 100644 --- a/src/examples/evas/evas-vg-simple.c +++ b/src/examples/evas/evas-vg-simple.c @@ -39,16 +39,6 @@ #define PATH_KAPPA 0.5522847498 #define PI 3.1415926535 -typedef struct _Bezier -{ -float x1, y1, x2, y2, x3, y3, x4, y4; -}Bezier; - -typedef struct _Point -{ -int x; -int y; -}Point; static Efl_VG *beginning = NULL; static Efl_VG *end = NULL; @@ -56,337 +46,6 @@ static Efl_VG *root = NULL; static double start_time = 0; static Ecore_Animator *anim = NULL; -static -Bezier bezierFromPoints(Point p1, Point p2, -Point p3, Point p4) -{ -Bezier b; -b.x1 = p1.x; -b.y1 = p1.y; -b.x2 = p2.x; -b.y2 = p2.y; -b.x3 = p3.x; -b.y3 = p3.y; -b.x4 = p4.x; -b.y4 = p4.y; -return b; -} - -static inline void -parameterSplitLeft(Bezier *b, float t, Bezier *left) -{ -left->x1 = b->x1; -left->y1 = b->y1; - -left->x2 = b->x1 + t * ( b->x2 - b->x1 ); -left->y2 = b->y1 + t * ( b->y2 - b->y1 ); - -left->x3 = b->x2 + t * ( b->x3 - b->x2 ); // temporary holding spot -left->y3 = b->y2 + t * ( b->y3 - b->y2 ); // temporary holding spot - -b->x3 = b->x3 + t * ( b->x4 - b->x3 ); -b->y3 = b->y3 + t * ( b->y4 - b->y3 ); - -b->x2 = left->x3 + t * ( b->x3 - left->x3); -b->y2 = left->y3 + t * ( b->y3 - left->y3); - -left->x3 = left->x2 + t * ( left->x3 - left->x2 ); -left->y3 = left->y2 + t * ( left->y3 - left->y2 ); - -left->x4 = b->x1 = left->x3 + t * (b->x2 - left->x3); -left->y4 = b->y1 = left->y3 + t * (b->y2 - left->y3); -} -static -Bezier bezierOnInterval(Bezier *b, float t0, float t1) -{ -if (t0 == 0 && t1 == 1) -return *b; - -Bezier result; -parameterSplitLeft(b, t0, ); -float trueT = (t1-t0)/(1-t0); -parameterSplitLeft(b, trueT, ); - -return result; -} - -static inline void -_bezier_coefficients(float t, float *ap, float *bp, float *cp, float *dp) -{ -float a,b,c,d; -float 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; -} - -static -float _t_for_arc_angle(float angle) -{ -if (angle < 0.1) -return 0; - -if (angle == 90.0) -return 1; - -float radians = PI * angle / 180; -float cosAngle = cos(radians); -float sinAngle = sin(radians); - -// initial guess -float tc = angle / 90; -// do some iterations of newton's method to approximate cosAngle -// finds the zero of the function b.pointAt(tc).x() - cosAngle -tc -= 2-3*PATH_KAPPA) * tc + 3*(PATH_KAPPA-1)) * tc) * tc + 1 - cosAngle) // 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 - cosAngle) // value - / (((6-9*PATH_KAPPA) * tc + 6*(PATH_KAPPA-1)) * tc); // derivative - -// initial guess -float ts = tc; -// do some iterations of newton's method to approximate sinAngle -// finds the zero of the function b.pointAt(tc).y() - sinAngle -ts -= 3*PATH_KAPPA-2) * ts - 6*PATH_KAPPA + 3) * ts + 3*PATH_KAPPA) * ts - sinAngle) - / (((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 - sinAngle) - / (((9*PATH_KAPPA-6) * ts + 12*PATH_KAPPA - 6) * ts + 3*PATH_KAPPA); - -// use the average of the t that best approximates cosAngle -// and the t that best approximates sinAngle -float t = 0.5 * (tc + ts); -return t; -} - -static void -_find_ellipse_coords(int x, int y, int w, int h, float angle, float length, -Point* startPoint, Point *endPoint) -{ -if (!w || !h ) { -if (startPoint) -startPoint->x = 0 , startPoint->y = 0; -if (endPoint) -endPoint->x = 0 , endPoi
[EGIT] [core/efl] master 02/05: evas: changed the interpolate() implementaion
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=a3cdafe9a25b2f12a1ba3dc7d99df1fda23c5fd1 commit a3cdafe9a25b2f12a1ba3dc7d99df1fda23c5fd1 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu May 19 01:39:44 2016 -0700 evas: changed the interpolate() implementaion Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3960 Signed-off-by: Cedric Bail <ced...@osg.samsung.com> --- src/lib/evas/canvas/evas_vg_container.c | 46 ++--- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c index a805902..b34d137 100644 --- a/src/lib/evas/canvas/evas_vg_container.c +++ b/src/lib/evas/canvas/evas_vg_container.c @@ -103,34 +103,38 @@ _efl_vg_container_efl_vg_interpolate(Eo *obj, const Efl_VG *from, const Efl_VG *to, double pos_map) { - Efl_VG_Container_Data *fd; - Efl_VG_Container_Data *td; - Eina_Iterator *it; - Eina_Hash_Tuple *tuple; - Eina_Bool r; + Eina_Iterator *from_it, *to_it; + Eina_List *l; + Eina_Bool r, res = EINA_TRUE; + Eo *from_child, *to_child, *child; + + //1. check if both the object are containers + if (!(eo_isa(from, EFL_VG_CONTAINER_CLASS) && + eo_isa(to, EFL_VG_CONTAINER_CLASS))) + return EINA_FALSE; r = efl_vg_interpolate(eo_super(obj, EFL_VG_CONTAINER_CLASS), from, to, pos_map); if (!r) return EINA_FALSE; - fd = eo_data_scope_get(from, EFL_VG_CONTAINER_CLASS); - td = eo_data_scope_get(to, EFL_VG_CONTAINER_CLASS); - - it = eina_hash_iterator_tuple_new(pd->names); - EINA_ITERATOR_FOREACH(it, tuple) + from_it = efl_vg_container_children_get((Efl_VG *)from); + to_it = efl_vg_container_children_get((Efl_VG *)to); + EINA_LIST_FOREACH (pd->children, l, child) { -Eo *fromc, *toc; -Eo *cc = tuple->data; - -fromc = eina_hash_find(fd->names, tuple->key); -toc = eina_hash_find(td->names, tuple->key); - -if (!toc || !fromc) continue ; -if (eo_class_get(toc) != eo_class_get(fromc)) continue ; - -r &= efl_vg_interpolate(cc, fromc, toc, pos_map); +res &= eina_iterator_next(from_it, (void **)_child); +res &= eina_iterator_next(to_it, (void **)_child); +if (!res && (eo_class_get(from_child) != eo_class_get(to_child) || +(eo_class_get(child) != eo_class_get(from_child + { + r = EINA_FALSE; + break; + } +r &= efl_vg_interpolate(child, from_child, to_child, pos_map); +if (!r) + break; } - eina_iterator_free(it); + eina_iterator_free(from_it); + eina_iterator_free(to_it); return r; } --
[EGIT] [core/efl] master 01/05: evas: fix the ref issue of newly created object in shape_dup() function
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=74cee52900fa31d01fc68b4735ccd3185cd89859 commit 74cee52900fa31d01fc68b4735ccd3185cd89859 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu May 19 01:36:33 2016 -0700 evas: fix the ref issue of newly created object in shape_dup() function Summary: There are couple of issue. By adding the gradient to both parent container as well as to the shape. when we dupe the container it copies twice. Usually we create one gradient and set it to multiple shape , in that case when we call dupe() function it is going to make a separate copy for each of the shape. The patch fixes 1st issue. for 2nd one we need to maybe change the way we implemented dupe function Reviewers: Hermet, cedric Reviewed By: cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3961 Signed-off-by: Cedric Bail <ced...@osg.samsung.com> --- src/lib/evas/canvas/evas_vg_shape.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/evas/canvas/evas_vg_shape.c b/src/lib/evas/canvas/evas_vg_shape.c index 80e4e03..b356b07 100644 --- a/src/lib/evas/canvas/evas_vg_shape.c +++ b/src/lib/evas/canvas/evas_vg_shape.c @@ -232,22 +232,25 @@ _efl_vg_shape_efl_vg_dup(Eo *obj, Efl_VG_Shape_Data *pd EINA_UNUSED, const Efl_V if (fromd->fill) { -fill = eo_add(eo_class_get(fromd->fill), parent, efl_vg_dup(eo_self, fromd->fill)); +fill = eo_add(eo_class_get(fromd->fill), NULL, efl_vg_dup(eo_self, fromd->fill)); +efl_vg_shape_fill_set(obj, fill); +eo_unref(fill); } if (fromd->stroke.fill) { -stroke_fill = eo_add(eo_class_get(fromd->stroke.fill), parent, efl_vg_dup(eo_self, fromd->stroke.fill)); +stroke_fill = eo_add(eo_class_get(fromd->stroke.fill), NULL, efl_vg_dup(eo_self, fromd->stroke.fill)); +efl_vg_shape_stroke_fill_set(obj, stroke_fill); +eo_unref(stroke_fill); } if (fromd->stroke.marker) { -stroke_marker = eo_add(eo_class_get(fromd->stroke.marker), parent, efl_vg_dup(eo_self, fromd->stroke.marker)); +stroke_marker = eo_add(eo_class_get(fromd->stroke.marker), NULL, efl_vg_dup(eo_self, fromd->stroke.marker)); +efl_vg_shape_stroke_marker_set(obj, stroke_marker); +eo_unref(stroke_marker); } - efl_vg_shape_fill_set(obj, fill); - efl_vg_shape_stroke_fill_set(obj, stroke_fill); - efl_vg_shape_stroke_marker_set(obj, stroke_marker); efl_gfx_shape_dup(obj, from); } --
[EGIT] [core/efl] master 05/05: evas: propagate the change to child when object is a vector graphic container
cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=655ed09ab4026c9994d6aa9c4e3a3c245541c262 commit 655ed09ab4026c9994d6aa9c4e3a3c245541c262 Author: Subhransu Mohanty <sub.moha...@samsung.com> Date: Thu May 19 01:55:06 2016 -0700 evas: propagate the change to child when object is a vector graphic container Summary: let me know whats your thought Reviewers: Hermet, cedric Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D3893 Signed-off-by: Cedric Bail <ced...@osg.samsung.com> --- src/lib/efl/interfaces/efl_gfx_types.eot | 9 + src/lib/evas/canvas/evas_vg_container.c | 18 +++--- src/lib/evas/canvas/evas_vg_gradient_linear.c | 5 +++-- src/lib/evas/canvas/evas_vg_gradient_radial.c | 5 +++-- src/lib/evas/canvas/evas_vg_node.c| 5 +++-- src/lib/evas/canvas/evas_vg_private.h | 1 + src/lib/evas/canvas/evas_vg_shape.c | 5 +++-- 7 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/lib/efl/interfaces/efl_gfx_types.eot b/src/lib/efl/interfaces/efl_gfx_types.eot index d7a85d1..0e4dd1e 100644 --- a/src/lib/efl/interfaces/efl_gfx_types.eot +++ b/src/lib/efl/interfaces/efl_gfx_types.eot @@ -159,3 +159,12 @@ enum Efl.Gfx.Border_Fill_Mode solid = 2 [[Image's center region is to be made solid, even if it has transparency on it]] } +enum Efl.Gfx.Change.Flag +{ + [[What property got changed for this object @since 1.18]] + none= 0x0, [[No change]] + matrix = 0x1, [[matrix got changed]] + path= 0x2, [[path got changes]] + all = -1 [[all property got changed]] +} + diff --git a/src/lib/evas/canvas/evas_vg_container.c b/src/lib/evas/canvas/evas_vg_container.c index b34d137..fc11bec 100644 --- a/src/lib/evas/canvas/evas_vg_container.c +++ b/src/lib/evas/canvas/evas_vg_container.c @@ -15,14 +15,25 @@ _efl_vg_container_render_pre(Eo *obj EINA_UNUSED, Efl_VG_Container_Data *pd = data; Eina_List *l; Eo *child; + Efl_VG_Data *child_nd; + Efl_Gfx_Change_Flag flag; - if (!nd->changed) return ; - nd->changed = EINA_FALSE; + if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ; + + flag = nd->flags; + nd->flags = EFL_GFX_CHANGE_FLAG_NONE; EFL_VG_COMPUTE_MATRIX(current, parent, nd); EINA_LIST_FOREACH(pd->children, l, child) - _evas_vg_render_pre(child, s, current); + { +if (flag & EFL_GFX_CHANGE_FLAG_MATRIX) + { + child_nd = eo_data_scope_get(child, EFL_VG_CLASS); + child_nd->flags |= EFL_GFX_CHANGE_FLAG_MATRIX; + } +_evas_vg_render_pre(child, s, current); + } } static Eo * @@ -38,6 +49,7 @@ _efl_vg_container_eo_base_constructor(Eo *obj, nd = eo_data_scope_get(obj, EFL_VG_CLASS); nd->render_pre = _efl_vg_container_render_pre; nd->data = pd; + nd->flags = EFL_GFX_CHANGE_FLAG_ALL; return obj; } diff --git a/src/lib/evas/canvas/evas_vg_gradient_linear.c b/src/lib/evas/canvas/evas_vg_gradient_linear.c index 5aa2607..1149170 100644 --- a/src/lib/evas/canvas/evas_vg_gradient_linear.c +++ b/src/lib/evas/canvas/evas_vg_gradient_linear.c @@ -65,8 +65,9 @@ _efl_vg_gradient_linear_render_pre(Eo *obj, Efl_VG_Gradient_Linear_Data *pd = data; Efl_VG_Gradient_Data *gd; - if (!nd->changed) return ; - nd->changed = EINA_FALSE; + if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ; + + nd->flags = EFL_GFX_CHANGE_FLAG_NONE; gd = eo_data_scope_get(obj, EFL_VG_GRADIENT_CLASS); EFL_VG_COMPUTE_MATRIX(current, parent, nd); diff --git a/src/lib/evas/canvas/evas_vg_gradient_radial.c b/src/lib/evas/canvas/evas_vg_gradient_radial.c index c36150a..4a46c7a 100644 --- a/src/lib/evas/canvas/evas_vg_gradient_radial.c +++ b/src/lib/evas/canvas/evas_vg_gradient_radial.c @@ -81,8 +81,9 @@ _efl_vg_gradient_radial_render_pre(Eo *obj, Efl_VG_Gradient_Radial_Data *pd = data; Efl_VG_Gradient_Data *gd; - if (!nd->changed) return ; - nd->changed = EINA_FALSE; + if (nd->flags == EFL_GFX_CHANGE_FLAG_NONE) return ; + + nd->flags = EFL_GFX_CHANGE_FLAG_NONE; gd = eo_data_scope_get(obj, EFL_VG_GRADIENT_CLASS); EFL_VG_COMPUTE_MATRIX(current, parent, nd); diff --git a/src/lib/evas/canvas/evas_vg_node.c b/src/lib/evas/canvas/evas_vg_node.c index 7a55b20..3c44b91 100644 --- a/src/lib/evas/canvas/evas_vg_node.c +++ b/src/lib/evas/canvas/evas_vg_node.c @@ -23,8 +23,7 @@ _efl_vg_property_changed(void *data, const Eo_Event *event) Efl_VG_Data *pd = data; Eo *parent; - if (pd->changed) return EINA_TRUE; - pd->changed = EINA_TRUE; + if (!pd->flags) pd->flags = EFL_GFX_CHANGE_FLAG_ALL; parent = eo_parent_get(event->object); eo_event_callback_call(parent, event->desc, event->info); @@ -57,6 +56,7 @@ _efl_vg_transformation_set(Eo *obj, p