jpeg pushed a commit to branch master.

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

commit 2ff9b054f9cded810d6be76af2a3e6dd006ac4ac
Author: Jean-Philippe Andre <jp.an...@samsung.com>
Date:   Tue Apr 22 17:12:02 2014 +0900

    Evas gl_x11: Fix abort() in evas_object_image_data_get()
    
    Since the introduction of new colorspaces for GL_X11
    (GRY8, AGRY88 and ETC1), stride_get() would return
    an invalid value and data_get() would just abort().
    
    Add proper support for these functions.
    ETC1 data will NOT be returned from data_get() and
    stride_get() will return 0. This is to avoid people from
    messing up badly with encoded color spaces.
---
 src/modules/evas/engines/gl_x11/evas_engine.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/modules/evas/engines/gl_x11/evas_engine.c 
b/src/modules/evas/engines/gl_x11/evas_engine.c
index 490fad7..bac2557 100644
--- a/src/modules/evas/engines/gl_x11/evas_engine.c
+++ b/src/modules/evas/engines/gl_x11/evas_engine.c
@@ -2832,6 +2832,8 @@ eng_image_data_get(void *data, void *image, int to_write, 
DATA32 **image_data, i
    switch (im->cs.space)
      {
       case EVAS_COLORSPACE_ARGB8888:
+      case EVAS_COLORSPACE_AGRY88:
+      case EVAS_COLORSPACE_GRY8:
          if (to_write)
            {
               if (im->references > 1)
@@ -2864,6 +2866,11 @@ eng_image_data_get(void *data, void *image, int 
to_write, DATA32 **image_data, i
       case EVAS_COLORSPACE_YCBCR420TM12601_PL:
          *image_data = im->cs.data;
          break;
+      case EVAS_COLORSPACE_ETC1:
+         ERR("This image is encoded in ETC1, not returning any data");
+         *err = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
+         *image_data = NULL;
+         break;
       default:
          abort();
          break;
@@ -3213,7 +3220,24 @@ eng_image_stride_get(void *data EINA_UNUSED, void 
*image, int *stride)
    if ((im->tex) && (im->tex->pt->dyn.img))
      *stride = im->tex->pt->dyn.stride;
    else
-     *stride = im->w * 4;
+     {
+        switch (im->cs.space)
+          {
+           case EVAS_COLORSPACE_ARGB8888:
+             *stride = im->w * 4;
+             return;
+           case EVAS_COLORSPACE_AGRY88:
+             *stride = im->w * 2;
+             return;
+           case EVAS_COLORSPACE_GRY8:
+             *stride = im->w * 1;
+             return;
+           default:
+             ERR("Requested stride on an invalid format %d", im->cs.space);
+             *stride = 0;
+             return;
+          }
+     }
 }
 
 static Eina_Bool

-- 


Reply via email to