Implemented backend function to get size. 83/238883/1 submit/tizen/20200720.050615
authorJoonbum Ko <joonbum.ko@samsung.com>
Sun, 12 Jul 2020 05:07:23 +0000 (14:07 +0900)
committerJoonbum Ko <joonbum.ko@samsung.com>
Sun, 12 Jul 2020 05:07:23 +0000 (14:07 +0900)
Change-Id: I530e24aafd386b6447e4e886f6d6c97bce7595a1
Signed-off-by: Joonbum Ko <joonbum.ko@samsung.com>
src/tpl_internal.h
src/tpl_surface.c
src/tpl_wl_egl_thread.c

index ba161c9a965c8bc2fac18916222f791dd0be5e83..2b663ed1a316c9256487924a00cb3687887194d4 100755 (executable)
@@ -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 {
index 994aec3c79b3c892eea5873d2776480bb6424641..b41534b7f33909ed9ace45e1843d3f0163bf38b8 100755 (executable)
@@ -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;
 }
index 15697a47a99106bd56f56875774a0e620dae9174..1915fc9dd49987f8f4acbdba64e89a000e47e8a0 100755 (executable)
@@ -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;
 }