From: Joonbum Ko Date: Sun, 12 Jul 2020 05:07:23 +0000 (+0900) Subject: Implemented backend function to get size. X-Git-Tag: submit/tizen/20200720.050615^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=717d75b50df10d187187f424f71ddb6eb134dcfb;p=platform%2Fcore%2Fuifw%2Flibtpl-egl.git Implemented backend function to get size. Change-Id: I530e24aafd386b6447e4e886f6d6c97bce7595a1 Signed-off-by: Joonbum Ko --- diff --git a/src/tpl_internal.h b/src/tpl_internal.h index ba161c9..2b663ed 100755 --- a/src/tpl_internal.h +++ b/src/tpl_internal.h @@ -111,6 +111,8 @@ struct _tpl_surface_backend { tpl_result_t (*set_rotation_capability)(tpl_surface_t *surface, tpl_bool_t set); tpl_result_t (*set_post_interval)(tpl_surface_t *surface, int post_interval); + + void (*get_size)(tpl_surface_t *surface, int *width, int *height); }; struct _tpl_object { diff --git a/src/tpl_surface.c b/src/tpl_surface.c index 994aec3..b41534b 100755 --- a/src/tpl_surface.c +++ b/src/tpl_surface.c @@ -193,9 +193,13 @@ tpl_surface_get_size(tpl_surface_t *surface, int *width, int *height) return TPL_ERROR_INVALID_PARAMETER; } - if (width) *width = surface->width; - - if (height) *height = surface->height; + if (surface->backend.get_size) { + surface->backend.get_size(surface, width, height); + } + else { + if (width) *width = surface->width; + if (height) *height = surface->height; + } return TPL_ERROR_NONE; } diff --git a/src/tpl_wl_egl_thread.c b/src/tpl_wl_egl_thread.c index 15697a4..1915fc9 100755 --- a/src/tpl_wl_egl_thread.c +++ b/src/tpl_wl_egl_thread.c @@ -795,6 +795,19 @@ __tpl_wl_egl_surface_dequeue_buffer(tpl_surface_t *surface, uint64_t timeout_ns, return tbm_surface; } +void +__tpl_wl_egl_surface_get_size(tpl_surface_t *surface, int *width, int *height) +{ + tpl_wayland_egl_surface_t *wayland_egl_surface = + (tpl_wayland_egl_surface_t *)surface->backend.data; + + if (width) + *width = tbm_surface_queue_get_width(wayland_egl_surface->tbm_queue); + if (height) + *height = tbm_surface_queue_get_height(wayland_egl_surface->tbm_queue); +} + + tpl_bool_t __tpl_display_choose_backend_wl_egl_thread(tpl_handle_t native_dpy) { @@ -843,5 +856,7 @@ __tpl_surface_init_backend_wl_egl_thread(tpl_surface_backend_t *backend) __tpl_wl_egl_surface_set_rotation_capability; backend->set_post_interval = __tpl_wl_egl_surface_set_post_interval; + backend->get_size = + __tpl_wl_egl_surface_get_size; }