fix scaling on edje_scale - works with smnall sizes now too. problem is

really i was chasing a freeze/thaw problem. something is up.



SVN revision: 35922
This commit is contained in:
Carsten Haitzler 2008-09-10 06:39:57 +00:00
parent c1d838efa7
commit 673efdedd5
3 changed files with 102 additions and 17 deletions

View File

@ -138,9 +138,13 @@ _edje_recalc(Edje *ed)
{
int i;
if (!ed->dirty) return;
if (ed->freeze)
if (!ed->dirty)
{
return;
}
if ((ed->freeze > 0) || (_edje_freeze_val > 0))
{
_edje_freeze_calc_count++;
ed->recalc = 1;
if (!ed->calc_only) return;
}
@ -257,45 +261,79 @@ _edje_part_recalc_single(Edje *ed,
// if (flags & FLAG_X)
{
minw = desc->min.w;
if (ep->swallow_params.min.w > desc->min.w) minw = ep->swallow_params.min.w;
if (ep->part->scale) minw = (int)(((double)minw) * _edje_scale);
if (ep->swallow_params.min.w > desc->min.w)
minw = ep->swallow_params.min.w;
/* XXX TODO: remove need of EDJE_INF_MAX_W, see edje_util.c */
if ((ep->swallow_params.max.w <= 0) ||
(ep->swallow_params.max.w == EDJE_INF_MAX_W))
maxw = desc->max.w;
{
maxw = desc->max.w;
if (maxw > 0)
{
if (ep->part->scale) maxw = (int)(((double)maxw) * _edje_scale);
if (maxw < 1) maxw = 1;
}
}
else
{
if (desc->max.w <= 0)
maxw = ep->swallow_params.max.w;
else
maxw = MIN(ep->swallow_params.max.w, desc->max.w);
{
maxw = desc->max.w;
if (maxw > 0)
{
if (ep->part->scale) maxw = (int)(((double)maxw) * _edje_scale);
if (maxw < 1) maxw = 1;
}
if (ep->swallow_params.max.w < maxw)
maxw = ep->swallow_params.max.w;
}
}
if (ep->part->scale)
if (maxw >= 0)
{
minw *= _edje_scale;
maxw *= _edje_scale;
if (maxw < minw) maxw = minw;
}
}
// if (flags & FLAG_Y)
{
minh = desc->min.h;
if (ep->swallow_params.min.h > desc->min.h) minh = ep->swallow_params.min.h;
if (ep->part->scale) minh = (int)(((double)minh) * _edje_scale);
if (ep->swallow_params.min.h > desc->min.h)
minh = ep->swallow_params.min.h;
/* XXX TODO: remove need of EDJE_INF_MAX_H, see edje_util.c */
if ((ep->swallow_params.max.h <= 0) ||
(ep->swallow_params.max.h == EDJE_INF_MAX_H))
maxh = desc->max.h;
{
maxh = desc->max.h;
if (maxh > 0)
{
if (ep->part->scale) maxh = (int)(((double)maxh) * _edje_scale);
if (maxh < 1) maxh = 1;
}
}
else
{
if (desc->max.h <= 0)
maxh = ep->swallow_params.max.h;
else
maxh = MIN(ep->swallow_params.max.h, desc->max.h);
{
maxh = desc->max.h;
if (maxh > 0)
{
if (ep->part->scale) maxh = (int)(((double)maxh) * _edje_scale);
if (maxh < 1) maxh = 1;
}
if (ep->swallow_params.max.h < maxh)
maxh = ep->swallow_params.max.h;
}
}
if (ep->part->scale)
if (maxh >= 0)
{
minh *= _edje_scale;
maxh *= _edje_scale;
if (maxh < minh) maxh = minh;
}
}
/* relative coords of top left & bottom right */

View File

@ -1004,6 +1004,8 @@ extern Evas_List *_edje_edjes;
extern char *_edje_fontset_append;
extern double _edje_scale;
extern int _edje_freeze_val;
extern int _edje_freeze_calc_count;
void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, double pos);
Edje_Part_Description *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val);

View File

@ -12,6 +12,8 @@ static Evas_Hash *_edje_text_class_member_hash = NULL;
char *_edje_fontset_append = NULL;
double _edje_scale = 1.0;
int _edje_freeze_val = 0;
int _edje_freeze_calc_count = 0;
typedef struct _Edje_List_Foreach_Data Edje_List_Foreach_Data;
@ -29,6 +31,8 @@ Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje *ed, char **path);
/* FIXDOC: These all need to be looked over, Verified/Expanded upon. I just got lazy and stopped putting FIXDOC next to each function in this file. */
//#define FASTFREEZE 1
/** Freeze all Edje objects in the current process.
*
* See edje_object_freeze() for more.
@ -36,11 +40,17 @@ Edje_Real_Part *_edje_real_part_recursive_get_helper(Edje *ed, char **path);
EAPI void
edje_freeze(void)
{
#ifdef FASTFREEZE
_edje_freeze_val++;
printf("fr ++ ->%i\n", _edje_freeze_val);
#else
// FIXME: could just have a global freeze instead of per object
// above i tried.. but this broke some things. notable e17's menus. why?
Evas_List *l;
// FIXME: could just have a global freeze instead of per object
for (l = _edje_edjes; l; l = l->next)
edje_object_freeze((Evas_Object *)(l->data));
#endif
}
/** Thaw all Edje objects in the current process.
@ -50,11 +60,39 @@ edje_freeze(void)
EAPI void
edje_thaw(void)
{
#ifdef FASTFREEZE
_edje_freeze_val--;
printf("fr -- ->%i\n", _edje_freeze_val);
if ((_edje_freeze_val == 0) && (_edje_freeze_calc_count > 0))
{
Evas_List *l;
_edje_freeze_calc_count = 0;
for (l = _edje_edjes; l; l = l->next)
{
Edje *ed;
ed = _edje_fetch(l->data);
if (ed->recalc)
{
if (ed->freeze == 0)
{
printf(" CALC %p\n", l->data);
_edje_recalc(ed);
}
else
printf(" !CALC %p\n", l->data);
}
}
}
#else
// FIXME: could just have a global freeze instead of per object
// comment as above.. why?
Evas_List *l;
// FIXME: could just have a global freeze instead of per object
for (l = _edje_edjes; l; l = l->next)
edje_object_thaw((Evas_Object *)(l->data));
#endif
}
/* FIXDOC: Expand */
@ -1138,15 +1176,22 @@ EAPI void
edje_object_calc_force(Evas_Object *obj)
{
Edje *ed;
int pf;
int pf, pf2;
ed = _edje_fetch(obj);
if (!ed) return;
ed->dirty = 1;
pf2 = _edje_freeze_val;
pf = ed->freeze;
_edje_freeze_val = 0;
ed->freeze = 0;
_edje_recalc(ed);
ed->freeze = pf;
_edje_freeze_val = pf2;
}
/** Calculate minimum size