summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChunEon Park <chuneon.park@samsung.com>2015-03-03 22:36:26 +0900
committerChunEon Park <chuneon.park@samsung.com>2015-03-03 22:37:28 +0900
commit32f3f858d6511935099922bb7f17a2b6534ff537 (patch)
tree29ca2df1a4cb74d6797aa5e3cf2e36eefbd869c1
parentbe3b01182225d838371c3dd04f68638b18f48d42 (diff)
edje/edje_util: code refactoring.
change internal variables to more descriptive ones. no logic change.
-rw-r--r--src/lib/edje/edje_util.c146
1 files changed, 79 insertions, 67 deletions
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c
index e27f93bafa..c1ae49c86f 100644
--- a/src/lib/edje/edje_util.c
+++ b/src/lib/edje/edje_util.c
@@ -2986,10 +2986,10 @@ _edje_object_parts_extends_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *x, Ev
2986EOLIAN void 2986EOLIAN void
2987_edje_object_size_min_restricted_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh) 2987_edje_object_size_min_restricted_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh, Evas_Coord restrictedw, Evas_Coord restrictedh)
2988{ 2988{
2989 Evas_Coord pw, ph; 2989 Evas_Coord orig_w, orig_h; //original edje size
2990 int maxw, maxh; 2990 int max_over_w, max_over_h; //maximum over-calculated size.
2991 int okw, okh; 2991 Eina_Bool repeat_w, repeat_h;
2992 int reset_maxwh; 2992 Eina_Bool reset_max = EINA_TRUE;
2993 Edje_Real_Part *pep = NULL; 2993 Edje_Real_Part *pep = NULL;
2994 Eina_Bool has_non_fixed_tb = EINA_FALSE; 2994 Eina_Bool has_non_fixed_tb = EINA_FALSE;
2995 2995
@@ -2999,100 +2999,111 @@ _edje_object_size_min_restricted_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord
2999 if (minh) *minh = restrictedh; 2999 if (minh) *minh = restrictedh;
3000 return; 3000 return;
3001 } 3001 }
3002 reset_maxwh = 1; 3002
3003 //Simulate object minimum size.
3003 ed->calc_only = EINA_TRUE; 3004 ed->calc_only = EINA_TRUE;
3004 pw = ed->w;
3005 ph = ed->h;
3006 3005
3007 again: 3006 orig_w = ed->w;
3007 orig_h = ed->h;
3008
3009again:
3010 //restrict minimum size to
3008 ed->w = restrictedw; 3011 ed->w = restrictedw;
3009 ed->h = restrictedh; 3012 ed->h = restrictedh;
3010 3013
3011 maxw = 0; 3014 max_over_w = 0;
3012 maxh = 0; 3015 max_over_h = 0;
3013 3016
3014 do 3017 do
3015 { 3018 {
3016 unsigned int i; 3019 unsigned int i;
3017 3020
3018 okw = okh = 0; 3021 repeat_w = EINA_FALSE;
3022 repeat_h = EINA_FALSE;
3019 ed->dirty = EINA_TRUE; 3023 ed->dirty = EINA_TRUE;
3020#ifdef EDJE_CALC_CACHE 3024#ifdef EDJE_CALC_CACHE
3021 ed->all_part_change = EINA_TRUE; 3025 ed->all_part_change = EINA_TRUE;
3022#endif 3026#endif
3023 _edje_recalc_do(ed); 3027 _edje_recalc_do(ed);
3024 if (reset_maxwh) 3028
3029 if (reset_max)
3025 { 3030 {
3026 maxw = 0; 3031 max_over_w = 0;
3027 maxh = 0; 3032 max_over_h = 0;
3028 } 3033 }
3034
3029 pep = NULL; 3035 pep = NULL;
3030 has_non_fixed_tb = EINA_FALSE; 3036 has_non_fixed_tb = EINA_FALSE;
3037
3038 //for parts
3031 for (i = 0; i < ed->table_parts_size; i++) 3039 for (i = 0; i < ed->table_parts_size; i++)
3032 { 3040 {
3033 Edje_Real_Part *ep; 3041 Edje_Real_Part *ep = ed->table_parts[i];
3034 int w, h; 3042
3035 int didw; 3043 if (!ep->chosen_description) continue;
3036 3044
3037 ep = ed->table_parts[i]; 3045 //diff, how much it's over-sized.
3038 w = ep->w - ep->req.w; 3046 int over_w = (ep->w - ep->req.w);
3039 h = ep->h - ep->req.h; 3047 int over_h = (ep->h - ep->req.h);
3040 didw = 0; 3048
3041 if (ep->chosen_description) 3049 Eina_Bool skip_h = EINA_FALSE;
3050
3051 //width
3052 if (!ep->chosen_description->fixed.w)
3042 { 3053 {
3043 if (!ep->chosen_description->fixed.w) 3054 //We care textblock width size specially.
3055 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
3044 { 3056 {
3045 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) 3057 Evas_Coord tb_mw;
3046 { 3058 evas_object_textblock_size_formatted_get(ep->object,
3047 Evas_Coord tb_mw; 3059 &tb_mw, NULL);
3048 evas_object_textblock_size_formatted_get(ep->object, 3060 tb_mw -= ep->req.w;
3049 &tb_mw, NULL); 3061 if (tb_mw > over_w) over_w = tb_mw;
3050 tb_mw -= ep->req.w; 3062 has_non_fixed_tb = EINA_TRUE;
3051 if (tb_mw > w)
3052 {
3053 w = tb_mw;
3054 }
3055 has_non_fixed_tb = EINA_TRUE;
3056 }
3057 if (w > maxw)
3058 {
3059 maxw = w;
3060 okw = 1;
3061 pep = ep;
3062 didw = 1;
3063 }
3064 } 3063 }
3065 if (!ep->chosen_description->fixed.h)
3066 {
3067 if (!((ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) &&
3068 (!((Edje_Part_Description_Text *)ep->chosen_description)->text.min_x) &&
3069 (didw)))
3070 {
3071 if (h > maxh)
3072 {
3073 maxh = h;
3074 okh = 1;
3075 pep = ep;
3076 }
3077 }
3078 3064
3079 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK) 3065 if (over_w > max_over_w)
3066 {
3067 max_over_w = over_w;
3068 repeat_w = EINA_TRUE;
3069 pep = ep;
3070 skip_h = EINA_TRUE;
3071 }
3072 }
3073 //height
3074 if (!ep->chosen_description->fixed.h)
3075 {
3076 if ((ep->part->type != EDJE_PART_TYPE_TEXTBLOCK) ||
3077 ((Edje_Part_Description_Text *)ep->chosen_description)->text.min_x ||
3078 !skip_h)
3079 {
3080 if (over_h > max_over_h)
3080 { 3081 {
3081 has_non_fixed_tb = EINA_TRUE; 3082 max_over_h = over_h;
3083 repeat_h = EINA_TRUE;
3084 pep = ep;
3082 } 3085 }
3083 } 3086 }
3087
3088 if (ep->part->type == EDJE_PART_TYPE_TEXTBLOCK)
3089 has_non_fixed_tb = EINA_TRUE;
3084 } 3090 }
3085 } 3091 }
3086 if (okw) 3092 if (repeat_w)
3087 { 3093 {
3088 ed->w += maxw; 3094 ed->w += max_over_w;
3095
3096 //exceptional handling.
3089 if (ed->w < restrictedw) ed->w = restrictedw; 3097 if (ed->w < restrictedw) ed->w = restrictedw;
3090 } 3098 }
3091 if (okh) 3099 if (repeat_h)
3092 { 3100 {
3093 ed->h += maxh; 3101 ed->h += max_over_h;
3102
3103 //exceptional handling.
3094 if (ed->h < restrictedh) ed->h = restrictedh; 3104 if (ed->h < restrictedh) ed->h = restrictedh;
3095 } 3105 }
3106
3096 if ((ed->w > 4000) || (ed->h > 4000)) 3107 if ((ed->w > 4000) || (ed->h > 4000))
3097 { 3108 {
3098 /* Only print it if we have a non-fixed textblock. 3109 /* Only print it if we have a non-fixed textblock.
@@ -3108,22 +3119,23 @@ _edje_object_size_min_restricted_calc(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord
3108 ed->path, ed->group, ed->w, ed->h); 3119 ed->path, ed->group, ed->w, ed->h);
3109 } 3120 }
3110 3121
3111 if (reset_maxwh) 3122 if (reset_max)
3112 { 3123 {
3113 reset_maxwh = 0; 3124 reset_max = EINA_FALSE;
3114 goto again; 3125 goto again;
3115 } 3126 }
3116 } 3127 }
3117 } 3128 }
3118 while (okw || okh); 3129 while (repeat_w || repeat_h);
3130
3119 ed->min.w = ed->w; 3131 ed->min.w = ed->w;
3120 ed->min.h = ed->h; 3132 ed->min.h = ed->h;
3121 3133
3122 if (minw) *minw = ed->min.w; 3134 if (minw) *minw = ed->min.w;
3123 if (minh) *minh = ed->min.h; 3135 if (minh) *minh = ed->min.h;
3124 3136
3125 ed->w = pw; 3137 ed->w = orig_w;
3126 ed->h = ph; 3138 ed->h = orig_h;
3127 ed->dirty = EINA_TRUE; 3139 ed->dirty = EINA_TRUE;
3128#ifdef EDJE_CALC_CACHE 3140#ifdef EDJE_CALC_CACHE
3129 ed->all_part_change = EINA_TRUE; 3141 ed->all_part_change = EINA_TRUE;