From 98a3dcd94e43e7d172d1609523467edcaed02c1c Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Mon, 18 Nov 2019 12:57:18 +0900 Subject: [PATCH 1/9] Revert "evas: migrate the vg json example" This reverts commit a1f1cd6dd67de8eac0e302d47ce2aebf44aead16. Eeek, this shouldn't be pushed yet. --- src/examples/evas/evas-vg-json.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/examples/evas/evas-vg-json.c b/src/examples/evas/evas-vg-json.c index cf0519f6f3..248dcb1054 100644 --- a/src/examples/evas/evas-vg-json.c +++ b/src/examples/evas/evas-vg-json.c @@ -35,9 +35,10 @@ static Eo *gvg[5]; static void -_running_cb(void *data EINA_UNUSED, const Efl_Event *event) +running_cb(void *data EINA_UNUSED, const Efl_Event *event) { - double progress = *((double*)event->info); + Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; + double progress = event_running->progress; int i; for (i = 0; i < 5; i++) @@ -119,8 +120,11 @@ main(void) //Play custom animation Eo *anim = efl_add(EFL_CANVAS_ANIMATION_CLASS, evas); efl_animation_duration_set(anim, efl_gfx_frame_controller_frame_duration_get(vg, 0, 0)); - efl_event_callback_add(vg, EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _running_cb, NULL); - efl_canvas_object_animation_start(vg, anim, 1.0, 0.0); + + Eo *player = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, evas); + efl_animation_player_animation_set(player, anim); + efl_event_callback_add(player, EFL_ANIMATION_PLAYER_EVENT_RUNNING, running_cb, NULL); + efl_player_playing_set(player, EINA_TRUE); ecore_main_loop_begin(); ecore_evas_shutdown(); From 618bce8038b6362c0de232498566ecf97dc2d17e Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Mon, 18 Nov 2019 11:48:40 +0900 Subject: [PATCH 2/9] evas vg: improve caching methods for better precise behaviors. Previously, json file data won't be shared between instances. Now, objects can share the json data if they use the same file resource. --- src/lib/evas/canvas/efl_canvas_vg_object.c | 19 ++--- src/lib/evas/canvas/evas_vg_private.h | 1 - src/lib/evas/include/evas_private.h | 1 - src/lib/evas/vg/evas_vg_cache.c | 76 +++++++++---------- .../evas/vg_loaders/json/evas_vg_load_json.c | 1 - 5 files changed, 41 insertions(+), 57 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_object.c b/src/lib/evas/canvas/efl_canvas_vg_object.c index 3c3c0d81d6..52215200a7 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_object.c +++ b/src/lib/evas/canvas/efl_canvas_vg_object.c @@ -524,7 +524,6 @@ _render_to_buffer(Evas_Object_Protected_Data *obj, Efl_Canvas_Vg_Object_Data *pd { //Use root as a cache key. ENFN->ector_surface_cache_set(engine, root, buffer); - pd->cached_frame_idx = pd->frame_idx; } return buffer; @@ -566,7 +565,6 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj, Vg_Cache_Entry *vg_entry = pd->vg_entry; Efl_VG *root; Eina_Position2D offset = {0, 0}; //Offset after keeping aspect ratio. - Eina_Bool drop_cache = EINA_FALSE; void *buffer = NULL; evas_cache_vg_entry_value_provider_update(pd->vg_entry, efl_key_data_get(obj->object, "_vg_value_providers")); @@ -603,7 +601,10 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj, //Size is changed, cached data is invalid. if ((size.w != vg_entry->w) || (size.h != vg_entry->h)) { - drop_cache = EINA_TRUE; + //if the size doesn't match, drop previous cache surfaces. + ENFN->ector_surface_cache_drop(engine, (void *) vg_entry->root[1]); + ENFN->ector_surface_cache_drop(engine, (void *) vg_entry->root[2]); + vg_entry = evas_cache_vg_entry_resize(vg_entry, size.w, size.h); evas_cache_vg_entry_del(pd->vg_entry); pd->vg_entry = vg_entry; @@ -623,20 +624,12 @@ _cache_vg_entry_render(Evas_Object_Protected_Data *obj, if (cacheable) { - //if the size doesn't match, drop previous cache surface. - if (drop_cache) - ENFN->ector_surface_cache_drop(engine, (void *) root); //Cache Hit! - else if (pd->frame_idx == pd->cached_frame_idx) - buffer = ENFN->ector_surface_cache_get(engine, (void *) root); - //Drop invalid one. - else - ENFN->ector_surface_cache_drop(engine, (void *) root); + buffer = ENFN->ector_surface_cache_get(engine, (void *) root); } if (!buffer) - buffer = _render_to_buffer(obj, pd, engine, root, w, h, NULL, - do_async, cacheable); + buffer = _render_to_buffer(obj, pd, engine, root, w, h, NULL, do_async, cacheable); else //cache reference was increased when we get the cache. ENFN->ector_surface_cache_drop(engine, (void *) root); diff --git a/src/lib/evas/canvas/evas_vg_private.h b/src/lib/evas/canvas/evas_vg_private.h index f5600f9757..8a36fd826d 100644 --- a/src/lib/evas/canvas/evas_vg_private.h +++ b/src/lib/evas/canvas/evas_vg_private.h @@ -52,7 +52,6 @@ struct _Efl_Canvas_Vg_Object_Data double align_x, align_y; Efl_Canvas_Vg_Fill_Mode fill_mode; int frame_idx; - int cached_frame_idx; Eina_Bool changed : 1; }; diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 838174a3f2..1f514d205c 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -1561,7 +1561,6 @@ struct _Vg_File_Data void *loader_data; //loader specific local data - Eina_Bool no_share : 1; //Shareable VFD through multiple file open requests. Eina_Bool static_viewbox: 1; Eina_Bool preserve_aspect : 1; //Used in SVG }; diff --git a/src/lib/evas/vg/evas_vg_cache.c b/src/lib/evas/vg/evas_vg_cache.c index 8ffdfab3f8..68d4e7a634 100644 --- a/src/lib/evas/vg/evas_vg_cache.c +++ b/src/lib/evas/vg/evas_vg_cache.c @@ -83,7 +83,9 @@ _vg_load_from_file(const Eina_File *file, const char *key) if (em) { loader = em->functions; - vfd = loader->file_open((Eina_File *) file, key, &error); + { + vfd = loader->file_open((Eina_File *) file, key, &error); + } if (vfd) { vfd->loader = loader; @@ -153,18 +155,13 @@ _evas_cache_vg_entry_free_cb(void *data) if (vg_entry->vfd->ref <= 0) { - if (vg_entry->vfd->no_share) - vg_entry->vfd->loader->file_close(vg_entry->vfd); - else - { - Eina_Strbuf *hash_key = eina_strbuf_new(); - eina_strbuf_append_printf(hash_key, "%s/%s", - eina_file_filename_get(vg_entry->file), - vg_entry->key); - if (!eina_hash_del(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vg_entry->vfd)) - ERR("Failed to delete vfd = (%p) from hash", vg_entry->vfd); - eina_strbuf_free(hash_key); - } + Eina_Strbuf *hash_key = eina_strbuf_new(); + eina_strbuf_append_printf(hash_key, "%s/%s", + eina_file_filename_get(vg_entry->file), + vg_entry->key); + if (!eina_hash_del(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vg_entry->vfd)) + ERR("Failed to delete vfd = (%p) from hash", vg_entry->vfd); + eina_strbuf_free(hash_key); } } @@ -235,7 +232,7 @@ _cached_root_get(Vg_Cache_Entry *vg_entry, unsigned int frame_num) return NULL; } -static void +static Efl_VG * _caching_root_update(Vg_Cache_Entry *vg_entry) { Vg_File_Data *vfd = vg_entry->vfd; @@ -251,33 +248,31 @@ _caching_root_update(Vg_Cache_Entry *vg_entry) to this root pointer. */ vg_entry->root[0] = efl_duplicate(vfd->root); } - else if (vg_entry->root[0] != vfd->root) + else { if (vg_entry->root[0]) efl_unref(vg_entry->root[0]); - vg_entry->root[0] = efl_ref(vfd->root); - } + vg_entry->root[0] = efl_duplicate(vfd->root); - //Animatable? - if (!vfd->anim_data) return; - - //Start frame - if (vfd->anim_data->frame_num == 0) - { - if (vg_entry->root[1] != vfd->root) + //Animatable? + if (vfd->anim_data) { - if (vg_entry->root[1]) efl_unref(vg_entry->root[1]); - vg_entry->root[1] = efl_ref(vfd->root); - } - } - //End frame - else if (vfd->anim_data->frame_num == (vfd->anim_data->frame_cnt - 1)) - { - if (vg_entry->root[2] != vfd->root) - { - if (vg_entry->root[2]) efl_unref(vg_entry->root[2]); - vg_entry->root[2] = efl_ref(vfd->root); + //Start frame + if (vfd->anim_data->frame_num == 0) + { + if (vg_entry->root[1]) efl_unref(vg_entry->root[1]); + vg_entry->root[1] = efl_duplicate(vfd->root); + return vg_entry->root[1]; + } + //End frame + else if (vfd->anim_data->frame_num == (vfd->anim_data->frame_cnt - 1)) + { + if (vg_entry->root[2]) efl_unref(vg_entry->root[2]); + vg_entry->root[2] = efl_duplicate(vfd->root); + return vg_entry->root[2]; + } } } + return vg_entry->root[0]; } static void @@ -351,12 +346,11 @@ evas_cache_vg_file_open(const Eina_File *file, const char *key) hash_key = eina_strbuf_new(); eina_strbuf_append_printf(hash_key, "%s/%s", eina_file_filename_get(file), key); vfd = eina_hash_find(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key)); - if (!vfd || vfd->no_share) + if (!vfd) { vfd = _vg_load_from_file(file, key); //File exists. - if (vfd && !vfd->no_share) - eina_hash_add(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vfd); + if (vfd) eina_hash_add(vg_cache->vfd_hash, eina_strbuf_string_get(hash_key), vfd); } eina_strbuf_free(hash_key); return vfd; @@ -507,11 +501,11 @@ evas_cache_vg_tree_get(Vg_Cache_Entry *vg_entry, unsigned int frame_num) if (!vfd->loader->file_data(vfd)) return NULL; - _caching_root_update(vg_entry); + root = _caching_root_update(vg_entry); - _local_transform(vg_entry->root[0], vg_entry->w, vg_entry->h, vfd); + _local_transform(root, vg_entry->w, vg_entry->h, vfd); - return vg_entry->root[0]; + return root; } void diff --git a/src/modules/evas/vg_loaders/json/evas_vg_load_json.c b/src/modules/evas/vg_loaders/json/evas_vg_load_json.c index e7f2754dd9..60a0d06916 100644 --- a/src/modules/evas/vg_loaders/json/evas_vg_load_json.c +++ b/src/modules/evas/vg_loaders/json/evas_vg_load_json.c @@ -103,7 +103,6 @@ evas_vg_load_file_open_json(Eina_File *file, vfd->h = (int) h; vfd->loader_data = (void *) lot_anim; - vfd->no_share = EINA_TRUE; return vfd; From 54217cda84b4019dfe8fd3428c7258f3ac58ae8c Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Mon, 18 Nov 2019 11:49:52 +0900 Subject: [PATCH 3/9] evas image cache: drop cache properly, the default reference is 1, thus we should drop it unless if it's more than 1, --- src/lib/evas/common/evas_common_generic_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/evas/common/evas_common_generic_cache.c b/src/lib/evas/common/evas_common_generic_cache.c index 55bcf725d6..ddb055deb2 100644 --- a/src/lib/evas/common/evas_common_generic_cache.c +++ b/src/lib/evas/common/evas_common_generic_cache.c @@ -50,7 +50,7 @@ generic_cache_data_set(Generic_Cache *cache, void *key, void *surface) { entry = eina_list_data_get(eina_list_last(cache->lru_list)); // if its still being ref. - if (entry->ref) return; + if (entry->ref > 1) return; eina_hash_del(cache->hash, &entry->key, entry); cache->lru_list = eina_list_remove_list(cache->lru_list, eina_list_last(cache->lru_list)); cache->free_func(cache->user_data, entry->data); From 3f3b7259453a4519e40e90b15962331158928ac4 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 15 Nov 2019 09:39:38 -0800 Subject: [PATCH 4/9] eldbus: only free the data when the future is resolved or rejected. Reviewed-by: Stefan Schmidt Differential Revision: https://phab.enlightenment.org/D10684 --- src/lib/eldbus/eldbus_model_proxy.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/src/lib/eldbus/eldbus_model_proxy.c b/src/lib/eldbus/eldbus_model_proxy.c index bf1f8fb931..d0cbcb52af 100644 --- a/src/lib/eldbus/eldbus_model_proxy.c +++ b/src/lib/eldbus/eldbus_model_proxy.c @@ -39,8 +39,6 @@ struct _Eldbus_Property_Promise Eina_Stringshare *property; }; -static void _eldbus_model_proxy_property_set_data_free(Eldbus_Model_Proxy_Property_Set_Data *); - static Eina_Bool _eldbus_model_proxy_load(Eldbus_Model_Proxy_Data *pd) { @@ -236,6 +234,9 @@ _eldbus_model_proxy_cancel_cb(Efl_Loop_Consumer *consumer EINA_UNUSED, Eldbus_Model_Proxy_Property_Set_Data *sd = data; sd->promise = NULL; + eina_stringshare_del(sd->property); + eina_value_free(sd->value); + free(sd); } static Eldbus_Pending * @@ -655,7 +656,6 @@ _eldbus_model_proxy_property_set_load_cb(void *data, if (!signature || !properties) { eina_promise_reject(set_data->promise, EFL_MODEL_ERROR_UNKNOWN); - _eldbus_model_proxy_property_set_data_free(set_data); goto end; } @@ -688,7 +688,7 @@ _eldbus_model_proxy_property_set_cb(void *data, { ERR("%s: %s", error_name, error_text); eina_promise_reject(sd->promise, EFL_MODEL_ERROR_UNKNOWN); - goto end; + return; } value = eina_hash_find(pd->properties, sd->property); @@ -705,9 +705,6 @@ _eldbus_model_proxy_property_set_cb(void *data, eina_promise_reject(sd->promise, EFL_MODEL_ERROR_NOT_FOUND); } - - end: - _eldbus_model_proxy_property_set_data_free(sd); } static const char * @@ -726,13 +723,4 @@ _eldbus_model_proxy_property_type_get(Eldbus_Model_Proxy_Data *pd, return property_introspection->type; } -static void -_eldbus_model_proxy_property_set_data_free(Eldbus_Model_Proxy_Property_Set_Data *data) -{ - EINA_SAFETY_ON_NULL_RETURN(data); - eina_stringshare_del(data->property); - eina_value_free(data->value); - free(data); -} - #include "eldbus_model_proxy.eo.c" From 1c5849c5a8b2b3ccc48caf55e5568f122bb0be9a Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Mon, 18 Nov 2019 11:57:30 +0100 Subject: [PATCH 5/9] doxygen: Prevent auto-linking of invalid links Anything starting with http://, ftp:// or file:// is automatically converted into a link by doxygen. However, we have a few instances where we do not want this. Fortunately, doxygen allows using % to forbid specific words from being linked. --- src/lib/ecore_file/Ecore_File.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/ecore_file/Ecore_File.h b/src/lib/ecore_file/Ecore_File.h index 23a0521945..37f3bd8a0c 100644 --- a/src/lib/ecore_file/Ecore_File.h +++ b/src/lib/ecore_file/Ecore_File.h @@ -609,8 +609,8 @@ EAPI Eina_List *ecore_file_app_list(void); * @return @c EINA_TRUE if the download start or @c EINA_FALSE on failure. * * This function starts the download of the URL @p url and saves it to - * @p dst. @p url must provide the protocol, including 'http://', - * 'ftp://' or 'file://'. Ecore_File must be compiled with CURL to + * @p dst. @p url must provide the protocol, including '%http://', + * '%ftp://' or '%file://'. Ecore_File must be compiled with CURL to * download using http and ftp protocols. If @p dst is ill-formed, or * if it already exists, the function returns @c EINA_FALSE. When the * download is complete, the callback @p completion_cb is called and @@ -684,8 +684,8 @@ EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job); * @return @c EINA_TRUE if protocol is handled, @c EINA_FALSE otherwise. * * This function returns @c EINA_TRUE if @p protocol is supported, - * @c EINA_FALSE otherwise. @p protocol can be 'http://', 'ftp://' or - * 'file://'. Ecore_FILE must be compiled with CURL to handle http and + * @c EINA_FALSE otherwise. @p protocol can be '%http://', '%ftp://' or + * '%file://'. Ecore_FILE must be compiled with CURL to handle http and * ftp protocols. */ EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol); From 070cde61b5a55bae055a084aa4dffbca02dfdcba Mon Sep 17 00:00:00 2001 From: Xavi Artigas Date: Mon, 18 Nov 2019 12:30:22 +0100 Subject: [PATCH 6/9] docs: Typos in ninja doc screen output --- doc/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/meson.build b/doc/meson.build index 5598b18ba3..81c0e34910 100644 --- a/doc/meson.build +++ b/doc/meson.build @@ -189,7 +189,7 @@ compress_target = custom_target('package_doc_tar', ) run_target('doc', - command: ['echo', 'Documentation sucessfully build!'], + command: ['echo', 'Documentation built successfully'], depends: compress_target, ) From c30176e7ffac0ab70b8ef92cb0fce62b75499181 Mon Sep 17 00:00:00 2001 From: Bowon Ryu Date: Mon, 18 Nov 2019 21:25:26 +0900 Subject: [PATCH 7/9] slider: fix value error from step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: When the slider moves using step, _drag_value_fetch(), _val_fetch() calculates a value from position of edje_part. Then the calculated value is updated. However, this causes a slight error. This patch updates value ​​first when moving with steps. * Test Example ``` Evas_Object *sl = elm_slider_add(bx); elm_slider_min_max_set(sl, -5, 5); elm_slider_value_set(sl, 0.0); elm_slider_step_set(sl, 0.1); evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_smart_callback_add(sl, "changed", _change_cb, NULL); ``` ``` void _change_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) { double val = elm_slider_value_get(obj); if (val == -5.0) printf("val[%f] == -5.0 \n", val); if (val == -4.0) printf("val[%f] == -4.0 \n", val); if (val == -3.0) printf("val[%f] == -3.0 \n", val); if (val == -2.0) printf("val[%f] == -2.0 \n", val); if (val == -1.0) printf("val[%f] == -1.0 \n", val); if (val == 0.0) printf("val[%f] == 0.0 \n", val); if (val == 1.0) printf("val[%f] == 1.0 \n", val); if (val == 2.0) printf("val[%f] == 2.0 \n", val); if (val == 3.0) printf("val[%f] == 3.0 \n", val); if (val == 4.0) printf("val[%f] == 4.0 \n", val); if (val == 5.0) printf("val[%f] == 5.0 \n", val); } ``` If you move the slider using step in this test, You can see that some logs are not visible. (Some values ​​are incorrect) Test Plan: elementary_test -to slider elementary_test -to efl.ui.slider Reviewers: woohyun, cedric, bu5hm4n Reviewed By: woohyun, bu5hm4n Subscribers: bu5hm4n, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D10662 --- src/lib/elementary/efl_ui_slider.c | 21 ++++++++++++++-- src/lib/elementary/elm_priv.h | 3 +++ src/lib/elementary/elm_slider.c | 39 +++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/lib/elementary/efl_ui_slider.c b/src/lib/elementary/efl_ui_slider.c index 2aca5f96f5..219a15bc94 100644 --- a/src/lib/elementary/efl_ui_slider.c +++ b/src/lib/elementary/efl_ui_slider.c @@ -77,6 +77,21 @@ _user_value_update(Evas_Object *obj, double value) evas_object_smart_changed(obj); } +static void +_step_value_update(Evas_Object *obj, double step) +{ + double value; + + EFL_UI_SLIDER_DATA_GET(obj, sd); + + if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir)) + step *= -1.0; + + value = CLAMP(sd->val + step, sd->val_min, sd->val_max); + _user_value_update(obj, value); + +} + static void _drag_value_fetch(Evas_Object *obj) { @@ -194,7 +209,8 @@ _drag_up(Evas_Object *obj) efl_ui_drag_step_move(efl_part(wd->resize_obj, "efl.draggable.slider"), relative_step, relative_step); - _drag_value_fetch(obj); + + _step_value_update(obj, step); } static void @@ -214,7 +230,8 @@ _drag_down(Evas_Object *obj) efl_ui_drag_step_move(efl_part(wd->resize_obj, "efl.draggable.slider"), relative_step, relative_step); - _drag_value_fetch(obj); + + _step_value_update(obj, step); } static Eina_Bool diff --git a/src/lib/elementary/elm_priv.h b/src/lib/elementary/elm_priv.h index 0d71bd0b08..0be9080eab 100644 --- a/src/lib/elementary/elm_priv.h +++ b/src/lib/elementary/elm_priv.h @@ -329,6 +329,9 @@ extern const char *_elm_engines[]; # define ELM_PRIV_SMART_CALLBACKS_DESC(name, signal, type) \ {name, type}, +# define CLAMP(x, min, max) \ + (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x))) + struct _Elm_Config_Flags { Eina_Bool engine : 1; diff --git a/src/lib/elementary/elm_slider.c b/src/lib/elementary/elm_slider.c index 85426386e2..c426a45aeb 100644 --- a/src/lib/elementary/elm_slider.c +++ b/src/lib/elementary/elm_slider.c @@ -144,7 +144,6 @@ _indicator_set(Evas_Object *obj) elm_layout_text_set(obj, "elm.dragable.slider:elm.indicator", str); if (sd->popup) edje_object_part_text_set(sd->popup, "elm.indicator", str); - if (sd->popup2) { eina_strbuf_reset(sd->indi_format_strbuf); @@ -335,6 +334,40 @@ _val_set(Evas_Object *obj) evas_object_smart_changed(obj); } +static void +_user_value_update(Evas_Object *obj, double value) +{ + double val = value; + + ELM_SLIDER_DATA_GET_OR_RETURN(obj, sd); + + if (fabs(val - sd->val) > DBL_EPSILON) + { + sd->val = val; + sd->intvl_from = val; + _val_set(obj); + + evas_object_smart_callback_call(obj, SIG_CHANGED, NULL); + ecore_timer_del(sd->delay); + sd->delay = ecore_timer_add(SLIDER_DELAY_CHANGED_INTERVAL, _delay_change, obj); + } +} + +static void +_step_value_update(Evas_Object *obj, double step) +{ + double value, absolute_step; + + ELM_SLIDER_DATA_GET(obj, sd); + + if (efl_ui_mirrored_get(obj) ^ efl_ui_layout_orientation_is_inverted(sd->dir)) + step *= -1.0; + + absolute_step = step * (sd->val_max - sd->val_min); + value = CLAMP(sd->val + absolute_step, sd->val_min, sd->val_max); + _user_value_update(obj, value); +} + static void _val_fetch(Evas_Object *obj, Eina_Bool user_event) { @@ -489,6 +522,8 @@ _drag_up(void *data, ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); efl_ui_drag_step_move(efl_part(wd->resize_obj, "elm.dragable.slider"), step, step); + + _step_value_update(data, step); } static void @@ -507,6 +542,8 @@ _drag_down(void *data, ELM_WIDGET_DATA_GET_OR_RETURN(data, wd); efl_ui_drag_step_move(efl_part(wd->resize_obj, "elm.dragable.slider"), step, step); + + _step_value_update(data, step); } static Eina_Bool From 29892a26f8eb6b7620d78651a4aabc0dcea15f7e Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 19 Nov 2019 13:18:42 +0900 Subject: [PATCH 8/9] vector svg: apply fill-opacity to graidents fill objects. If node has a fill-opacity attirbute it must propagtes it to its fill objects. Previous our implementation missed this behavior. @fix --- src/static_libs/vg_common/vg_common_svg.c | 24 +++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/static_libs/vg_common/vg_common_svg.c b/src/static_libs/vg_common/vg_common_svg.c index 1d01f9f243..526787df0d 100644 --- a/src/static_libs/vg_common/vg_common_svg.c +++ b/src/static_libs/vg_common/vg_common_svg.c @@ -544,7 +544,7 @@ vg_common_svg_node_free(Svg_Node *node) } static Efl_VG * -_apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_data) +_apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_data, int fill_opacity) { Efl_VG *grad_obj = NULL; Efl_Gfx_Gradient_Stop *stops, *stop; @@ -678,23 +678,26 @@ _apply_gradient_property(Svg_Style_Gradient *g, Efl_VG *vg, Efl_VG *parent, Vg_F // not a known gradient return NULL; } + // apply common prperty efl_gfx_gradient_spread_set(grad_obj, g->spread); + // update the stops stop_count = eina_list_count(g->stops); if (stop_count) { double opacity; + double fopacity = ((double) fill_opacity) / 255; //fill opacity if any exists. stops = calloc(stop_count, sizeof(Efl_Gfx_Gradient_Stop)); i = 0; EINA_LIST_FOREACH(g->stops, l, stop) { // Use premultiplied color - opacity = (double)stop->a / 255; - stops[i].r = stop->r * opacity; - stops[i].g = stop->g * opacity; - stops[i].b = stop->b * opacity; - stops[i].a = stop->a; + opacity = ((double) stop->a / 255) * fopacity; + stops[i].r = (stop->r * opacity); + stops[i].g = (stop->g * opacity); + stops[i].b = (stop->b * opacity); + stops[i].a = (stop->a * fopacity); stops[i].offset = stop->offset; i++; } @@ -727,8 +730,8 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_ } else if (style->fill.paint.gradient) { - // if the fill has gradient then apply. - efl_canvas_vg_shape_fill_set(vg, _apply_gradient_property(style->fill.paint.gradient, vg, parent, vg_data)); + Efl_VG *gradient = _apply_gradient_property(style->fill.paint.gradient, vg, parent, vg_data, style->fill.opacity); + efl_canvas_vg_shape_fill_set(vg, gradient); } else if (style->fill.paint.cur_color) { @@ -758,11 +761,11 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_ // apply the fill style property efl_gfx_shape_fill_rule_set(vg, style->fill.fill_rule); - efl_gfx_shape_stroke_width_set(vg, style->stroke.width); efl_gfx_shape_stroke_cap_set(vg, style->stroke.cap); efl_gfx_shape_stroke_join_set(vg, style->stroke.join); efl_gfx_shape_stroke_scale_set(vg, style->stroke.scale); + // if stroke property is NULL then do nothing if (style->stroke.paint.none) { @@ -771,7 +774,8 @@ _apply_vg_property(Svg_Node *node, Efl_VG *vg, Efl_VG *parent, Vg_File_Data *vg_ else if (style->stroke.paint.gradient) { // if the fill has gradient then apply. - efl_canvas_vg_shape_stroke_fill_set(vg, _apply_gradient_property(style->stroke.paint.gradient, vg, parent, vg_data)); + Efl_VG *gradient = _apply_gradient_property(style->stroke.paint.gradient, vg, parent, vg_data, 255); + efl_canvas_vg_shape_stroke_fill_set(vg, gradient); } else if (style->stroke.paint.url) { From fd6e5081f9b0de50c30f80ec99c0d3c21ea29cae Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Tue, 19 Nov 2019 13:22:50 +0900 Subject: [PATCH 9/9] evas vector: removed useless calls. It turns out ector engine doesn't use any color mixing with gradients fill. Removed unnecessarities unless we can find a way to use them in the future. --- src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c | 4 +--- src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c index 2781ce9d11..fd681eda38 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c +++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_linear.c @@ -64,7 +64,7 @@ _efl_canvas_vg_gradient_linear_render_pre(Evas_Object_Protected_Data *vg_pd EINA void *context EINA_UNUSED, Ector_Surface *surface, Eina_Matrix3 *ptransform, - int p_opacity, + int p_opacity EINA_UNUSED, Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method, void *data) @@ -78,7 +78,6 @@ _efl_canvas_vg_gradient_linear_render_pre(Evas_Object_Protected_Data *vg_pd EINA gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS); EFL_CANVAS_VG_COMPUTE_MATRIX(ctransform, ptransform, nd); - EFL_CANVAS_VG_COMPUTE_ALPHA(c_r, c_g, c_b, c_a, p_opacity, nd); if (!nd->renderer) { @@ -89,7 +88,6 @@ _efl_canvas_vg_gradient_linear_render_pre(Evas_Object_Protected_Data *vg_pd EINA ector_renderer_transformation_set(nd->renderer, ctransform); ector_renderer_origin_set(nd->renderer, nd->x, nd->y); - ector_renderer_color_set(nd->renderer, c_r, c_g, c_b, c_a); ector_renderer_visibility_set(nd->renderer, nd->visibility); efl_gfx_gradient_stop_set(nd->renderer, gd->colors, gd->colors_count); efl_gfx_gradient_spread_set(nd->renderer, gd->spread); diff --git a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c index 7e09e138c2..8cbffa6e66 100644 --- a/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c +++ b/src/lib/evas/canvas/efl_canvas_vg_gradient_radial.c @@ -80,7 +80,7 @@ _efl_canvas_vg_gradient_radial_render_pre(Evas_Object_Protected_Data *vg_pd EINA void *context EINA_UNUSED, Ector_Surface *surface, Eina_Matrix3 *ptransform, - int p_opacity, + int p_opacity EINA_UNUSED, Ector_Buffer *comp, Efl_Gfx_Vg_Composite_Method comp_method, void *data) @@ -94,7 +94,6 @@ _efl_canvas_vg_gradient_radial_render_pre(Evas_Object_Protected_Data *vg_pd EINA gd = efl_data_scope_get(obj, EFL_CANVAS_VG_GRADIENT_CLASS); EFL_CANVAS_VG_COMPUTE_MATRIX(ctransform, ptransform, nd); - EFL_CANVAS_VG_COMPUTE_ALPHA(c_r, c_g, c_b, c_a, p_opacity, nd); if (!nd->renderer) { @@ -105,7 +104,6 @@ _efl_canvas_vg_gradient_radial_render_pre(Evas_Object_Protected_Data *vg_pd EINA ector_renderer_transformation_set(nd->renderer, ctransform); ector_renderer_origin_set(nd->renderer, nd->x, nd->y); - ector_renderer_color_set(nd->renderer, c_r, c_g, c_b, c_a); ector_renderer_visibility_set(nd->renderer, nd->visibility); efl_gfx_gradient_stop_set(nd->renderer, gd->colors, gd->colors_count); efl_gfx_gradient_spread_set(nd->renderer, gd->spread);