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.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D8887
This commit is contained in:
Mike Blumenkrantz 2019-05-13 12:14:00 -04:00 committed by Cedric BAIL
parent 9149767184
commit 0f58547085
4 changed files with 52 additions and 0 deletions

View File

@ -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.

View File

@ -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)
{

View File

@ -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;

View File

@ -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 {