jpeg pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2ac9e788c689f2ca850d373a19a9e85237198573

commit 2ac9e788c689f2ca850d373a19a9e85237198573
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Tue Dec 29 22:01:16 2015 +0900

    Evas: Implement ARGY88 and GRY8 conversion to ARGB8888
    
    This is adding support for a deprecated function, but apparently
    it is used.
    
    Also, remove crazy abort() inside the data_put function.
    
    Fixes T2991
---
 src/lib/evas/canvas/evas_object_image.c           | 16 +++++
 src/lib/evas/common/evas_convert_colorspace.c     | 86 ++++++++++++++++++++++-
 src/lib/evas/common/evas_convert_colorspace.h     |  2 +
 src/modules/evas/engines/gl_generic/evas_engine.c |  6 +-
 4 files changed, 106 insertions(+), 4 deletions(-)

diff --git a/src/lib/evas/canvas/evas_object_image.c 
b/src/lib/evas/canvas/evas_object_image.c
index b4a8f19..fecffe6 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -4709,6 +4709,22 @@ evas_object_image_data_convert_internal(Evas_Image_Data 
*o, void *data, Evas_Col
                                                     o->cur->image.h,
                                                     to_cspace);
           break;
+      case EVAS_COLORSPACE_AGRY88:
+          out = evas_common_convert_agry88_to(data,
+                                              o->cur->image.w,
+                                              o->cur->image.h,
+                                              o->cur->image.stride,
+                                              o->cur->has_alpha,
+                                              to_cspace);
+          break;
+      case EVAS_COLORSPACE_GRY8:
+          out = evas_common_convert_gry8_to(data,
+                                            o->cur->image.w,
+                                            o->cur->image.h,
+                                            o->cur->image.stride,
+                                            o->cur->has_alpha,
+                                            to_cspace);
+          break;
         default:
           WRN("unknow colorspace: %i\n", o->cur->cspace);
           break;
diff --git a/src/lib/evas/common/evas_convert_colorspace.c 
b/src/lib/evas/common/evas_convert_colorspace.c
index 0536380..afbac8f 100644
--- a/src/lib/evas/common/evas_convert_colorspace.c
+++ b/src/lib/evas/common/evas_convert_colorspace.c
@@ -47,6 +47,90 @@ evas_common_convert_rgb565_a5p_to_argb8888(void *data, int 
w, int h, int stride,
 }
 
 static inline void *
+evas_common_convert_agry88_to_argb8888(const void *data, int w, int h, int 
stride, Eina_Bool has_alpha)
+{
+   const DATA16 *src, *end;
+   DATA32 *ret, *dst;
+
+   src = data;
+   end = src + ((stride >> 1) * h);
+   ret = malloc(w * h * sizeof(DATA32));
+   dst = ret;
+
+   if (has_alpha)
+     {
+        for (; src < end; src++, dst++)
+          {
+             int c = (*src) & 0xFF;
+             *dst = ARGB_JOIN((*src >> 8), c, c, c);
+          }
+     }
+   else
+     {
+        for (; src < end; src++, dst++)
+          {
+             int c = (*src) & 0xFF;
+             *dst = ARGB_JOIN(0xFF, c, c, c);
+          }
+     }
+
+   return ret;
+}
+
+void *
+evas_common_convert_agry88_to(const void *data, int w, int h, int stride, 
Eina_Bool has_alpha, Evas_Colorspace cspace)
+{
+   switch (cspace) {
+      case EVAS_COLORSPACE_ARGB8888:
+        return evas_common_convert_agry88_to_argb8888(data, w, h, stride, 
has_alpha);
+      default:
+        return NULL;
+     }
+}
+
+static inline void *
+evas_common_convert_gry8_to_argb8888(const void *data, int w, int h, int 
stride, Eina_Bool has_alpha)
+{
+   const DATA8 *src, *end;
+   DATA32 *ret, *dst;
+
+   src = data;
+   end = src + (stride * h);
+   ret = malloc(w * h * sizeof(DATA32));
+   dst = ret;
+
+   if (has_alpha)
+     {
+        for (; src < end; src++, dst++)
+          {
+             int c = (*src) & 0xFF;
+             *dst = ARGB_JOIN(c, c, c, c);
+          }
+     }
+   else
+     {
+        for (; src < end; src++, dst++)
+          {
+             int c = (*src) & 0xFF;
+             *dst = ARGB_JOIN(0xFF, c, c, c);
+          }
+     }
+
+   return ret;
+}
+
+void *
+evas_common_convert_gry8_to(const void *data, int w, int h, int stride, 
Eina_Bool has_alpha, Evas_Colorspace cspace)
+{
+   switch (cspace) {
+      case EVAS_COLORSPACE_ARGB8888:
+        return evas_common_convert_gry8_to_argb8888(data, w, h, stride, 
has_alpha);
+      default:
+        return NULL;
+     }
+}
+
+static inline void *
 evas_common_convert_argb8888_to_a8(void *data, int w, int h, int stride, 
Eina_Bool has_alpha)
 {
    uint32_t *src, *end;
@@ -68,8 +152,6 @@ evas_common_convert_argb8888_to_a8(void *data, int w, int h, 
int stride, Eina_Bo
    return ret;
 }
 
-
-
 EAPI void *
 evas_common_convert_argb8888_to(void *data, int w, int h, int stride, 
Eina_Bool has_alpha, Evas_Colorspace cspace)
 {
diff --git a/src/lib/evas/common/evas_convert_colorspace.h 
b/src/lib/evas/common/evas_convert_colorspace.h
index f3bec78..51a94f9 100644
--- a/src/lib/evas/common/evas_convert_colorspace.h
+++ b/src/lib/evas/common/evas_convert_colorspace.h
@@ -8,5 +8,7 @@ EAPI void *evas_common_convert_yuv_422P_601_to(void *data, int 
w, int h, Evas_Co
 EAPI void *evas_common_convert_yuv_422_601_to (void *data, int w, int h, 
Evas_Colorspace cspace);
 EAPI void *evas_common_convert_yuv_420_601_to (void *data, int w, int h, 
Evas_Colorspace cspace);
 EAPI void *evas_common_convert_yuv_420T_601_to(void *data, int w, int h, 
Evas_Colorspace cspace);
+void *evas_common_convert_agry88_to(const void *data, int w, int h, int 
stride, Eina_Bool has_alpha, Evas_Colorspace cspace);
+void *evas_common_convert_gry8_to(const void *data, int w, int h, int stride, 
Eina_Bool has_alpha, Evas_Colorspace cspace);
 
 #endif /* _EVAS_CONVERT_COLORSPACE_H */
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c 
b/src/modules/evas/engines/gl_generic/evas_engine.c
index 4a06285..c462225 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -970,6 +970,8 @@ eng_image_data_put(void *data, void *image, DATA32 
*image_data)
    switch (im->cs.space)
      {
       case EVAS_COLORSPACE_ARGB8888:
+      case EVAS_COLORSPACE_AGRY88:
+      case EVAS_COLORSPACE_GRY8:
          if ((!im->im) || (image_data != im->im->image.data))
            {
               im2 = eng_image_new_from_data(data, im->w, im->h, image_data,
@@ -997,8 +999,8 @@ eng_image_data_put(void *data, void *image, DATA32 
*image_data)
          evas_gl_common_image_dirty(im, 0, 0, 0, 0);
          break;
       default:
-         abort();
-         break;
+         ERR("colorspace %d is not supported here", im->cs.space);
+         return NULL;
      }
    return im;
 }

-- 


Reply via email to