From 2ac4c05204411b9a7b1409cd080aa30aeb56248a Mon Sep 17 00:00:00 2001 From: Janos Kovacs Date: Tue, 26 Aug 2014 11:55:06 +0300 Subject: [PATCH] downstream: ivi-layout: fix resizing by forcing the source rectangle size to buf size Change-Id: Ibc8b3711417e07708ad37ea47086f45218df5944 Signed-off-by: Janos Kovacs --- ivi-shell/ivi-layout.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index a2844b5..f53c1e1 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -2606,32 +2606,43 @@ ivi_layout_surface_configure(struct ivi_layout_surface *ivisurf, int32_t width, int32_t height) { struct ivi_layout *layout = get_layout_instance(); - int32_t in_init = 0; + int needs_commit; ivisurf->surface->width_from_buffer = width; ivisurf->surface->height_from_buffer = height; if (ivisurf->prop.source_width == 0 || ivisurf->prop.source_height == 0) { - in_init = 1; + ivisurf->prop.source_width = width; + ivisurf->prop.source_height = height; } - /* FIXME: when sourceHeight/Width is used as clipping range in image buffer */ - /* if (ivisurf->prop.sourceWidth == 0 || ivisurf->prop.sourceHeight == 0) { */ + if (width != ivisurf->pending.prop.source_width || + height != ivisurf->pending.prop.source_height) { + /* + * This is quick fix for resizing buffers and will reset zooming + * TODO: replace this with some more complex code that tries to * preserve the zooming ratio and relative position + */ + ivisurf->pending.prop.source_x = 0; + ivisurf->pending.prop.source_y = 0; ivisurf->pending.prop.source_width = width; ivisurf->pending.prop.source_height = height; - ivisurf->prop.source_width = width; - ivisurf->prop.source_height = height; - /* } */ - ivisurf->event_mask |= IVI_NOTIFICATION_CONFIGURE; + needs_commit = (ivisurf->event_mask == 0) ? 1 : 0; - if (in_init) { - wl_signal_emit(&layout->surface_notification.configure_changed, ivisurf); - } else { - ivi_layout_commit_changes(); + ivisurf->event_mask |= IVI_NOTIFICATION_SOURCE_RECT; + + weston_log("resizing source rectangle of surface %u to %dx%d (%s)\n", + ivisurf->id_surface, width,height, + needs_commit ? "commiting it" : "no commit"); + + if (needs_commit) + ivi_layout_commit_changes(); } + + wl_signal_emit(&layout->surface_notification.configure_changed, ivisurf); } + WL_EXPORT int32_t ivi_layout_surface_set_content_observer(struct ivi_layout_surface *ivisurf, ivi_controller_surface_content_callback callback, -- 2.7.4