[PATCH weston 2/2] ivi-shell: simplfy commit_changes function
Ucan, Emre (ADITG/SW1)
eucan at de.adit-jv.com
Mon Jan 30 13:36:07 UTC 2017
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 at de.adit-jv.com>
---
ivi-shell/ivi-layout.c | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 6c13fee..6c5c02b 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_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);
}
}
--
1.7.9.5
More information about the wayland-devel
mailing list