From 1774b5992396f9067c94afa256982ac78fcafd49 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 29 Apr 2016 11:16:49 -0500 Subject: [PATCH] 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 2bd94a77f..0a77df009 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -667,6 +667,22 @@ e_pixmap_parent_window_get(E_Pixmap *cp) return cp->parent; } +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) { diff --git a/src/bin/e_pixmap.h b/src/bin/e_pixmap.h index 8370efe34..cdd1f18af 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);