compositor: raise errors when bad scale or transform values are used

This commit is contained in:
Jonny Lamb 2014-05-30 12:07:15 +02:00 committed by Pekka Paalanen
parent 6d1d1121a5
commit a55f139d3c

View File

@ -2138,6 +2138,16 @@ surface_set_buffer_transform(struct wl_client *client,
{
struct weston_surface *surface = wl_resource_get_user_data(resource);
/* if wl_output.transform grows more members this will need to be updated. */
if (transform < 0 ||
transform > WL_OUTPUT_TRANSFORM_FLIPPED_270) {
wl_resource_post_error(resource,
WL_SURFACE_ERROR_INVALID_TRANSFORM,
"buffer transform must be a valid transform "
"('%d' specified)", transform);
return;
}
surface->pending.buffer_viewport.buffer.transform = transform;
}
@ -2148,6 +2158,14 @@ surface_set_buffer_scale(struct wl_client *client,
{
struct weston_surface *surface = wl_resource_get_user_data(resource);
if (scale < 1) {
wl_resource_post_error(resource,
WL_SURFACE_ERROR_INVALID_SCALE,
"buffer scale must be at least one "
"('%d' specified)", scale);
return;
}
surface->pending.buffer_viewport.buffer.scale = scale;
}