ivi-shell: ivi-layout, ivi_layout_surface_get_size upstream upstream/0.1.8 upstream/0.1.9
authorNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Wed, 3 Dec 2014 04:06:36 +0000 (13:06 +0900)
committerJan Ekström <jan.ekstrom@intel.com>
Thu, 4 Dec 2014 11:34:18 +0000 (13:34 +0200)
This is used by screenshot per surface.

Signed-off-by: Nobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
ivi-shell/ivi-layout-export.h
ivi-shell/ivi-layout.c

index 196b115..f2309d3 100644 (file)
@@ -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,
index 93a4144..33c88f6 100644 (file)
@@ -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,