summaryrefslogtreecommitdiff
path: root/ivi-shell
diff options
context:
space:
mode:
authorNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>2015-04-21 02:13:15 +0900
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-04-21 11:15:29 +0300
commitc3fd624e29c5815903caaf4c6f1875a515f5bd04 (patch)
tree5b22215528cbf8d8678d43265b7f93e94033171d /ivi-shell
parente12a186ab032d02edd8673f194f5c3a0ffe8ce93 (diff)
ivi-shell: support surface screen shot of ivi_layout by using weston_surface_copy_content
The reason why the result is not output in the method is that it avoids to have dependency on CAIRO. If user want to output it to file, user shall link CAIRO on its controller. ivi_layout_surface_get_size is also supported here because user needs stride to call ivi_layout_surafce_dump. Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'ivi-shell')
-rw-r--r--ivi-shell/ivi-layout-export.h12
-rw-r--r--ivi-shell/ivi-layout.c55
2 files changed, 66 insertions, 1 deletions
diff --git a/ivi-shell/ivi-layout-export.h b/ivi-shell/ivi-layout-export.h
index 8848fb1a..4b4328ca 100644
--- a/ivi-shell/ivi-layout-export.h
+++ b/ivi-shell/ivi-layout-export.h
@@ -768,6 +768,18 @@ struct ivi_controller_interface {
uint32_t is_fade_in,
double start_alpha, double end_alpha);
+ /**
+ * surface content dumping for debugging
+ */
+ int32_t (*surface_get_size)(struct ivi_layout_surface *ivisurf,
+ int32_t *width, int32_t *height,
+ int32_t *stride);
+
+ int32_t (*surface_dump)(struct weston_surface *surface,
+ void *target, size_t size,
+ int32_t x, int32_t y,
+ int32_t width, int32_t height);
+
};
#ifdef __cplusplus
diff --git a/ivi-shell/ivi-layout.c b/ivi-shell/ivi-layout.c
index cd4a171f..0c394a9d 100644
--- a/ivi-shell/ivi-layout.c
+++ b/ivi-shell/ivi-layout.c
@@ -2459,6 +2459,34 @@ ivi_layout_surface_get_weston_surface(struct ivi_layout_surface *ivisurf)
}
static int32_t
+ivi_layout_surface_get_size(struct ivi_layout_surface *ivisurf,
+ int32_t *width, int32_t *height,
+ int32_t *stride)
+{
+ int32_t w;
+ int32_t h;
+ const size_t bytespp = 4; /* PIXMAN_a8b8g8r8 */
+
+ if (ivisurf == NULL || ivisurf->surface == NULL) {
+ weston_log("%s: invalid argument\n", __func__);
+ return IVI_FAILED;
+ }
+
+ weston_surface_get_content_size(ivisurf->surface, &w, &h);
+
+ if (width != NULL)
+ *width = w;
+
+ if (height != NULL)
+ *height = h;
+
+ if (stride != NULL)
+ *stride = w * bytespp;
+
+ return IVI_SUCCEEDED;
+}
+
+static int32_t
ivi_layout_layer_add_notification(struct ivi_layout_layer *ivilayer,
layer_property_notification_func callback,
void *userdata)
@@ -2666,6 +2694,25 @@ ivi_layout_surface_set_transition(struct ivi_layout_surface *ivisurf,
return 0;
}
+static int32_t
+ivi_layout_surface_dump(struct weston_surface *surface,
+ void *target, size_t size,int32_t x, int32_t y,
+ int32_t width, int32_t height)
+{
+ int result = 0;
+
+ if (surface == NULL) {
+ weston_log("%s: invalid argument\n", __func__);
+ return IVI_FAILED;
+ }
+
+ result = weston_surface_copy_content(
+ surface, target, size,
+ x, y, width, height);
+
+ return result == 0 ? IVI_SUCCEEDED : IVI_FAILED;
+}
+
/**
* methods of interaction between ivi-shell with ivi-layout
*/
@@ -2930,7 +2977,13 @@ static struct ivi_controller_interface ivi_controller_interface = {
* animation
*/
.transition_move_layer_cancel = ivi_layout_transition_move_layer_cancel,
- .layer_set_fade_info = ivi_layout_layer_set_fade_info
+ .layer_set_fade_info = ivi_layout_layer_set_fade_info,
+
+ /**
+ * surface content dumping for debugging
+ */
+ .surface_get_size = ivi_layout_surface_get_size,
+ .surface_dump = ivi_layout_surface_dump,
};
int