[PATCH] ivi-shell: clean-up transition animation code.
Nobuhiko Tanibata
NOBUHIKO_TANIBATA at xddp.denso.co.jp
Sun Dec 14 20:18:46 PST 2014
ivi_layout_transition_layer_render_order is not necesary called. Remove
the method and methods called by it.
Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA at xddp.denso.co.jp>
---
ivi-shell/hmi-controller.c | 5 -
ivi-shell/ivi-layout-transition.c | 194 --------------------------------------
2 files changed, 199 deletions(-)
diff --git a/ivi-shell/hmi-controller.c b/ivi-shell/hmi-controller.c
index 3a07a70..1ad63a2 100644
--- a/ivi-shell/hmi-controller.c
+++ b/ivi-shell/hmi-controller.c
@@ -254,11 +254,6 @@ mode_divided_into_tiling(struct hmi_controller *hmi_ctrl,
ivi_layout_layer_set_transition(layer->ivilayer,
IVI_LAYOUT_TRANSITION_LAYER_VIEW_ORDER,
duration);
- //TODO: implement IVI_LAYOUT_TRANSITION_LAYER_VIEW_ORDER later.
- ivi_layout_transition_layer_render_order(layer->ivilayer,
- new_order,
- surf_num,
- duration);
}
free(surfaces);
diff --git a/ivi-shell/ivi-layout-transition.c b/ivi-shell/ivi-layout-transition.c
index e4ab5bb..6d4a655 100644
--- a/ivi-shell/ivi-layout-transition.c
+++ b/ivi-shell/ivi-layout-transition.c
@@ -849,200 +849,6 @@ ivi_layout_transition_fade_layer(
return;
}
-/* render order transition */
-struct surface_reorder {
- uint32_t id_surface;
- uint32_t new_index;
-};
-
-struct change_order_data {
- struct ivi_layout_layer *layer;
- uint32_t surface_num;
- struct surface_reorder *reorder;
-};
-
-struct surf_with_index {
- uint32_t id_surface;
- float surface_index;
-};
-
-static int
-cmp_order_asc(const void *lhs, const void *rhs)
-{
- const struct surf_with_index *l = lhs;
- const struct surf_with_index *r = rhs;
-
- return l->surface_index > r->surface_index;
-}
-
-/*
-render oerder transition
-
-index 0 1 2
-old surfA, surfB, surfC
-new surfB, surfC, surfA
- (-1) (-1) (+2)
-
-after 10% of time elapsed
- 0.2 0.9 1.9
- surfA, surfB, surfC
-
-after 50% of time elapsed
- 0.5 1.0 1.5
- surfB, surfA, surfC
-*/
-
-static void
-transition_change_order_user_frame(struct ivi_layout_transition *transition)
-{
- uint32_t i, old_index;
- double current = time_to_nowpos(transition);
- struct change_order_data *data = transition->private_data;
-
- struct surf_with_index *swi = malloc(sizeof(*swi) * data->surface_num);
- struct ivi_layout_surface **new_surface_order = NULL;
- uint32_t surface_num = 0;
-
- if (swi == NULL) {
- weston_log("%s: memory allocation fails\n", __func__);
- return;
- }
-
- for (old_index = 0; old_index < data->surface_num; old_index++) {
- swi[old_index].id_surface = data->reorder[old_index].id_surface;
- swi[old_index].surface_index = (float)old_index +
- ((float)data->reorder[old_index].new_index - (float)old_index) * current;
- }
-
- qsort(swi, data->surface_num, sizeof(*swi), cmp_order_asc);
-
- new_surface_order =
- malloc(sizeof(*new_surface_order) * data->surface_num);
-
- if (new_surface_order == NULL) {
- weston_log("%s: memory allocation fails\n", __func__);
- return;
- }
-
- for (i = 0; i < data->surface_num; i++) {
- struct ivi_layout_surface *surf =
- ivi_layout_get_surface_from_id(swi[i].id_surface);
- if(surf)
- new_surface_order[surface_num++] = surf;
- }
-
- ivi_layout_layer_set_render_order(data->layer, new_surface_order,
- surface_num);
-
- free(new_surface_order);
- free(swi);
-}
-
-static void
-transition_change_order_destroy(struct ivi_layout_transition *transition)
-{
- struct change_order_data *data = transition->private_data;
-
- free(data->reorder);
- free(data);
-}
-
-static int32_t find_surface(struct ivi_layout_surface **surfaces,
- uint32_t surface_num,
- struct ivi_layout_surface *target)
-{
- uint32_t i = 0;
-
- for(i = 0; i < surface_num; i++) {
- if (surfaces[i] == target)
- return i;
- }
-
- return -1;
-}
-
-static int32_t
-is_transition_change_order_func(struct change_order_data *data,
- struct ivi_layout_layer *layer)
-{
- return data->layer == layer;
-}
-
-WL_EXPORT void
-ivi_layout_transition_layer_render_order(struct ivi_layout_layer *layer,
- struct ivi_layout_surface **new_order,
- uint32_t surface_num,
- uint32_t duration)
-{
- struct surface_reorder *reorder;
- struct ivi_layout_surface *surf;
- uint32_t old_index = 0;
- struct ivi_layout_transition *transition;
- struct change_order_data *data = NULL;
- int32_t new_index = 0;
- uint32_t id = 0;
-
- reorder = malloc(sizeof(*reorder) * surface_num);
- if (reorder == NULL) {
- weston_log("%s: memory allocation fails\n", __func__);
- return;
- }
-
- wl_list_for_each(surf, &layer->order.surface_list, order.link) {
- new_index = find_surface(new_order, surface_num, surf);
- id = ivi_layout_get_id_of_surface(surf);
- if(new_index < 0){
- fprintf(stderr, "invalid render order!!!\n");
- return;
- }
-
- reorder[old_index].id_surface = id;
- reorder[old_index].new_index = new_index;
- old_index++;
- }
-
- transition = get_transition_from_type_and_id(
- IVI_LAYOUT_TRANSITION_LAYER_VIEW_ORDER,
- layer);
- if (transition) {
- /* update transition */
- struct change_order_data *data = transition->private_data;
- transition->time_start = 0; /* timer reset */
-
- if (duration != 0) {
- transition->time_duration = duration;
- }
-
- free(data->reorder);
- data->reorder = reorder;
- return;
- }
-
- transition = create_layout_transition();
- data = malloc(sizeof(*data));
-
- if (data == NULL) {
- weston_log("%s: memory allocation fails\n", __func__);
- return;
- }
-
- transition->type = IVI_LAYOUT_TRANSITION_LAYER_VIEW_ORDER;
- transition->is_transition_func = (ivi_layout_is_transition_func)is_transition_change_order_func;
-
- transition->private_data = data;
- transition->frame_func = transition_change_order_user_frame;
- transition->destroy_func = transition_change_order_destroy;
-
- if (duration != 0)
- transition->time_duration = duration;
-
- data->layer = layer;
- data->reorder = reorder;
- data->surface_num = old_index;
-
- layout_transition_register(transition);
-}
-
WL_EXPORT int32_t
ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
enum ivi_layout_transition_type type,
--
1.8.3.1
More information about the wayland-devel
mailing list