e_pixmap : add native_surface_init function 86/324386/1
authorjinbong.lee <jinbong.lee@samsung.com>
Thu, 15 May 2025 11:43:07 +0000 (20:43 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 16 May 2025 07:30:35 +0000 (16:30 +0900)
Change-Id: I158557fa2ebba871f6e9454875a4a333a05a4f9c
Signed-off-by: jinbong.lee <jinbong.lee@samsung.com>
src/bin/core/e_pixmap.c
src/include/e_pixmap.h

index 85e2cf9734aca455d00f619dc1dfabd577e416c9..af61cf11191ff0c5a87bd8125eda40dd23140e55 100644 (file)
@@ -573,6 +573,38 @@ e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns)
    return ret;
 }
 
+E_API bool
+e_pixmap_view_native_surface_init(E_Pixmap *cp, E_View_Native_Surface *ns)
+{
+   Eina_Bool ret = EINA_FALSE;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(cp, EINA_FALSE);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(ns, EINA_FALSE);
+   EINA_SAFETY_ON_FALSE_RETURN_VAL(cp->type == E_PIXMAP_TYPE_WL, EINA_FALSE);
+
+   ns->version = E_VIEW_NATIVE_SURFACE_VERSION;
+   if (cp->buffer && cp->buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE)
+     {
+        ns->type = E_VIEW_NATIVE_SURFACE_WL;
+        ns->data.wl.legacy_buffer = cp->buffer->resource;
+        ret = !cp->buffer->shm_buffer;
+     }
+   else if (cp->buffer && cp->buffer->type == E_COMP_WL_BUFFER_TYPE_TBM)
+     {
+        ns->type = E_VIEW_NATIVE_SURFACE_TBM;
+        ns->data.tbm.buffer = cp->buffer->tbm_surface;
+        if (cp->buffer->tbm_surface)
+          ret = EINA_TRUE;
+     }
+   else /* SHM buffer or VIDEO buffer */
+     {
+        ns->type = E_VIEW_NATIVE_SURFACE_NONE;
+        ret = EINA_FALSE;
+     }
+
+   return ret;
+}
+
 E_API void
 e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache)
 {
index 300effcea3ee458f42b09f65cb142e5a23097713..2b8fe473484061735d9af96931d8035262a35b4b 100644 (file)
@@ -7,6 +7,7 @@ extern "C" {
 
 #include <e_types.h>
 #include <e_client.h>
+#include <e_view_image.h>
 
 typedef struct _E_Pixmap E_Pixmap;
 typedef struct _E_Pixmap_Hook E_Pixmap_Hook;
@@ -46,6 +47,7 @@ E_API E_Client              *e_pixmap_find_client_by_res_id(uint32_t res_id);
 E_API uint32_t               e_pixmap_res_id_get(E_Pixmap *cp);
 E_API uint64_t               e_pixmap_window_get(E_Pixmap *cp);
 E_API Eina_Bool              e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns);
+E_API bool                   e_pixmap_view_native_surface_init(E_Pixmap *cp, E_View_Native_Surface *ns);
 E_API void                   e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache);
 
 E_API E_Pixmap_Hook *e_pixmap_hook_add(E_Pixmap_Hook_Point hookpoint, E_Pixmap_Hook_Cb func, const void *data);