From 1a5c1f3847abfa2f3cc896015918c193734c20f1 Mon Sep 17 00:00:00 2001 From: Youngbok Shin Date: Mon, 24 Aug 2020 19:31:30 +0900 Subject: [PATCH] evas_engine: remove a dead code and sync with upstream code @fix Change-Id: Ie5f79e786cb842f98e88d8d97afcc3002d00668a --- src/modules/evas/engines/wayland_shm/evas_engine.c | 123 ++++++++++----------- 1 file changed, 59 insertions(+), 64 deletions(-) diff --git a/src/modules/evas/engines/wayland_shm/evas_engine.c b/src/modules/evas/engines/wayland_shm/evas_engine.c index 04f3297..40c98ef 100644 --- a/src/modules/evas/engines/wayland_shm/evas_engine.c +++ b/src/modules/evas/engines/wayland_shm/evas_engine.c @@ -208,72 +208,69 @@ eng_image_native_set(void *engine EINA_UNUSED, void *image, void *native) RGBA_Image *im = image; RGBA_Image *im2 = NULL; - if (!im) return im; + if (!im || !ns) return im; - if (ns) + if (ns->type == EVAS_NATIVE_SURFACE_TBM) + { + if (im->native.data) + { + //image have native surface already + Evas_Native_Surface *ens = im->native.data; + + if ((ens->type == ns->type) && + (ens->data.tbm.buffer == ns->data.tbm.buffer)) + return im; + } + } + + if (ns->type == EVAS_NATIVE_SURFACE_EVASGL) { - if (ns->type == EVAS_NATIVE_SURFACE_TBM) - { - if (im->native.data) - { - //image have native surface already - Evas_Native_Surface *ens = im->native.data; - - if ((ens->type == ns->type) && - (ens->data.tbm.buffer == ns->data.tbm.buffer)) - return im; - } - } - - if (ns->type == EVAS_NATIVE_SURFACE_EVASGL) - { - im2 = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(), - ie->w, ie->h, ns->data.evasgl.surface, 1, - EVAS_COLORSPACE_ARGB8888); - } - else if (ns->type == EVAS_NATIVE_SURFACE_TBM) - { - Evas_Colorspace cs = _evas_native_tbm_surface_colorspace_get(NULL, ns); - if (cs == EVAS_COLORSPACE_ARGB8888) - { - im2 = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), - ie->w, ie->h, NULL, ie->flags.alpha, - EVAS_COLORSPACE_ARGB8888); - } - else - { - int stride = _evas_native_tbm_surface_stride_get(NULL, ns); - if (stride > -1) - { - /** - * To support various color format in Native TBM Surface, - * Cache Image should have both im->image.data and cs.data memory. - * In default, evas_cache_image_copied_data is callled with his colorspace. - * In the case, cs.data is allocated and free, then re-allocated. - * To optimize, we have two options. - * One of them, evas_cache_image_copied_data is called with EVAS_COLORSPACE_ARGB8888 - * The other option, evas_cache_image_data is called with his colorspace - * and evas_cache_image_surface_alloc should be called. - * Then, new Cache Image's cs should be set with EVAS_COLORSPACE_ARGB8888. - * Because of allocation cs.data in _evas_native_tbm_surface_image_set() - * In current, first option is used. - **/ - im2 = (RGBA_Image *)evas_cache_image_copied_data(evas_common_image_cache_get(), - stride, ie->h, NULL, ie->flags.alpha, cs); - } - else - { - ERR("Fail to get stride"); - return im; - } - } - } - else - im2 = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), - ie->w, ie->h, - NULL, 1, + im2 = (RGBA_Image *) evas_cache_image_data(evas_common_image_cache_get(), + ie->w, ie->h, ns->data.evasgl.surface, 1, EVAS_COLORSPACE_ARGB8888); } + else if (ns->type == EVAS_NATIVE_SURFACE_TBM) + { + Evas_Colorspace cs = _evas_native_tbm_surface_colorspace_get(NULL, ns); + if (cs == EVAS_COLORSPACE_ARGB8888) + { + im2 = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), + ie->w, ie->h, NULL, ie->flags.alpha, + EVAS_COLORSPACE_ARGB8888); + } + else + { + int stride = _evas_native_tbm_surface_stride_get(NULL, ns); + if (stride > -1) + { + /** + * To support various color format in Native TBM Surface, + * Cache Image should have both im->image.data and cs.data memory. + * In default, evas_cache_image_copied_data is callled with his colorspace. + * In the case, cs.data is allocated and free, then re-allocated. + * To optimize, we have two options. + * One of them, evas_cache_image_copied_data is called with EVAS_COLORSPACE_ARGB8888 + * The other option, evas_cache_image_data is called with his colorspace + * and evas_cache_image_surface_alloc should be called. + * Then, new Cache Image's cs should be set with EVAS_COLORSPACE_ARGB8888. + * Because of allocation cs.data in _evas_native_tbm_surface_image_set() + * In current, first option is used. + **/ + im2 = (RGBA_Image *)evas_cache_image_copied_data(evas_common_image_cache_get(), + stride, ie->h, NULL, ie->flags.alpha, cs); + } + else + { + ERR("Fail to get stride"); + return im; + } + } + } + else + im2 = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(), + ie->w, ie->h, + NULL, 1, + EVAS_COLORSPACE_ARGB8888); @@ -285,8 +282,6 @@ eng_image_native_set(void *engine EINA_UNUSED, void *image, void *native) im->native.func.free(im); } - if (!ns) return im; - evas_cache_image_drop(ie); im = im2; -- 2.7.4