evas_engine: remove a dead code and sync with upstream code 32/242132/1
authorYoungbok Shin <youngb.shin@samsung.com>
Mon, 24 Aug 2020 10:31:30 +0000 (19:31 +0900)
committerYoungbok Shin <youngb.shin@samsung.com>
Mon, 24 Aug 2020 10:34:26 +0000 (19:34 +0900)
@fix

Change-Id: Ie5f79e786cb842f98e88d8d97afcc3002d00668a

src/modules/evas/engines/wayland_shm/evas_engine.c

index 04f3297aebcb91fe446b5297ed352f97ef252783..40c98ef917d0d3848cc3f083b7bdceb66feeabfd 100644 (file)
@@ -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;