Elm_Transit *prev_chain_transit;
Eina_List *next_chain_transits;
Elm_Transit_Tween_Mode tween_mode;
- struct {
- Elm_Transit_Del_Cb func;
- void *arg;
- } del_data;
- struct {
- double delayed;
- double paused;
- double duration;
- double begin;
- double current;
- } time;
- struct {
- int count;
- int current;
- Eina_Bool reverse;
- } repeat;
+ struct
+ {
+ Elm_Transit_Del_Cb func;
+ void *arg;
+ } del_data;
+ struct
+ {
+ double delayed;
+ double paused;
+ double duration;
+ double begin;
+ double current;
+ } time;
+ struct
+ {
+ int count;
+ int current;
+ Eina_Bool reverse;
+ } repeat;
double progress;
unsigned int effects_pending_del;
int walking;
struct _Elm_Transit_Obj_Data
{
struct _Elm_Transit_Obj_State *state;
- Eina_Bool pass_events : 1;
+ Eina_Bool freeze_events : 1;
};
typedef struct _Elm_Transit_Effect_Module Elm_Transit_Effect_Module;
static void _transit_obj_remove(Elm_Transit *transit, Evas_Object *obj);
static void _transit_effect_del(Elm_Transit *transit, Elm_Transit_Effect_Module *effect_module);
static void _transit_remove_dead_effects(Elm_Transit *transit);
+static void _transit_chain_go(Elm_Transit *transit);
static void _transit_del(Elm_Transit *transit);
-static void _transit_animate_op(Elm_Transit *transit, double progress);
+static Eina_Bool _transit_animate_op(Elm_Transit *transit, double progress);
static Eina_Bool _transit_animate_cb(void *data);
static char *_transit_key= "_elm_transit_key";
if (!obj_data)
obj_data = ELM_NEW(Elm_Transit_Obj_Data);
- obj_data->pass_events = evas_object_pass_events_get(obj);
+ obj_data->freeze_events = evas_object_freeze_events_get(obj);
if ((!transit->state_keep) && (obj_data->state))
{
{
//Remove duplicated objects
//TODO: Need to consider about optimizing here
- while(1)
+ while (1)
{
if (!eina_list_data_find_list(transit->objs, obj))
break;
obj_data = evas_object_data_get(obj, _transit_key);
if (!obj_data) return;
evas_object_data_del(obj, _transit_key);
- evas_object_pass_events_set(obj, obj_data->pass_events);
+ evas_object_freeze_events_set(obj, obj_data->freeze_events);
state = obj_data->state;
if (state)
{
evas_object_color_set(obj, state->r, state->g, state->b, state->a);
if (state->visible) evas_object_show(obj);
else evas_object_hide(obj);
- if (state->map_enabled)
- evas_object_map_enable_set(obj, EINA_TRUE);
- else
- evas_object_map_enable_set(obj, EINA_FALSE);
- if (state->map)
- evas_object_map_set(obj, state->map);
+ evas_object_map_enable_set(obj, state->map_enabled);
+ evas_object_map_set(obj, state->map);
}
free(state);
}
}
static void
+_transit_chain_go(Elm_Transit *transit)
+{
+ ELM_TRANSIT_CHECK_OR_RETURN(transit);
+ elm_transit_go(transit);
+ _transit_animate_cb(transit);
+}
+
+static void
_transit_del(Elm_Transit *transit)
{
Elm_Transit_Effect_Module *effect_module;
if (transit->finished && transit->next_chain_transits)
{
EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next, chain_transit)
- elm_transit_go(chain_transit);
+ _transit_chain_go(chain_transit);
+
}
eina_list_free(transit->next_chain_transits);
free(transit);
}
-static void
+//If the transit is deleted then EINA_FALSE is retruned.
+static Eina_Bool
_transit_animate_op(Elm_Transit *transit, double progress)
{
Elm_Transit_Effect_Module *effect_module;
}
transit->walking--;
- if (transit->walking) return;
+ if (transit->walking) return EINA_TRUE;
+
+ if (transit->deleted)
+ {
+ _transit_del(transit);
+ return EINA_FALSE;
+ }
- if (transit->deleted) _transit_del(transit);
else if (transit->effects_pending_del) _transit_remove_dead_effects(transit);
+
+ return EINA_TRUE;
}
static Eina_Bool
transit->progress = elapsed_time / duration;
switch (transit->tween_mode)
{
+ case ELM_TRANSIT_TWEEN_MODE_LINEAR:
+ transit->progress = ecore_animator_pos_map(transit->progress,
+ ECORE_POS_MAP_LINEAR,
+ 0, 0);
case ELM_TRANSIT_TWEEN_MODE_ACCELERATE:
- transit->progress = 1.0 - sin((ELM_PI / 2.0) + (transit->progress * ELM_PI / 2.0));
- break;
+ transit->progress = ecore_animator_pos_map(transit->progress,
+ ECORE_POS_MAP_ACCELERATE,
+ 0, 0);
+ break;
case ELM_TRANSIT_TWEEN_MODE_DECELERATE:
- transit->progress = sin(transit->progress * ELM_PI / 2.0);
- break;
+ transit->progress = ecore_animator_pos_map(transit->progress,
+ ECORE_POS_MAP_DECELERATE,
+ 0, 0);
+ break;
case ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL:
- transit->progress = (1.0 - cos(transit->progress * ELM_PI)) / 2.0;
- break;
+ transit->progress = ecore_animator_pos_map(transit->progress,
+ ECORE_POS_MAP_SINUSOIDAL,
+ 0, 0);
+ break;
default:
- break;
+ break;
}
/* Reverse? */
if (transit->repeat.reverse) transit->progress = 1 - transit->progress;
- if (transit->time.duration > 0) _transit_animate_op(transit, transit->progress);
+ if (transit->time.duration > 0)
+ {
+ if (!_transit_animate_op(transit, transit->progress))
+ return ECORE_CALLBACK_CANCEL;
+ }
/* Not end. Keep going. */
if (elapsed_time < duration) return ECORE_CALLBACK_RENEW;
return ECORE_CALLBACK_RENEW;
}
+static void
+_recover_image_uv_by_y(Evas_Map *map, int iw, int ih)
+{
+ evas_map_point_image_uv_set(map, 0, iw, 0);
+ evas_map_point_image_uv_set(map, 1, 0, 0);
+ evas_map_point_image_uv_set(map, 2, 0, ih);
+ evas_map_point_image_uv_set(map, 3, iw, ih);
+}
+
+static void
+_recover_image_uv_by_x(Evas_Map *map, int iw, int ih)
+{
+ evas_map_point_image_uv_set(map, 0, 0, ih);
+ evas_map_point_image_uv_set(map, 1, iw, ih);
+ evas_map_point_image_uv_set(map, 2, iw, 0);
+ evas_map_point_image_uv_set(map, 3, 0, 0);
+}
+
+static Eina_Bool
+_recover_image_uv(Evas_Object *obj, Evas_Map *map, Eina_Bool revert, Eina_Bool by_x)
+{
+ //Since the map is not proper for all types of objects,
+ //Need to handle uvs only for image objects
+ int iw, ih;
+ const char *type = evas_object_type_get(obj);
+ if ((!type) || (strcmp(type, "image"))) return EINA_FALSE;
+
+ evas_object_image_size_get(obj, &iw, &ih);
+
+ if (revert)
+ {
+ if (by_x)
+ _recover_image_uv_by_x(map, iw, ih);
+ else
+ _recover_image_uv_by_y(map, iw, ih);
+ }
+ else
+ {
+ evas_map_point_image_uv_set(map, 0, 0, 0);
+ evas_map_point_image_uv_set(map, 1, iw, 0);
+ evas_map_point_image_uv_set(map, 2, iw, ih);
+ evas_map_point_image_uv_set(map, 3, 0, ih);
+ }
+ return EINA_TRUE;
+}
+
EAPI Elm_Transit *
elm_transit_add(void)
{
if (!evas_object_data_get(obj, _transit_key))
{
_transit_obj_data_update(transit, obj);
- evas_object_pass_events_set(obj, EINA_TRUE);
+ evas_object_freeze_events_set(obj, EINA_TRUE);
}
}
if (!transit->animator) return;
EINA_LIST_FOREACH(transit->objs, list, obj)
- evas_object_pass_events_set(obj, enabled);
+ evas_object_freeze_events_set(obj, enabled);
}
EAPI Eina_Bool
if (!transit->event_enabled)
{
EINA_LIST_FOREACH(transit->objs, elist, obj)
- evas_object_pass_events_set(obj, EINA_TRUE);
+ evas_object_freeze_events_set(obj, EINA_TRUE);
}
transit->time.paused = 0;
if (chain_transit->prev_chain_transit != transit)
{
- WRN("These two transit does not have the chain relationship! : transit=%p, chain_transit=%p", transit, chain_transit);
+ WRN("A pair of transits does not have the chain relationship! : transit=%p, chain_transit=%p", transit, chain_transit);
return;
}
transit->next_chain_transits = eina_list_remove(transit->next_chain_transits, chain_transit);
}
-/**
- * Get the current chain transit list.
- *
- * @note @p transit can not be NULL.
- *
- * @param transit The transit object.
- * @return chain transit list.
- *
- * @ingroup Transit
- */
EAPI Eina_List *
elm_transit_chain_transits_get(const Elm_Transit * transit)
{
evas_object_geometry_get(obj, &x, &y, &w, &h);
evas_map_util_points_populate_from_object_full(map, obj, zoom->from +
(progress * zoom->to));
- evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0, _TRANSIT_FOCAL);
+ _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE);
+ evas_map_util_3d_perspective(map, x + (w / 2), y + (h / 2), 0,
+ _TRANSIT_FOCAL);
evas_object_map_set(obj, map);
evas_object_map_enable_set(obj, EINA_TRUE);
}
{
if ((degree >= 90) || (degree <= -90))
{
- evas_map_point_image_uv_set(map, 0, w, 0);
- evas_map_point_image_uv_set(map, 1, 0, 0);
- evas_map_point_image_uv_set(map, 2, 0, h);
- evas_map_point_image_uv_set(map, 3, w, h);
+ if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_FALSE))
+ {
+ evas_map_point_image_uv_set(map, 0, w, 0);
+ evas_map_point_image_uv_set(map, 1, 0, 0);
+ evas_map_point_image_uv_set(map, 2, 0, h);
+ evas_map_point_image_uv_set(map, 3, w, h);
+ }
}
+ else
+ _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE);
evas_map_util_3d_rotate(map, 0, degree,
0, x + half_w, y + half_h, 0);
}
{
if ((degree >= 90) || (degree <= -90))
{
- evas_map_point_image_uv_set(map, 0, 0, h);
- evas_map_point_image_uv_set(map, 1, w, h);
- evas_map_point_image_uv_set(map, 2, w, 0);
- evas_map_point_image_uv_set(map, 3, 0, 0);
+ if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_TRUE))
+ {
+ evas_map_point_image_uv_set(map, 0, 0, h);
+ evas_map_point_image_uv_set(map, 1, w, h);
+ evas_map_point_image_uv_set(map, 2, w, 0);
+ evas_map_point_image_uv_set(map, 3, 0, 0);
+ }
}
+ else
+ _recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE);
evas_map_util_3d_rotate(map, degree,
0, 0, x + half_w, y + half_h, 0);
}
}
static void
-_set_image_uv_by_axis_y(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, float degree)
+_set_image_uv_by_axis_y(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, Eina_Bool revert)
{
- if ((degree >= 90) || (degree <= -90))
+ if (revert)
{
evas_map_point_image_uv_set(map, 0,
(flip->from_size.x * 2) + flip->to_size.x,
}
static void
-_set_image_uv_by_axis_x(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, float degree)
+_set_image_uv_by_axis_x(Evas_Map *map, Elm_Transit_Effect_ResizableFlip_Node *flip, Eina_Bool revert)
{
- if ((degree >= 90) || (degree <= -90))
+ if (revert)
{
evas_map_point_image_uv_set(map, 0, 0,
(flip->from_size.y * 2) + flip->to_size.y);
if (resizable_flip->axis == ELM_TRANSIT_EFFECT_FLIP_AXIS_Y)
{
- _set_image_uv_by_axis_y(map, resizable_flip_node, degree);
+ if ((degree >= 90) || (degree <= -90))
+ {
+ if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_FALSE))
+ _set_image_uv_by_axis_y(map, resizable_flip_node,
+ EINA_TRUE);
+ }
+ else
+ {
+ if (!_recover_image_uv(obj, map, EINA_FALSE, EINA_FALSE))
+ _set_image_uv_by_axis_y(map, resizable_flip_node,
+ EINA_FALSE);
+ }
evas_map_util_3d_rotate(map, 0, degree,
0, x + half_w, y + half_h, 0);
}
else
{
- _set_image_uv_by_axis_x(map, resizable_flip_node, degree);
+ if ((degree >= 90) || (degree <= -90))
+ {
+ if (!_recover_image_uv(obj, map, EINA_TRUE, EINA_TRUE))
+ _set_image_uv_by_axis_x(map, resizable_flip_node,
+ EINA_TRUE);
+ }
+ else
+ {
+ if (!_recover_image_uv(obj, map, EINA_FALSE, EINA_TRUE))
+ _set_image_uv_by_axis_x(map, resizable_flip_node,
+ EINA_FALSE);
+ }
evas_map_util_3d_rotate(map, degree, 0,
0, x + half_w, y + half_h, 0);
}
- evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0, _TRANSIT_FOCAL);
+ evas_map_util_3d_perspective(map, x + half_w, y + half_h, 0,
+ _TRANSIT_FOCAL);
evas_object_map_enable_set(resizable_flip_node->front, EINA_TRUE);
evas_object_map_enable_set(resizable_flip_node->back, EINA_TRUE);
evas_object_map_set(obj, map);
Evas_Coord _x, _y, _w, _h;
Eina_List *elist;
Evas_Object *obj;
+ const char *type;
map = evas_map_new(4);
if (!map) return;
EINA_LIST_FOREACH(transit->objs, elist, obj)
{
- evas_object_geometry_get(obj, &_x, &_y, &_w, &_h);
-
+ type = evas_object_type_get(obj);
+ if ((!type) || (strcmp(type, "image")))
+ evas_object_geometry_get(obj, &_x, &_y, &_w, &_h);
+ else
+ {
+ evas_object_image_size_get(obj, &_w, &_h);
+ _x = 0;
+ _y = 0;
+ }
if (wipe->type == ELM_TRANSIT_EFFECT_WIPE_TYPE_SHOW)
_elm_fx_wipe_show(map, wipe->dir, _x, _y, _w, _h, (float)progress);
else
EINA_LIST_FOREACH(transit->objs, elist, obj)
{
- if (elm_widget_type_check(obj, type))
+ if (elm_widget_type_check(obj, type, __func__))
elm_icon_file_set(obj,
eina_list_nth(image_animation->images, count), NULL);
}