X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FPUI.c;h=b8fbc1376020503b87b9f6053fb98c9057601f8d;hb=721570c3d20abb3dfa020fef35a544c2c474c064;hp=e75b09a7d68c07092c141f3d8b5bed603446f570;hpb=60f5ef830f8c5e059572782c748a5e00205fc48a;p=platform%2Fcore%2Fuifw%2Flibpui.git diff --git a/src/PUI.c b/src/PUI.c index e75b09a..b8fbc13 100644 --- a/src/PUI.c +++ b/src/PUI.c @@ -156,25 +156,19 @@ static const struct wl_buffer_listener buffer_listener = { 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; } @@ -315,6 +309,9 @@ pui_display_update(pui_h handle) 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; } @@ -394,6 +391,8 @@ pui_create(Ecore_Wl2_Window *win) 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) { @@ -429,9 +428,22 @@ pui_create(Ecore_Wl2_Window *win) 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) { @@ -475,6 +487,13 @@ pui_destroy(pui_h handle) 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); }