diff options
author | Cedric BAIL <cedric@osg.samsung.com> | 2017-06-05 11:58:40 -0700 |
---|---|---|
committer | Cedric BAIL <cedric@osg.samsung.com> | 2017-06-05 12:07:57 -0700 |
commit | 7caa81ed9d0eff5289936a51a825af3d1e2e86a5 (patch) | |
tree | 0994d4e22687387904f14cfd3f4320b3cb294e02 /src/lib/edje/edje_calc.c | |
parent | 13482ef965ab207a90907ff11166313f7f420e21 (diff) |
edje: object have small difference and we use switch case fallthrough to reuse code.
Diffstat (limited to '')
-rw-r--r-- | src/lib/edje/edje_calc.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/lib/edje/edje_calc.c b/src/lib/edje/edje_calc.c index e53378bacc..47e918cdcc 100644 --- a/src/lib/edje/edje_calc.c +++ b/src/lib/edje/edje_calc.c | |||
@@ -2219,6 +2219,7 @@ _edje_part_recalc_single_min(Edje_Part_Description_Common *desc, | |||
2219 | minw = TO_INT(tmp); | 2219 | minw = TO_INT(tmp); |
2220 | break; | 2220 | break; |
2221 | } | 2221 | } |
2222 | EINA_FALLTHROUGH; | ||
2222 | 2223 | ||
2223 | case EDJE_ASPECT_PREFER_HORIZONTAL: | 2224 | case EDJE_ASPECT_PREFER_HORIZONTAL: |
2224 | tmp = DIV(SCALE(params->eval.h, minw), w); | 2225 | tmp = DIV(SCALE(params->eval.h, minw), w); |
@@ -2227,8 +2228,10 @@ _edje_part_recalc_single_min(Edje_Part_Description_Common *desc, | |||
2227 | minh = TO_INT(tmp); | 2228 | minh = TO_INT(tmp); |
2228 | break; | 2229 | break; |
2229 | } | 2230 | } |
2231 | EINA_FALLTHROUGH; | ||
2230 | 2232 | ||
2231 | case EDJE_ASPECT_PREFER_SOURCE: | 2233 | case EDJE_ASPECT_PREFER_SOURCE: |
2234 | EINA_FALLTHROUGH; | ||
2232 | case EDJE_ASPECT_PREFER_BOTH: | 2235 | case EDJE_ASPECT_PREFER_BOTH: |
2233 | tmp = DIV(SCALE(params->eval.w, minh), h); | 2236 | tmp = DIV(SCALE(params->eval.w, minh), h); |
2234 | if (tmp >= FROM_INT(minw)) | 2237 | if (tmp >= FROM_INT(minw)) |
@@ -2289,6 +2292,7 @@ _edje_part_recalc_single_max(Edje_Part_Description_Common *desc, | |||
2289 | maxw = TO_INT(tmp); | 2292 | maxw = TO_INT(tmp); |
2290 | break; | 2293 | break; |
2291 | } | 2294 | } |
2295 | EINA_FALLTHROUGH; | ||
2292 | 2296 | ||
2293 | case EDJE_ASPECT_PREFER_HORIZONTAL: | 2297 | case EDJE_ASPECT_PREFER_HORIZONTAL: |
2294 | tmp = DIV(SCALE(params->eval.h, maxw), w); | 2298 | tmp = DIV(SCALE(params->eval.h, maxw), w); |
@@ -2297,8 +2301,10 @@ _edje_part_recalc_single_max(Edje_Part_Description_Common *desc, | |||
2297 | maxh = TO_INT(tmp); | 2301 | maxh = TO_INT(tmp); |
2298 | break; | 2302 | break; |
2299 | } | 2303 | } |
2304 | EINA_FALLTHROUGH; | ||
2300 | 2305 | ||
2301 | case EDJE_ASPECT_PREFER_SOURCE: | 2306 | case EDJE_ASPECT_PREFER_SOURCE: |
2307 | EINA_FALLTHROUGH; | ||
2302 | case EDJE_ASPECT_PREFER_BOTH: | 2308 | case EDJE_ASPECT_PREFER_BOTH: |
2303 | tmp = DIV(SCALE(params->eval.w, maxh), h); | 2309 | tmp = DIV(SCALE(params->eval.w, maxh), h); |
2304 | if (tmp <= FROM_INT(maxw)) | 2310 | if (tmp <= FROM_INT(maxw)) |
@@ -4852,7 +4858,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
4852 | p3->type.common->spec.image.t = INTP(p1->type.common->spec.image.t, p2->type.common->spec.image.t, pos); | 4858 | p3->type.common->spec.image.t = INTP(p1->type.common->spec.image.t, p2->type.common->spec.image.t, pos); |
4853 | p3->type.common->spec.image.b = INTP(p1->type.common->spec.image.b, p2->type.common->spec.image.b, pos); | 4859 | p3->type.common->spec.image.b = INTP(p1->type.common->spec.image.b, p2->type.common->spec.image.b, pos); |
4854 | p3->type.common->spec.image.border_scale_by = FFP(p1->type.common->spec.image.border_scale_by, p2->type.common->spec.image.border_scale_by, pos); | 4860 | p3->type.common->spec.image.border_scale_by = FFP(p1->type.common->spec.image.border_scale_by, p2->type.common->spec.image.border_scale_by, pos); |
4861 | EINA_FALLTHROUGH; | ||
4855 | 4862 | ||
4863 | /* No break as proxy and image share code and object. */ | ||
4856 | case EDJE_PART_TYPE_PROXY: | 4864 | case EDJE_PART_TYPE_PROXY: |
4857 | _edje_calc_params_need_type_common(p3); | 4865 | _edje_calc_params_need_type_common(p3); |
4858 | p3->type.common->fill.x = INTP(p1->type.common->fill.x, p2->type.common->fill.x, pos); | 4866 | p3->type.common->fill.x = INTP(p1->type.common->fill.x, p2->type.common->fill.x, pos); |
@@ -4864,8 +4872,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
4864 | case EDJE_PART_TYPE_TEXT: | 4872 | case EDJE_PART_TYPE_TEXT: |
4865 | _edje_calc_params_need_type_text(p3); | 4873 | _edje_calc_params_need_type_text(p3); |
4866 | p3->type.text->size = INTP(p1->type.text->size, p2->type.text->size, pos); | 4874 | p3->type.text->size = INTP(p1->type.text->size, p2->type.text->size, pos); |
4875 | EINA_FALLTHROUGH; | ||
4867 | 4876 | ||
4868 | /* no break as we share code with the TEXTBLOCK type here. Intended fall-through */ | 4877 | /* no break as we share code with the TEXTBLOCK type here. */ |
4869 | case EDJE_PART_TYPE_TEXTBLOCK: | 4878 | case EDJE_PART_TYPE_TEXTBLOCK: |
4870 | _edje_calc_params_need_type_text(p3); | 4879 | _edje_calc_params_need_type_text(p3); |
4871 | p3->type.text->color2.r = INTP(p1->type.text->color2.r, p2->type.text->color2.r, pos2); | 4880 | p3->type.text->color2.r = INTP(p1->type.text->color2.r, p2->type.text->color2.r, pos2); |
@@ -5067,15 +5076,22 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
5067 | 5076 | ||
5068 | evas_object_image_scale_hint_set(ep->object, | 5077 | evas_object_image_scale_hint_set(ep->object, |
5069 | img_desc->image.scale_hint); | 5078 | img_desc->image.scale_hint); |
5079 | EINA_FALLTHROUGH; | ||
5070 | /* No break here as we share the rest of the code for all types. Intended fall-through*/ | 5080 | /* No break here as we share the rest of the code for all types. Intended fall-through*/ |
5071 | } | 5081 | } |
5072 | 5082 | ||
5073 | case EDJE_PART_TYPE_PROXY: | 5083 | case EDJE_PART_TYPE_PROXY: |
5084 | EINA_FALLTHROUGH; | ||
5074 | case EDJE_PART_TYPE_RECTANGLE: | 5085 | case EDJE_PART_TYPE_RECTANGLE: |
5086 | EINA_FALLTHROUGH; | ||
5075 | case EDJE_PART_TYPE_TEXTBLOCK: | 5087 | case EDJE_PART_TYPE_TEXTBLOCK: |
5088 | EINA_FALLTHROUGH; | ||
5076 | case EDJE_PART_TYPE_BOX: | 5089 | case EDJE_PART_TYPE_BOX: |
5090 | EINA_FALLTHROUGH; | ||
5077 | case EDJE_PART_TYPE_TABLE: | 5091 | case EDJE_PART_TYPE_TABLE: |
5092 | EINA_FALLTHROUGH; | ||
5078 | case EDJE_PART_TYPE_SNAPSHOT: | 5093 | case EDJE_PART_TYPE_SNAPSHOT: |
5094 | EINA_FALLTHROUGH; | ||
5079 | case EDJE_PART_TYPE_VECTOR: | 5095 | case EDJE_PART_TYPE_VECTOR: |
5080 | evas_object_color_set(ep->object, | 5096 | evas_object_color_set(ep->object, |
5081 | (pf->color.r * pf->color.a) / 255, | 5097 | (pf->color.r * pf->color.a) / 255, |
@@ -5115,6 +5131,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags, Edje_Calc_Params *sta | |||
5115 | if (pf->no_render_apply) | 5131 | if (pf->no_render_apply) |
5116 | efl_canvas_object_no_render_set(ep->object, pf->no_render); | 5132 | efl_canvas_object_no_render_set(ep->object, pf->no_render); |
5117 | #endif | 5133 | #endif |
5134 | EINA_FALLTHROUGH; | ||
5118 | 5135 | ||
5119 | /* move and resize are needed for all previous object => no break here. */ | 5136 | /* move and resize are needed for all previous object => no break here. */ |
5120 | case EDJE_PART_TYPE_SWALLOW: | 5137 | case EDJE_PART_TYPE_SWALLOW: |