From 656d9cb0afe5fcac447acecccdeeb72581f06385 Mon Sep 17 00:00:00 2001 From: Nobuhiko Tanibata Date: Wed, 3 Dec 2014 13:06:36 +0900 Subject: [PATCH] ivi-shell: ivi-layout, ivi_layout_surface_get_size This is used by screenshot per surface. Signed-off-by: Nobuhiko Tanibata --- ivi-shell/ivi-layout-export.h | 12 ++++++++++++ ivi-shell/ivi-layout.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h index 196b115..f2309d3 100644 --- a/ivi-shell/ivi-layout-export.h +++ b/ivi-shell/ivi-layout-export.h @@ -642,6 +642,18 @@ ivi_layout_screen_get_output(struct ivi_layout_screen *); struct weston_surface * ivi_layout_surface_get_weston_surface(struct ivi_layout_surface *ivisurf); +/** + * \brief Get size; width, height, and stride. + * + * \return IVI_SUCCEEDED if the method call was successful + * \return IVI_FAILED if the method call was failed + */ +int32_t +ivi_layout_surface_get_size(struct ivi_layout_surface *ivisurf, + int32_t *width, + int32_t *height, + int32_t *stride); + int32_t ivi_layout_layer_set_transition(struct ivi_layout_layer *ivilayer, enum ivi_layout_transition_type type, diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c index 93a4144..33c88f6 100644 --- a/ivi-shell/ivi-layout.c +++ b/ivi-shell/ivi-layout.c @@ -2444,6 +2444,38 @@ ivi_layout_surface_get_weston_surface(struct ivi_layout_surface *ivisurf) return ivisurf != NULL ? ivisurf->surface : NULL; } +/** + * This function is used by the additional ivi-module because of dumping ivi_surface sceenshot. + * The ivi-module, e.g. ivi-controller.so, is in wayland-ivi-extension of GENIVI's Layer Management. + * This function is used to get the region and the stride. + */ +WL_EXPORT int32_t +ivi_layout_surface_get_size(struct ivi_layout_surface *ivisurf, + int32_t *width, + int32_t *height, + int32_t *stride) +{ + if (ivisurf == NULL) { + return IVI_FAILED; + } + + if (width != NULL) { + *width = ivisurf->prop.source_width; + } + + if (height != NULL) { + *height = ivisurf->prop.source_height; + } + + if (stride != NULL && + ivisurf->surface->buffer_ref.buffer != NULL && + ivisurf->surface->buffer_ref.buffer->shm_buffer != NULL) { + *stride = wl_shm_buffer_get_stride(ivisurf->surface->buffer_ref.buffer->shm_buffer); + } + + return IVI_SUCCEEDED; +} + WL_EXPORT int32_t ivi_layout_layer_add_notification(struct ivi_layout_layer *ivilayer, layer_property_notification_func callback, -- 2.7.4