Add the viewport offset position into the sprite plane cropping calculation. Without this patch the sprite plane always outputs from the top left corner of the source buffer.
Signed-off-by: Tomohito Esaki <e...@igel.co.jp> --- libweston/compositor-drm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index 8319d7c..31f9724 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -1105,6 +1105,19 @@ drm_output_prepare_overlay_view(struct drm_output *output, if (sy2 > wl_fixed_from_int(ev->surface->height)) sy2 = wl_fixed_from_int(ev->surface->height); + /* Calculate source crop offset */ + if (viewport->buffer.src_width != wl_fixed_from_int(-1) && + viewport->buffer.src_height != wl_fixed_from_int(-1)) { + if (sx1 < viewport->buffer.src_x) { + sx1 = viewport->buffer.src_x; + sx2 += sx1; + } + if (sy1 < viewport->buffer.src_y) { + sy1 = viewport->buffer.src_y; + sy2 += sy1; + } + } + tbox.x1 = sx1; tbox.y1 = sy1; tbox.x2 = sx2; -- 2.7.4 _______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/wayland-devel