summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 17:19:03 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-09-18 17:26:53 +0900
commit641a58f735e93fb9e70dc85c006b3da09645bae7 (patch)
tree935188563b0caf378d42a1aa7e3e93169ecfc8ee /src/lib
parent942cbbed733f4d997e0a175b9e0e2e055a1f75d4 (diff)
edje: Use Eina.Size2D for min calc
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/edje/edje_legacy.c10
-rw-r--r--src/lib/edje/edje_util.c31
-rw-r--r--src/lib/edje/efl_canvas_layout_calc.eo17
-rw-r--r--src/lib/elementary/efl_ui_image.c8
4 files changed, 31 insertions, 35 deletions
diff --git a/src/lib/edje/edje_legacy.c b/src/lib/edje/edje_legacy.c
index 25f0a81..78fef00 100644
--- a/src/lib/edje/edje_legacy.c
+++ b/src/lib/edje/edje_legacy.c
@@ -1089,13 +1089,19 @@ edje_object_update_hints_get(const Edje_Object *obj)
1089EAPI void 1089EAPI void
1090edje_object_size_min_calc(Edje_Object *obj, int *minw, int *minh) 1090edje_object_size_min_calc(Edje_Object *obj, int *minw, int *minh)
1091{ 1091{
1092 efl_canvas_layout_calc_size_min(obj, minw, minh); 1092 Eina_Size2D sz;
1093 sz = efl_canvas_layout_calc_size_min(obj);
1094 if (minw) *minw = sz.w;
1095 if (minh) *minh = sz.h;
1093} 1096}
1094 1097
1095EAPI void 1098EAPI void
1096edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int restrictedw, int restrictedh) 1099edje_object_size_min_restricted_calc(Edje_Object *obj, int *minw, int *minh, int restrictedw, int restrictedh)
1097{ 1100{
1098 efl_canvas_layout_calc_size_min_restricted(obj, minw, minh, restrictedw, restrictedh); 1101 Eina_Size2D sz;
1102 sz = efl_canvas_layout_calc_size_min_restricted(obj, EINA_SIZE2D(restrictedw, restrictedh));
1103 if (minw) *minw = sz.w;
1104 if (minh) *minh = sz.h;
1099} 1105}
1100 1106
1101EAPI Eina_Bool 1107EAPI Eina_Bool
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index 701e595..d931f7b 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -3147,10 +3147,10 @@ _edje_object_efl_canvas_layout_calc_calc_force(Eo *obj EINA_UNUSED, Edje *ed)
3147 _edje_util_freeze_val = pf2; 3147 _edje_util_freeze_val = pf2;
3148} 3148}
3149 3149
3150EOLIAN void 3150EOLIAN Eina_Size2D
3151_edje_object_efl_canvas_layout_calc_calc_size_min(Eo *obj, Edje *_pd EINA_UNUSED, Evas_Coord *minw, Evas_Coord *minh) 3151_edje_object_efl_canvas_layout_calc_calc_size_min(Eo *obj, Edje *_pd EINA_UNUSED)
3152{ 3152{
3153 edje_object_size_min_restricted_calc(obj, minw, minh, 0, 0); 3153 return efl_canvas_layout_calc_size_min_restricted(obj, EINA_SIZE2D(0, 0));
3154} 3154}
3155 3155
3156EOLIAN Eina_Rectangle 3156EOLIAN Eina_Rectangle
@@ -3190,8 +3190,8 @@ _edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje
3190 return (Eina_Rectangle) { xx1, yy1, xx2 - xx1, yy2 - yy1 }; 3190 return (Eina_Rectangle) { xx1, yy1, xx2 - xx1, yy2 - yy1 };
3191} 3191}
3192 3192
3193EOLIAN void 3193EOLIAN Eina_Size2D
3194_edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh) 3194_edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED, Edje *ed, Eina_Size2D restricted)
3195{ 3195{
3196 const int CALC_COUNT_LIMIT = 255; 3196 const int CALC_COUNT_LIMIT = 255;
3197 3197
@@ -3205,13 +3205,10 @@ _edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED
3205 Evas_Coord ins_l, ins_r; 3205 Evas_Coord ins_l, ins_r;
3206 Eina_Bool has_fixed_tb; 3206 Eina_Bool has_fixed_tb;
3207 Eina_Bool legacy_calc; 3207 Eina_Bool legacy_calc;
3208 Eina_Size2D ret;
3208 3209
3209 if ((!ed) || (!ed->collection)) 3210 if ((!ed) || (!ed->collection))
3210 { 3211 return restricted;
3211 if (minw) *minw = restrictedw;
3212 if (minh) *minh = restrictedh;
3213 return;
3214 }
3215 3212
3216 /* 3213 /*
3217 * It decides a calculation logic according to efl_version of Edje file. 3214 * It decides a calculation logic according to efl_version of Edje file.
@@ -3235,8 +3232,8 @@ _edje_object_efl_canvas_layout_calc_calc_size_min_restricted(Eo *obj EINA_UNUSED
3235 3232
3236again: 3233again:
3237 //restrict minimum size to 3234 //restrict minimum size to
3238 ed->w = restrictedw; 3235 ed->w = restricted.w;
3239 ed->h = restrictedh; 3236 ed->h = restricted.h;
3240 3237
3241 max_over_w = 0; 3238 max_over_w = 0;
3242 max_over_h = 0; 3239 max_over_h = 0;
@@ -3338,14 +3335,14 @@ again:
3338 ed->w += max_over_w; 3335 ed->w += max_over_w;
3339 3336
3340 //exceptional handling. 3337 //exceptional handling.
3341 if (ed->w < restrictedw) ed->w = restrictedw; 3338 if (ed->w < restricted.w) ed->w = restricted.w;
3342 } 3339 }
3343 if (repeat_h) 3340 if (repeat_h)
3344 { 3341 {
3345 ed->h += max_over_h; 3342 ed->h += max_over_h;
3346 3343
3347 //exceptional handling. 3344 //exceptional handling.
3348 if (ed->h < restrictedh) ed->h = restrictedh; 3345 if (ed->h < restricted.h) ed->h = restricted.h;
3349 } 3346 }
3350 3347
3351 if (reset_max && (calc_count > CALC_COUNT_LIMIT)) 3348 if (reset_max && (calc_count > CALC_COUNT_LIMIT))
@@ -3385,9 +3382,7 @@ again:
3385 3382
3386 ed->min.w = ed->w; 3383 ed->min.w = ed->w;
3387 ed->min.h = ed->h; 3384 ed->min.h = ed->h;
3388 3385 ret = EINA_SIZE2D(ed->min.w, ed->min.h);
3389 if (minw) *minw = ed->min.w;
3390 if (minh) *minh = ed->min.h;
3391 3386
3392 ed->w = orig_w; 3387 ed->w = orig_w;
3393 ed->h = orig_h; 3388 ed->h = orig_h;
@@ -3398,6 +3393,8 @@ again:
3398#endif 3393#endif
3399 _edje_recalc(ed); 3394 _edje_recalc(ed);
3400 ed->calc_only = EINA_FALSE; 3395 ed->calc_only = EINA_FALSE;
3396
3397 return ret;
3401} 3398}
3402 3399
3403/* FIXME: Correctly return other states */ 3400/* FIXME: Correctly return other states */
diff --git a/src/lib/edje/efl_canvas_layout_calc.eo b/src/lib/edje/efl_canvas_layout_calc.eo
index 0874056..017c5f6 100644
--- a/src/lib/edje/efl_canvas_layout_calc.eo
+++ b/src/lib/edje/efl_canvas_layout_calc.eo
@@ -41,11 +41,7 @@ interface Efl.Canvas.Layout_Calc
41 with the last two arguments set to 0. Please refer to its 41 with the last two arguments set to 0. Please refer to its
42 documentation, then. 42 documentation, then.
43 ]] 43 ]]
44 // FIXME: Return a 2D size type (no @out values) 44 return: Eina.Size2D; [[The minimum required size.]]
45 params {
46 @out minw: int; [[The minimum required width (return value)]]
47 @out minh: int; [[The minimum required height (return value)]]
48 }
49 } 45 }
50 calc_size_min_restricted { 46 calc_size_min_restricted {
51 [[Calculates the minimum required size for a given layout object. 47 [[Calculates the minimum required size for a given layout object.
@@ -64,14 +60,11 @@ interface Efl.Canvas.Layout_Calc
64 Warning: Be advised that invisible parts in the object will be taken 60 Warning: Be advised that invisible parts in the object will be taken
65 into account in this calculation. 61 into account in this calculation.
66 ]] 62 ]]
67 // FIXME: Return a 2D size type (no @out values) 63 return: Eina.Size2D; [[The minimum required size.]]
68 params { 64 params {
69 @out minw: int; [[The minimum required width (return value)]] 65 @in restricted: Eina.Size2D @optional;
70 @out minh: int; [[The minimum required height (return value)]] 66 [[The minimum size constraint as input, the returned size
71 @in restrictedw: int @optional; [[The minimum width constraint as 67 can not be lower than this (in both directions).]]
72 input, $minw can not be lower than this]]
73 @in restrictedh: int @optional; [[The minimum height constraint as
74 input, $minh can not be lower than this]]
75 } 68 }
76 } 69 }
77 calc_parts_extends { 70 calc_parts_extends {
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 5c91b25..db7298f 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -1190,13 +1190,13 @@ _efl_ui_image_efl_canvas_layout_calc_calc_force(Eo *obj EINA_UNUSED, Efl_Ui_Imag
1190 edje_object_calc_force(sd->img); 1190 edje_object_calc_force(sd->img);
1191} 1191}
1192 1192
1193EOLIAN static void 1193EOLIAN static Eina_Size2D
1194_efl_ui_image_efl_canvas_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, int *w, int *h) 1194_efl_ui_image_efl_canvas_layout_calc_calc_size_min(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
1195{ 1195{
1196 if (sd->edje) 1196 if (sd->edje)
1197 edje_object_size_min_calc(sd->img, w, h); 1197 return efl_gfx_size_hint_min_get(sd->img);
1198 else 1198 else
1199 evas_object_size_hint_combined_min_get(sd->img, w, h); 1199 return efl_gfx_size_hint_combined_min_get(sd->img);
1200} 1200}
1201 1201
1202EOLIAN static void 1202EOLIAN static void