summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-08-23 12:48:16 -0700
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-09-10 10:06:38 +0200
commit9bd0aa4f7f7bc99db04102c379b819c4c1ecdc00 (patch)
tree94386e7b67f5cee643e0b9a8030b2a8b44e0fc88
parent6e23dfba625cc126f10fa7b40a901dd99bf1b5b4 (diff)
elementary: leverage sizing information from model if available to avoid unecessary calc.
With the new Efl unified infrastructure, we do delay a lot of the computation to finalize, by filling the object information before finalize we reduce unecessary computation.
-rw-r--r--src/lib/elementary/efl_ui_widget_factory.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/elementary/efl_ui_widget_factory.c b/src/lib/elementary/efl_ui_widget_factory.c
index 0579dc4a51..a0e0a44c38 100644
--- a/src/lib/elementary/efl_ui_widget_factory.c
+++ b/src/lib/elementary/efl_ui_widget_factory.c
@@ -72,12 +72,29 @@ static void
72_efl_ui_widget_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, Efl_Gfx_Entity *ui_view) 72_efl_ui_widget_factory_efl_ui_factory_building(const Eo *obj EINA_UNUSED, Efl_Ui_Widget_Factory_Data *pd EINA_UNUSED, Efl_Gfx_Entity *ui_view)
73{ 73{
74 const Efl_Model *model; 74 const Efl_Model *model;
75 Eina_Value *property; 75 Eina_Value *property, *width, *height;
76 char *style; 76 char *style;
77 77
78 if (!pd->style) return ; 78 if (!pd->style) return ;
79 79
80 model = efl_ui_view_model_get(ui_view); 80 model = efl_ui_view_model_get(ui_view);
81
82 // Fetch min size from model if available to avoid recalculcating it
83 width = efl_model_property_get(model, "self.width");
84 height = efl_model_property_get(model, "self.height");
85 if (eina_value_type_get(width) != EINA_VALUE_TYPE_ERROR &&
86 eina_value_type_get(height) != EINA_VALUE_TYPE_ERROR)
87 {
88 Eina_Size2D s;
89
90 if (!eina_value_int_convert(width, &s.w)) s.w = 0;
91 if (!eina_value_int_convert(height, &s.h)) s.h = 0;
92
93 efl_gfx_hint_size_min_set(ui_view, s);
94 }
95 eina_value_free(width);
96 eina_value_free(height);
97
81 // As we have already waited for the property to be ready, we should get the right style now 98 // As we have already waited for the property to be ready, we should get the right style now
82 property = efl_model_property_get(model, pd->style); 99 property = efl_model_property_get(model, pd->style);
83 if (!property) return ; 100 if (!property) return ;