Obvious this affects the source, not destination.
Reported-by: Jasper St. Pierre <jstpierre@mecheye.net>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Let's make the source and destination size rules consistent: neither can
have zero, {-1, -1} disables it, and other negatives are not allowed.
The sanity of allowing zero sized source rectangle as debatable. Now the
minimum becomes 1/256x1/256, and with output_scale the actual samples
may be even smaller. That should be enough.
On not allowed values, raise a protocol error. This should help catch
bugs in clients that accidentally send garbage values.
The old wl_viewport.set request remains the same, and can still produce
zero sized source rectangle.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Bump wl_scaler and wl_viewport versions to 2. Add new requests
wl_viewport.set_source and .set_destination, which are meant to replace
wl_viewport.set request.
Now a client can set and unset just one of source rectangle and
destination size. Define the semantics when one of these is unset.
Implement these semantics changes in compositor and pixman renderer.
GL-renderer does not need changes.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This seems like a better name, and will not conflict if someone later
extends wl_surface with a request scaler_set (yeah, unlikely).
This code was written by Jonny Lamb, I just diffed his branches and made
a patch for Weston.
Cc: Jonny Lamb <jonny.lamb@collabora.co.uk>
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Add cropping and scaling to wl_surface.
Add a global factory interface wl_scaler, which creates
wl_scaler_surface objects tied to a given wl_surface. The
wl_scaler_surface object can be used to set a cropping and scaling
transformation to change how a wl_buffer maps to wl_surface contents.
Changes in v2:
Take into account buffer_transform and buffer_scale, and try to explain
more clearly how the coordinate transformations work and what their
order is. Add, that crop and scale state is double-buffered. Explain
missing dst_x, dst_y. Clarify that undefined content still is some
content, but NULL buffer implies no content nor size.
Changes in v3:
Disallow zero values for dst_width and dst_height.
Open issues:
Should this be a separate interface like here, or just a wl_surface
request?
If we keep this as a separate interface, rename wl_surface_scaler to
wl_viewport.