derekf pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=1774b5992396f9067c94afa256982ac78fcafd49

commit 1774b5992396f9067c94afa256982ac78fcafd49
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Fri Apr 29 11:16:49 2016 -0500

    Add e_pixmap API for testing if a pixmap is a native surface
    
    DMAbuf for wayland will complicate determining whether a pixmap can use
    a native surface or not, so we add an API here to check this.
    
    Note that this doesn't take compositor capabilities into account - for
    example, X pixmaps need GL enabled to use native surfaces.  This is
    already tested elsewhere.
---
 src/bin/e_pixmap.c | 16 ++++++++++++++++
 src/bin/e_pixmap.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c
index 2bd94a7..0a77df0 100644
--- a/src/bin/e_pixmap.c
+++ b/src/bin/e_pixmap.c
@@ -668,6 +668,22 @@ e_pixmap_parent_window_get(E_Pixmap *cp)
 }
 
 E_API Eina_Bool
+e_pixmap_is_pixels(E_Pixmap *cp)
+{
+   switch (cp->type)
+     {
+        case E_PIXMAP_TYPE_X:
+          return EINA_FALSE;
+        case E_PIXMAP_TYPE_WL:
+          if (!cp->buffer) return EINA_TRUE;
+          if (cp->buffer->shm_buffer) return EINA_TRUE;
+          return EINA_FALSE;
+        default:
+          return EINA_TRUE;
+     }
+}
+
+E_API Eina_Bool
 e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface *ns)
 {
    Eina_Bool ret = EINA_FALSE;
diff --git a/src/bin/e_pixmap.h b/src/bin/e_pixmap.h
index 8370efe..cdd1f18 100644
--- a/src/bin/e_pixmap.h
+++ b/src/bin/e_pixmap.h
@@ -38,6 +38,7 @@ E_API E_Pixmap *e_pixmap_find(E_Pixmap_Type type, ...);
 E_API E_Client *e_pixmap_find_client(E_Pixmap_Type type, ...);
 E_API int64_t e_pixmap_window_get(E_Pixmap *cp);
 E_API Ecore_Window e_pixmap_parent_window_get(E_Pixmap *cp);
+E_API Eina_Bool e_pixmap_is_pixels(E_Pixmap *cp);
 E_API Eina_Bool e_pixmap_native_surface_init(E_Pixmap *cp, Evas_Native_Surface 
*ns);
 E_API void e_pixmap_image_clear(E_Pixmap *cp, Eina_Bool cache);
 E_API Eina_Bool e_pixmap_image_refresh(E_Pixmap *cp);

-- 


Reply via email to