cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=0f5854708527365ab248990b385f65e2f7ab6160
commit 0f5854708527365ab248990b385f65e2f7ab6160 Author: Mike Blumenkrantz <zm...@samsung.com> Date: Mon May 13 12:14:00 2019 -0400 evas: add 'has_fixed_size' property for canvas objects this provides a hint for rendering that the object is not going to resize for as long as the flag is set and allows for some optimizations to be made during rendering based on this knowledge @feature Reviewed-by: Cedric BAIL <cedric.b...@free.fr> Differential Revision: https://phab.enlightenment.org/D8887 --- src/lib/evas/canvas/efl_canvas_object.eo | 17 +++++++++++++++++ src/lib/evas/canvas/evas_clip.c | 22 ++++++++++++++++++++++ src/lib/evas/canvas/evas_object_main.c | 12 ++++++++++++ src/lib/evas/include/evas_private.h | 1 + 4 files changed, 52 insertions(+) diff --git a/src/lib/evas/canvas/efl_canvas_object.eo b/src/lib/evas/canvas/efl_canvas_object.eo index 7660b732b7..60624588ce 100644 --- a/src/lib/evas/canvas/efl_canvas_object.eo +++ b/src/lib/evas/canvas/efl_canvas_object.eo @@ -138,6 +138,23 @@ abstract Efl.Canvas.Object extends Efl.Loop_Consumer implements Efl.Gfx.Entity, clipper: Efl.Canvas.Object; [[The object to clip $obj by.]] } } + @property has_fixed_size @beta { + [[A hint for an object that its size will not change. + + When this flag is set, various optimizations may be employed by the + renderer based on the fixed size of the object. + + It is a user error to change the size of an object while this flag + is set. + + @since 1.23 + ]] + set {} + get {} + values { + enable: bool; [[Whether the object size is known to be static.]] + } + } @property repeat_events { set { [[Set whether an Evas object is to repeat events. diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c index 04206e5d91..476183d55d 100644 --- a/src/lib/evas/canvas/evas_clip.c +++ b/src/lib/evas/canvas/evas_clip.c @@ -310,6 +310,28 @@ _efl_canvas_object_clipper_unset_common(Evas_Object_Protected_Data *obj, Eina_Bo EINA_COW_STATE_WRITE_END(obj, state_write, cur); } +EOLIAN void +_efl_canvas_object_has_fixed_size_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Eina_Bool enable) +{ + EVAS_OBJECT_DATA_ALIVE_CHECK(obj); + + enable = !!enable; + if (obj->cur->has_fixed_size == enable) return; + EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur) + state_write->has_fixed_size = enable; + EINA_COW_STATE_WRITE_END(obj, state_write, cur); + /* this will take effect next time the object is rendered, + * no need to force re-render now. + */ +} + +EOLIAN Eina_Bool +_efl_canvas_object_has_fixed_size_get(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj) +{ + EVAS_OBJECT_DATA_ALIVE_CHECK(obj, EINA_FALSE); + return obj->cur->has_fixed_size; +} + EOLIAN void _efl_canvas_object_clipper_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *eo_clip) { diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c index 1305ee3009..50234f9002 100644 --- a/src/lib/evas/canvas/evas_object_main.c +++ b/src/lib/evas/canvas/evas_object_main.c @@ -1301,6 +1301,18 @@ _efl_canvas_object_efl_gfx_entity_size_set(Eo *eo_obj, Evas_Object_Protected_Dat Eina_Bool source_invisible = EINA_FALSE; Eina_List *was = NULL; + if (obj->cur->have_clipees) + { + const Eina_List *l; + Evas_Object_Protected_Data *clipee; + + EINA_LIST_FOREACH(obj->clip.clipees, l, clipee) + { + if (clipee->cur->has_fixed_size) + ERR("resizing static clipper! this is a bug!!!!"); + } + } + if (sz.w < 0) sz.w = 0; if (sz.h < 0) sz.h = 0; diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h index 2c6dcdd990..4c22706c4a 100644 --- a/src/lib/evas/include/evas_private.h +++ b/src/lib/evas/include/evas_private.h @@ -1084,6 +1084,7 @@ struct _Evas_Object_Protected_State Eina_Bool anti_alias : 1; Eina_Bool valid_bounding_box : 1; Eina_Bool snapshot : 1; + Eina_Bool has_fixed_size : 1; }; struct _Evas_Object_Pointer_Data { --