pui_ani_control_buffer *
pui_display_get_last_buffer(pui_h handle)
{
- tbm_surface_error_e ret;
- tbm_surface_h surface;
- pui_ani_control_buffer *buffer = NULL;
-
if (!PUI_MAGIC_CHECK(handle, PUI_MAGIC_PUI_H))
{
PUI_MAGIC_FAIL(handle, PUI_MAGIC_PUI_H, __FUNCTION__);
return NULL;
}
- if (handle->current_sinfo.size <= 0)
+ if (handle->last_buffer.size <= 0)
{
- pui_err("Failed to get last buffer which is not set\n");
- return buffer;
+ pui_err("Failed to get last buffer\n");
+ return NULL;
}
- buffer = (pui_ani_control_buffer *)&(handle->current_sinfo.planes[0].ptr);
-
- return buffer;
+ return &handle->last_buffer;
}
handle->is_buffer_set = 0;
+ if (handle->last_buffer.size > 0)
+ memcpy(handle->last_buffer.ptr, handle->current_sinfo.planes[0].ptr, handle->last_buffer.size);
+
return PUI_ERROR_NONE;
}
pui_h handle = NULL;
Ecore_Wl2_Display *ewd = ecore_wl2_window_display_get(win);
struct wayland_tbm_client *wl_tbm_client = NULL;
+ int w = 0, h = 0;
+ pui_bool res;
if (!win || !ewd)
{
handle->manual_render = 0;
handle->backend_module_data = pui_module->backend_module_data;
+ res = pui_display_geometry_get(handle, &w, &h);
+ if (!res)
+ {
+ /* NOTE: This is a default value for tbm_queue.
+ * This value is set before this patch.
+ */
+ w = h = 100;
+ }
+
+ handle->last_buffer.ptr = (unsigned char *)calloc(w * h * 4, sizeof(unsigned char));
+ if (handle->last_buffer.ptr)
+ handle->last_buffer.size = sizeof(unsigned char) * w * h * 4;
+
handle->tbm_queue = wayland_tbm_client_create_surface_queue(handle->wl_tbm_client,
ecore_wl2_window_surface_get(handle->win),
- 3, 100, 100, TBM_FORMAT_ABGR8888);
+ 3, w, h, TBM_FORMAT_ABGR8888);
if (!handle->tbm_queue)
{
handle->wl_tbm_client = NULL;
}
+ if (handle->last_buffer.ptr)
+ {
+ free(handle->last_buffer.ptr);
+ handle->last_buffer.ptr = NULL;
+ handle->last_buffer.size = 0;
+ }
+
PUI_MAGIC_SET(handle, PUI_MAGIC_NONE);
free(handle);
}