ivi-shell: simplify commit_changes function

It is a better idea to use one for loop instead
of using three nested for loops.

We do not need to update the transformation of
views according to the scenegraph. The important
thing is that every visible view is updated before
commit_changes function returns.

The first if statement checks, if the view is on
the currently rendered scenegraph. The second if
statement checks, if the view's layer or surface
is visible. These checks ensure that we do not
update the transformation matrix of a view, which
is not visible on the screen.

Signed-off-by: Emre Ucan <eucan@de.adit-jv.com>
[Pekka: minor whitespace fix]
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
dev
Ucan, Emre (ADITG/SW1) 8 years ago committed by Pekka Paalanen
parent 1b92ba20ac
commit 27799355a9
  1. 41
      ivi-shell/ivi-layout.c

@ -660,30 +660,31 @@ update_prop(struct ivi_layout_view *ivi_view)
static void
commit_changes(struct ivi_layout *layout)
{
struct ivi_layout_screen *iviscrn = NULL;
struct ivi_layout_layer *ivilayer = NULL;
struct ivi_layout_screen *iviscrn = NULL;
struct ivi_layout_layer *ivilayer = NULL;
struct ivi_layout_surface *ivisurf = NULL;
struct ivi_layout_view *ivi_view = NULL;
wl_list_for_each(iviscrn, &layout->screen_list, link) {
wl_list_for_each(ivilayer, &iviscrn->order.layer_list, order.link) {
/*
* If ivilayer is invisible, weston_view of ivisurf doesn't
* need to be modified.
*/
if (ivilayer->prop.visibility == false)
continue;
wl_list_for_each(ivi_view, &layout->view_list, link) {
ivisurf = ivi_view->ivisurf;
ivilayer = ivi_view->on_layer;
iviscrn = ivilayer->on_screen;
wl_list_for_each(ivi_view, &ivilayer->order.view_list, order_link) {
/*
* If ivilayer is invisible, weston_view of ivisurf doesn't
* need to be modified.
*/
if (ivi_view->ivisurf->prop.visibility == false)
continue;
/*
* If the view is not on the currently rendered scenegraph,
* we do not need to update its properties.
*/
if (wl_list_empty(&ivi_view->order_link) || !iviscrn)
continue;
update_prop(ivi_view);
}
}
/*
* If the view's layer or surface is invisible, we do not need
* to update its properties.
*/
if (!ivilayer->prop.visibility || !ivisurf->prop.visibility)
continue;
update_prop(ivi_view);
}
}

Loading…
Cancel
Save