[PATCH weston 2/2] compositor: wl_viewport destination 1x1 min

Pekka Paalanen ppaalanen at gmail.com
Fri Apr 4 04:22:13 PDT 2014


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

Ensure, that the resulting surface size is at least 1x1, even when
destination size is not set and source size is zero. Previously this
lead to zero surface size.

This can still happen due to wl_viewport.set(#, #, 0, 0, #, #) followed
by wl_viewport.set_destination(-1, -1).

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 src/compositor.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 5439a6b..d2373d9 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1245,9 +1245,10 @@ weston_surface_set_size_from_buffer(struct weston_surface *surface)
 	}
 
 	if (vp->buffer.src_width != wl_fixed_from_int(-1)) {
-		surface_set_size(surface,
-				 fixed_round_up_to_int(vp->buffer.src_width),
-				 fixed_round_up_to_int(vp->buffer.src_height));
+		int32_t w = fixed_round_up_to_int(vp->buffer.src_width);
+		int32_t h = fixed_round_up_to_int(vp->buffer.src_height);
+
+		surface_set_size(surface, w ?: 1, h ?: 1);
 		return;
 	}
 
-- 
1.8.3.2



More information about the wayland-devel mailing list