compositor: wl_viewport destination 1x1 min

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@collabora.co.uk>
This commit is contained in:
Pekka Paalanen 2014-04-04 14:22:13 +03:00 committed by Kristian Høgsberg
parent 2c8b5f534b
commit e931721aa1

View File

@ -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;
}