diff options
author | Ucan, Emre (ADITG/SW1) <eucan@de.adit-jv.com> | 2017-01-30 13:36:07 +0000 |
---|---|---|
committer | Pekka Paalanen <pekka.paalanen@collabora.co.uk> | 2017-02-06 12:11:33 +0200 |
commit | 27799355a9d82075bedc72a46f006e48778717db (patch) | |
tree | 9c5d4e41f99b2b8ccb147a5fa16b04a1a7bd3376 /ivi-shell | |
parent | 1b92ba20ac28b9882d5225a1d990c46fb47a61a7 (diff) | |
download | weston-27799355a9d82075bedc72a46f006e48778717db.tar.gz weston-27799355a9d82075bedc72a46f006e48778717db.tar.bz2 weston-27799355a9d82075bedc72a46f006e48778717db.zip |
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>
Diffstat (limited to 'ivi-shell')
-rw-r--r-- | ivi-shell/ivi-layout.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 6c13fee4..712cc30d 100644 --- a/ivi-shell/ivi-layout.c +++ b/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); } } |