summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-05-13 12:14:00 -0400
committerCedric BAIL <cedric.bail@free.fr>2019-08-08 18:32:23 -0700
commit0f5854708527365ab248990b385f65e2f7ab6160 (patch)
tree501f19decd973d609353c7ddca63090d15975c9d /src/lib
parent9149767184bfa9b64102eaea89f6733351de71e9 (diff)
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
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/evas/canvas/efl_canvas_object.eo17
-rw-r--r--src/lib/evas/canvas/evas_clip.c22
-rw-r--r--src/lib/evas/canvas/evas_object_main.c12
-rw-r--r--src/lib/evas/include/evas_private.h1
4 files changed, 52 insertions, 0 deletions
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,
138 clipper: Efl.Canvas.Object; [[The object to clip $obj by.]] 138 clipper: Efl.Canvas.Object; [[The object to clip $obj by.]]
139 } 139 }
140 } 140 }
141 @property has_fixed_size @beta {
142 [[A hint for an object that its size will not change.
143
144 When this flag is set, various optimizations may be employed by the
145 renderer based on the fixed size of the object.
146
147 It is a user error to change the size of an object while this flag
148 is set.
149
150 @since 1.23
151 ]]
152 set {}
153 get {}
154 values {
155 enable: bool; [[Whether the object size is known to be static.]]
156 }
157 }
141 @property repeat_events { 158 @property repeat_events {
142 set { 159 set {
143 [[Set whether an Evas object is to repeat events. 160 [[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
@@ -311,6 +311,28 @@ _efl_canvas_object_clipper_unset_common(Evas_Object_Protected_Data *obj, Eina_Bo
311} 311}
312 312
313EOLIAN void 313EOLIAN void
314_efl_canvas_object_has_fixed_size_set(Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj, Eina_Bool enable)
315{
316 EVAS_OBJECT_DATA_ALIVE_CHECK(obj);
317
318 enable = !!enable;
319 if (obj->cur->has_fixed_size == enable) return;
320 EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
321 state_write->has_fixed_size = enable;
322 EINA_COW_STATE_WRITE_END(obj, state_write, cur);
323 /* this will take effect next time the object is rendered,
324 * no need to force re-render now.
325 */
326}
327
328EOLIAN Eina_Bool
329_efl_canvas_object_has_fixed_size_get(const Eo *eo_obj EINA_UNUSED, Evas_Object_Protected_Data *obj)
330{
331 EVAS_OBJECT_DATA_ALIVE_CHECK(obj, EINA_FALSE);
332 return obj->cur->has_fixed_size;
333}
334
335EOLIAN void
314_efl_canvas_object_clipper_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *eo_clip) 336_efl_canvas_object_clipper_set(Eo *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *eo_clip)
315{ 337{
316 Evas_Object_Protected_Data *clip; 338 Evas_Object_Protected_Data *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
1301 Eina_Bool source_invisible = EINA_FALSE; 1301 Eina_Bool source_invisible = EINA_FALSE;
1302 Eina_List *was = NULL; 1302 Eina_List *was = NULL;
1303 1303
1304 if (obj->cur->have_clipees)
1305 {
1306 const Eina_List *l;
1307 Evas_Object_Protected_Data *clipee;
1308
1309 EINA_LIST_FOREACH(obj->clip.clipees, l, clipee)
1310 {
1311 if (clipee->cur->has_fixed_size)
1312 ERR("resizing static clipper! this is a bug!!!!");
1313 }
1314 }
1315
1304 if (sz.w < 0) sz.w = 0; 1316 if (sz.w < 0) sz.w = 0;
1305 if (sz.h < 0) sz.h = 0; 1317 if (sz.h < 0) sz.h = 0;
1306 1318
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
1084 Eina_Bool anti_alias : 1; 1084 Eina_Bool anti_alias : 1;
1085 Eina_Bool valid_bounding_box : 1; 1085 Eina_Bool valid_bounding_box : 1;
1086 Eina_Bool snapshot : 1; 1086 Eina_Bool snapshot : 1;
1087 Eina_Bool has_fixed_size : 1;
1087}; 1088};
1088 1089
1089struct _Evas_Object_Pointer_Data { 1090struct _Evas_Object_Pointer_Data {