[PATCH weston 5/9] ivi-shell: remove redundant code in commit_surface_list

Emre Ucan eucan at de.adit-jv.com
Wed May 23 08:27:20 UTC 2018


Move out the statements out of if statement, which are
the same in every branch. Furthermore, *_move_resize_view()
function does not modify destination rectangle of the
surface. Therefore, we don't need to store the destination
rectangle locally and set it again.

Signed-off-by: Emre Ucan <eucan at de.adit-jv.com>
---
 ivi-shell/ivi-layout.c | 45 ++++-----------------------------------------
 1 file changed, 4 insertions(+), 41 deletions(-)

diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index 57c4f3b..548b3a3 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -632,19 +632,10 @@ static void
 commit_surface_list(struct ivi_layout *layout)
 {
 	struct ivi_layout_surface *ivisurf = NULL;
-	int32_t dest_x = 0;
-	int32_t dest_y = 0;
-	int32_t dest_width = 0;
-	int32_t dest_height = 0;
 	int32_t configured = 0;
 
 	wl_list_for_each(ivisurf, &layout->surface_list, link) {
 		if (ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_DEFAULT) {
-			dest_x = ivisurf->prop.dest_x;
-			dest_y = ivisurf->prop.dest_y;
-			dest_width = ivisurf->prop.dest_width;
-			dest_height = ivisurf->prop.dest_height;
-
 			ivi_layout_transition_move_resize_view(ivisurf,
 							       ivisurf->pending.prop.dest_x,
 							       ivisurf->pending.prop.dest_y,
@@ -657,37 +648,13 @@ commit_surface_list(struct ivi_layout *layout)
 			} else {
 				ivi_layout_transition_visibility_off(ivisurf, ivisurf->pending.prop.transition_duration);
 			}
-
-			ivisurf->prop = ivisurf->pending.prop;
-			ivisurf->prop.dest_x = dest_x;
-			ivisurf->prop.dest_y = dest_y;
-			ivisurf->prop.dest_width = dest_width;
-			ivisurf->prop.dest_height = dest_height;
-			ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-			ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-
 		} else if (ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_MOVE_RESIZE) {
-			dest_x = ivisurf->prop.dest_x;
-			dest_y = ivisurf->prop.dest_y;
-			dest_width = ivisurf->prop.dest_width;
-			dest_height = ivisurf->prop.dest_height;
-
 			ivi_layout_transition_move_resize_view(ivisurf,
 							       ivisurf->pending.prop.dest_x,
 							       ivisurf->pending.prop.dest_y,
 							       ivisurf->pending.prop.dest_width,
 							       ivisurf->pending.prop.dest_height,
 							       ivisurf->pending.prop.transition_duration);
-
-			ivisurf->prop = ivisurf->pending.prop;
-			ivisurf->prop.dest_x = dest_x;
-			ivisurf->prop.dest_y = dest_y;
-			ivisurf->prop.dest_width = dest_width;
-			ivisurf->prop.dest_height = dest_height;
-
-			ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-			ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-
 		} else if (ivisurf->pending.prop.transition_type == IVI_LAYOUT_TRANSITION_VIEW_FADE) {
 			configured = 0;
 			if (ivisurf->pending.prop.visibility) {
@@ -701,10 +668,6 @@ commit_surface_list(struct ivi_layout *layout)
 				configured = 1;
 			}
 
-			ivisurf->prop = ivisurf->pending.prop;
-			ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-			ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-
 			if (configured && !is_surface_transition(ivisurf)) {
 				shell_surface_send_configure(ivisurf->surface,
 							     ivisurf->prop.dest_width,
@@ -717,16 +680,16 @@ commit_surface_list(struct ivi_layout *layout)
 				configured = 1;
 			}
 
-			ivisurf->prop = ivisurf->pending.prop;
-			ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-			ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
-
 			if (configured && !is_surface_transition(ivisurf)) {
 				shell_surface_send_configure(ivisurf->surface,
 							     ivisurf->prop.dest_width,
 							     ivisurf->prop.dest_height);
 			}
 		}
+
+		ivisurf->prop = ivisurf->pending.prop;
+		ivisurf->prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
+		ivisurf->pending.prop.transition_type = IVI_LAYOUT_TRANSITION_NONE;
 	}
 }
 
-- 
2.7.4



More information about the wayland-devel mailing list