clients: Fix weston-scaler source-only mode to use integer width and height
If only the source of a viewport is set, the width and height must
be integer or the protocol mandates that the compositor generate an
error. This is because using only the source is a crop, and the
width and height become the surface size - all surface sizes must
be integer.
Weston was fixed to generate this error in bb32ccc0
, however the
test app continued to use fractional co-ordinates when run as
weston-scaler -s (which only sets the viewport source)
This leaves fractional width/height for the other cases, but uses
integer for the crop-only mode. The descriptions in the help text
are still accurate with this change, but weston-scaler -s no longer
exits with an error.
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
parent
be8a6d3cfb
commit
c3ded6603f
|
@ -86,6 +86,16 @@ set_my_viewport(struct box *box)
|
||||||
|
|
||||||
switch (box->mode){
|
switch (box->mode){
|
||||||
case MODE_SRC_ONLY:
|
case MODE_SRC_ONLY:
|
||||||
|
/* In SRC_ONLY mode we're just cropping - in order
|
||||||
|
* for the surface size to remain an integer, the
|
||||||
|
* compositor will generate an error if we use a
|
||||||
|
* fractional width or height.
|
||||||
|
*
|
||||||
|
* We use fractional width/height for the other cases
|
||||||
|
* to ensure fractional values are still tested.
|
||||||
|
*/
|
||||||
|
src_width = wl_fixed_from_int(RECT_W / BUFFER_SCALE);
|
||||||
|
src_height = wl_fixed_from_int(RECT_H / BUFFER_SCALE);
|
||||||
wp_viewport_set_source(box->viewport, src_x, src_y,
|
wp_viewport_set_source(box->viewport, src_x, src_y,
|
||||||
src_width, src_height);
|
src_width, src_height);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue