From 2b21742a91ee7219c3f3dde34ca35cbbde589e6e Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Mon, 7 Jul 2014 09:55:45 -0400 Subject: [PATCH] Added conversion for image format to ARGB from XRGB for wayland. evas_object_image_data_set will be used instead of evas_object_image_data_copy_set. Summary: this patch will provide to launch the application based on XRGB8888 like weston-simple-shm. Test Plan: launch weston-simple-shm Reviewers: devilhorns, zmike, raster CC: cedric Differential Revision: https://phab.enlightenment.org/D1137 --- src/bin/e_pixmap.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/src/bin/e_pixmap.c b/src/bin/e_pixmap.c index 61adeea96..cd09d6041 100644 --- a/src/bin/e_pixmap.c +++ b/src/bin/e_pixmap.c @@ -743,11 +743,34 @@ e_pixmap_image_data_argb_convert(E_Pixmap *cp, void *pix, void *ipix, Eina_Recta case E_PIXMAP_TYPE_WL: if (cp->image_argb) return EINA_TRUE; #if defined(HAVE_WAYLAND_CLIENTS) || defined(HAVE_WAYLAND_ONLY) - WRN("FIXME: Convert wayland non-argb image"); - (void) pix; - (void) ipix; - (void) r; - (void) stride; + if (cp->resource) + { + /* TOOD: add more cases */ + struct wl_shm_buffer *buffer; + uint32_t format; + int i, x, y; + unsigned int *src, *dst; + + if (!(buffer = wl_shm_buffer_get(cp->resource))) + return EINA_FALSE; + + format = wl_shm_buffer_get_format(buffer); + if (format == WL_SHM_FORMAT_XRGB8888) + { + dst = (unsigned int *)pix; + src = (unsigned int *)ipix; + + for (y = 0; y < r->h; y++) + { + i = (r->y + y) * stride / 4 + r->x; + for (x = 0; x < r->w; x++) + dst[i+x] = 0xff000000 | src[i+x]; + } + pix = (void *)dst; + } + } + + return EINA_TRUE; #endif break; default: