forked from enlightenment/efl
1. cedrics patches for speedups. they breka nothing.
2. fix mouse in/out and other event flags stuff again. SVN revision: 34174
This commit is contained in:
parent
2e568d779f
commit
48deca9592
|
@ -1114,6 +1114,61 @@ _edje_gradient_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_edje_nitoa_rec(char *string, int len, unsigned int value)
|
||||||
|
{
|
||||||
|
const char *array = "0123456789";
|
||||||
|
int length;
|
||||||
|
int quotient;
|
||||||
|
int modulo;
|
||||||
|
|
||||||
|
if (len <= 0) return 0;
|
||||||
|
if (value == 0) return 0;
|
||||||
|
|
||||||
|
quotient = value / 10;
|
||||||
|
modulo = value % 10;
|
||||||
|
|
||||||
|
length = _edje_nitoa_rec(string, len - 1, quotient);
|
||||||
|
|
||||||
|
if (length + 1 > len) return length;
|
||||||
|
|
||||||
|
string[length] = array[modulo];
|
||||||
|
|
||||||
|
return length + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_edje_nitoa(char *string, int len, int value)
|
||||||
|
{
|
||||||
|
int length;
|
||||||
|
|
||||||
|
if (len <= 0) return 0;
|
||||||
|
if (len == 1)
|
||||||
|
{
|
||||||
|
*string = '\0';
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value < 0)
|
||||||
|
{
|
||||||
|
*string = '-';
|
||||||
|
|
||||||
|
++string;
|
||||||
|
--len;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (value == 0)
|
||||||
|
{
|
||||||
|
strncpy(string, "0", len);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = _edje_nitoa_rec(string, len, value);
|
||||||
|
string[length] = '\0';
|
||||||
|
|
||||||
|
return length;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc, double pos)
|
_edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edje_Part_Description *chosen_desc, double pos)
|
||||||
{
|
{
|
||||||
|
@ -1173,7 +1228,11 @@ _edje_image_recalc_apply(Edje *ed, Edje_Real_Part *ep, Edje_Calc_Params *p3, Edj
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "images/%i", image_id);
|
/* Replace snprint("images/%i") == memcpy + itoa */
|
||||||
|
#define IMAGES "images/"
|
||||||
|
memcpy(buf, IMAGES, strlen(IMAGES));
|
||||||
|
_edje_nitoa(buf + strlen(IMAGES), sizeof(buf) - strlen(IMAGES), image_id);
|
||||||
|
|
||||||
evas_object_image_file_set(ep->object, ed->file->path, buf);
|
evas_object_image_file_set(ep->object, ed->file->path, buf);
|
||||||
if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)
|
if (evas_object_image_load_error_get(ep->object) != EVAS_LOAD_ERROR_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1391,8 +1450,12 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
|
||||||
(pf->color.g * pf->color.a) / 255,
|
(pf->color.g * pf->color.a) / 255,
|
||||||
(pf->color.b * pf->color.a) / 255,
|
(pf->color.b * pf->color.a) / 255,
|
||||||
pf->color.a);
|
pf->color.a);
|
||||||
if (pf->visible) evas_object_show(ep->object);
|
if (!pf->visible)
|
||||||
else evas_object_hide(ep->object);
|
{
|
||||||
|
evas_object_hide(ep->object);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
evas_object_show(ep->object);
|
||||||
/* move and resize are needed for all previous object => no break here. */
|
/* move and resize are needed for all previous object => no break here. */
|
||||||
case EDJE_PART_TYPE_SWALLOW:
|
case EDJE_PART_TYPE_SWALLOW:
|
||||||
case EDJE_PART_TYPE_GROUP:
|
case EDJE_PART_TYPE_GROUP:
|
||||||
|
@ -1436,10 +1499,14 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags)
|
||||||
// (pf->color.g * pf->color.a) / 255,
|
// (pf->color.g * pf->color.a) / 255,
|
||||||
// (pf->color.b * pf->color.a) / 255,
|
// (pf->color.b * pf->color.a) / 255,
|
||||||
// pf->color.a);
|
// pf->color.a);
|
||||||
evas_object_move(ep->swallowed_object, ed->x + pf->x, ed->y + pf->y);
|
if (pf->visible)
|
||||||
evas_object_resize(ep->swallowed_object, pf->w, pf->h);
|
{
|
||||||
if (pf->visible) evas_object_show(ep->swallowed_object);
|
evas_object_show(ep->swallowed_object);
|
||||||
else evas_object_hide(ep->swallowed_object);
|
evas_object_move(ep->swallowed_object, ed->x + pf->x, ed->y + pf->y);
|
||||||
|
evas_object_resize(ep->swallowed_object, pf->w, pf->h);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
evas_object_hide(ep->swallowed_object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ _edje_mouse_in_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
ed = data;
|
ed = data;
|
||||||
rp = evas_object_data_get(obj, "real_part");
|
rp = evas_object_data_get(obj, "real_part");
|
||||||
if (!rp || !(rp->part->ignore_flags & ev->event_flags)) return;
|
if ((!rp) ||
|
||||||
|
((ev->event_flags) &&
|
||||||
|
(!(rp->part->ignore_flags & ev->event_flags)))) return;
|
||||||
_edje_emit(ed, "mouse,in", rp->part->name);
|
_edje_emit(ed, "mouse,in", rp->part->name);
|
||||||
return;
|
return;
|
||||||
e = NULL;
|
e = NULL;
|
||||||
|
@ -50,7 +52,9 @@ _edje_mouse_out_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
ed = data;
|
ed = data;
|
||||||
rp = evas_object_data_get(obj, "real_part");
|
rp = evas_object_data_get(obj, "real_part");
|
||||||
if (!rp || !(rp->part->ignore_flags & ev->event_flags)) return;
|
if ((!rp) ||
|
||||||
|
((ev->event_flags) &&
|
||||||
|
(!(rp->part->ignore_flags & ev->event_flags)))) return;
|
||||||
_edje_emit(ed, "mouse,out", rp->part->name);
|
_edje_emit(ed, "mouse,out", rp->part->name);
|
||||||
return;
|
return;
|
||||||
e = NULL;
|
e = NULL;
|
||||||
|
@ -75,7 +79,7 @@ _edje_mouse_down_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
_edje_ref(ed);
|
_edje_ref(ed);
|
||||||
_edje_freeze(ed);
|
_edje_freeze(ed);
|
||||||
|
|
||||||
if (!ignored)
|
if ((ev->event_flags) && (!ignored))
|
||||||
{
|
{
|
||||||
if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
|
if (ev->flags & EVAS_BUTTON_TRIPLE_CLICK)
|
||||||
snprintf(buf, sizeof(buf), "mouse,down,%i,triple", ev->button);
|
snprintf(buf, sizeof(buf), "mouse,down,%i,triple", ev->button);
|
||||||
|
@ -187,7 +191,7 @@ _edje_mouse_up_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
_edje_ref(ed);
|
_edje_ref(ed);
|
||||||
_edje_freeze(ed);
|
_edje_freeze(ed);
|
||||||
|
|
||||||
if (!ignored)
|
if ((ev->event_flags) && (!ignored))
|
||||||
{
|
{
|
||||||
snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
|
snprintf(buf, sizeof(buf), "mouse,up,%i", ev->button);
|
||||||
_edje_emit(ed, buf, rp->part->name);
|
_edje_emit(ed, buf, rp->part->name);
|
||||||
|
@ -249,7 +253,7 @@ _edje_mouse_move_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
ignored = rp->part->ignore_flags & ev->event_flags;
|
ignored = rp->part->ignore_flags & ev->event_flags;
|
||||||
|
|
||||||
_edje_ref(ed);
|
_edje_ref(ed);
|
||||||
if (!ignored)
|
if ((ev->event_flags) && (!ignored))
|
||||||
_edje_emit(ed, "mouse,move", rp->part->name);
|
_edje_emit(ed, "mouse,move", rp->part->name);
|
||||||
|
|
||||||
if (rp->still_in)
|
if (rp->still_in)
|
||||||
|
@ -319,7 +323,9 @@ _edje_mouse_wheel_cb(void *data, Evas * e, Evas_Object * obj, void *event_info)
|
||||||
ev = event_info;
|
ev = event_info;
|
||||||
ed = data;
|
ed = data;
|
||||||
rp = evas_object_data_get(obj, "real_part");
|
rp = evas_object_data_get(obj, "real_part");
|
||||||
if (!rp || !(rp->part->ignore_flags & ev->event_flags)) return;
|
if ((!rp) ||
|
||||||
|
((ev->event_flags) &&
|
||||||
|
(!(rp->part->ignore_flags & ev->event_flags)))) return;
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "mouse,wheel,%i,%i", ev->direction, (ev->z < 0) ? (-1) : (1));
|
snprintf(buf, sizeof(buf), "mouse,wheel,%i,%i", ev->direction, (ev->z < 0) ? (-1) : (1));
|
||||||
_edje_emit(ed, buf, rp->part->name);
|
_edje_emit(ed, buf, rp->part->name);
|
||||||
|
|
|
@ -1002,14 +1002,24 @@ _edje_collection_free_prog_cache_matches_free_cb(const Evas_Hash *hash, const ch
|
||||||
static void
|
static void
|
||||||
_cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source)
|
_cb_signal_repeat(void *data, Evas_Object *obj, const char *signal, const char *source)
|
||||||
{
|
{
|
||||||
Evas_Object *parent;
|
Evas_Object *parent;
|
||||||
Edje *ed;
|
Edje *ed;
|
||||||
char new_src[4096]; /* XXX is this max reasonable? */
|
char new_src[4096]; /* XXX is this max reasonable? */
|
||||||
|
int length_parent;
|
||||||
|
int length_source;
|
||||||
|
|
||||||
parent = data;
|
parent = data;
|
||||||
ed = _edje_fetch(obj);
|
ed = _edje_fetch(obj);
|
||||||
if (!ed) return;
|
if (!ed) return;
|
||||||
snprintf(new_src, sizeof(new_src), "%s%c%s", ed->parent,
|
/* Replace snprint("%s%c%s") == memcpy + *new_src + memcat */
|
||||||
EDJE_PART_PATH_SEPARATOR, source);
|
length_parent = strlen(ed->parent);
|
||||||
|
length_source = strlen(source);
|
||||||
|
if (length_source + length_parent + 2 > sizeof(new_src))
|
||||||
|
return ;
|
||||||
|
|
||||||
|
memcpy(new_src, ed->parent, length_parent);
|
||||||
|
new_src[length_parent] = EDJE_PART_PATH_SEPARATOR;
|
||||||
|
memcpy(new_src + length_parent + 1, source, length_source + 1);
|
||||||
|
|
||||||
edje_object_signal_emit(parent, signal, new_src);
|
edje_object_signal_emit(parent, signal, new_src);
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ _edje_match_states_insert(Edje_States *list,
|
||||||
{
|
{
|
||||||
const size_t i = idx * (patterns_max_length + 1) + pos;
|
const size_t i = idx * (patterns_max_length + 1) + pos;
|
||||||
|
|
||||||
if (list->has[i]) return;
|
if (list->size > i && list->has[i]) return;
|
||||||
list->has[i] = 1;
|
list->has[i] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ _edje_match_states_insert(Edje_States *list,
|
||||||
|
|
||||||
list->states[i].idx = idx;
|
list->states[i].idx = idx;
|
||||||
list->states[i].pos = pos;
|
list->states[i].pos = pos;
|
||||||
|
list->has[i] = 0;
|
||||||
++list->size;
|
++list->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +113,6 @@ _edje_match_states_clear(Edje_States *list,
|
||||||
size_t patterns_max_length)
|
size_t patterns_max_length)
|
||||||
{
|
{
|
||||||
list->size = 0;
|
list->size = 0;
|
||||||
memset(list->has, 0, patterns_size * (patterns_max_length + 1) * sizeof (*list->has));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Token manipulation. */
|
/* Token manipulation. */
|
||||||
|
@ -232,9 +232,6 @@ _edje_match_patterns_exec_init_states(Edje_States *states,
|
||||||
|
|
||||||
states->size = patterns_size;
|
states->size = patterns_size;
|
||||||
|
|
||||||
memset(states->has,
|
|
||||||
0,
|
|
||||||
patterns_size * (patterns_max_length + 1) * sizeof (*states->has));
|
|
||||||
for (i = 0; i < patterns_size; ++i)
|
for (i = 0; i < patterns_size; ++i)
|
||||||
{
|
{
|
||||||
states->states[i].idx = i;
|
states->states[i].idx = i;
|
||||||
|
|
Loading…
Reference in New Issue