int tbm_surface_internal_capture_shm_buffer(void *ptr, int w, int h, int stride,
const char *path, const char *name, const char *type);
+/**
+ * @brief Set damage to surface
+ * @param[in] surface : a tbm surface
+ * @param[in] x : a x coordinate of damage
+ * @param[in] y : a y coordinate of damage
+ * @param[in] with : a width of damage rectangle
+ * @param[in] height : a height of damage rectangle
+ * @return 1 if success, otherwise 0.
+ */
+int tbm_surface_internal_set_damage(tbm_surface_h surface, int x, int y, int width, int height);
+
+/**
+ * @brief Get damage of surface
+ * @param[in] surface : a tbm surface
+ * @param[out] x : a x coordinate of damage
+ * @param[out] y : a y coordinate of damage
+ * @param[out] with : a width of damage rectangle
+ * @param[out] height : a height of damage rectangle
+ * @return 1 if success, otherwise 0.
+ */
+int tbm_surface_internal_get_damage(tbm_surface_h surface, int *x, int *y, int *width, int *height);
+
#ifdef __cplusplus
}
#endif
return 1;
}
+
+int
+tbm_surface_internal_set_damage(tbm_surface_h surface, int x, int y, int width, int height)
+{
+ struct _tbm_surface *surf;
+
+ _tbm_surface_mutex_lock();
+ _tbm_set_last_result(TBM_ERROR_NONE);
+
+ TBM_SURFACE_RETURN_VAL_IF_FAIL(width > 0, 0);
+ TBM_SURFACE_RETURN_VAL_IF_FAIL(height > 0, 0);
+ TBM_SURFACE_RETURN_VAL_IF_FAIL(_tbm_surface_internal_is_valid(surface), 0);
+
+ surf = (struct _tbm_surface *)surface;
+
+ surf->damage.x = x;
+ surf->damage.y = y;
+ surf->damage.width = width;
+ surf->damage.height = height;
+
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) x(%d) y(%d) width(%d) height(%d)\n",
+ surface, x, y, width, height);
+
+ _tbm_surface_mutex_unlock();
+
+ return 1;
+}
+
+int
+tbm_surface_internal_get_damage(tbm_surface_h surface, int *x, int *y, int *width, int *height)
+{
+ struct _tbm_surface *surf;
+
+ _tbm_surface_mutex_lock();
+ _tbm_set_last_result(TBM_ERROR_NONE);
+
+ TBM_SURFACE_RETURN_VAL_IF_FAIL(width > 0, 0);
+ TBM_SURFACE_RETURN_VAL_IF_FAIL(height > 0, 0);
+ TBM_SURFACE_RETURN_VAL_IF_FAIL(_tbm_surface_internal_is_valid(surface), 0);
+
+ surf = (struct _tbm_surface *)surface;
+
+ *x = surf->damage.x;
+ *y = surf->damage.y;
+ *width = surf->damage.width;
+ *height = surf->damage.height;
+
+ TBM_TRACE_SURFACE_INTERNAL("tbm_surface(%p) x(%d) y(%d) width(%d) height(%d)\n",
+ surface, *x, *y, *width, *height);
+
+ _tbm_surface_mutex_unlock();
+
+ return 1;
+}
/*LCOV_EXCL_STOP*/