summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-04-22 17:12:02 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-04-22 17:46:30 +0900
commit2ff9b054f9cded810d6be76af2a3e6dd006ac4ac (patch)
treef1ebfb4941eefdc34117246dc7a3ccf942af42e0
parent4de405b42b7bb5f0db3c22217589adba06f86b2b (diff)
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.
-rw-r--r--src/modules/evas/engines/gl_x11/evas_engine.c26
1 files changed, 25 insertions, 1 deletions
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
2832 switch (im->cs.space) 2832 switch (im->cs.space)
2833 { 2833 {
2834 case EVAS_COLORSPACE_ARGB8888: 2834 case EVAS_COLORSPACE_ARGB8888:
2835 case EVAS_COLORSPACE_AGRY88:
2836 case EVAS_COLORSPACE_GRY8:
2835 if (to_write) 2837 if (to_write)
2836 { 2838 {
2837 if (im->references > 1) 2839 if (im->references > 1)
@@ -2864,6 +2866,11 @@ eng_image_data_get(void *data, void *image, int to_write, DATA32 **image_data, i
2864 case EVAS_COLORSPACE_YCBCR420TM12601_PL: 2866 case EVAS_COLORSPACE_YCBCR420TM12601_PL:
2865 *image_data = im->cs.data; 2867 *image_data = im->cs.data;
2866 break; 2868 break;
2869 case EVAS_COLORSPACE_ETC1:
2870 ERR("This image is encoded in ETC1, not returning any data");
2871 *err = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
2872 *image_data = NULL;
2873 break;
2867 default: 2874 default:
2868 abort(); 2875 abort();
2869 break; 2876 break;
@@ -3213,7 +3220,24 @@ eng_image_stride_get(void *data EINA_UNUSED, void *image, int *stride)
3213 if ((im->tex) && (im->tex->pt->dyn.img)) 3220 if ((im->tex) && (im->tex->pt->dyn.img))
3214 *stride = im->tex->pt->dyn.stride; 3221 *stride = im->tex->pt->dyn.stride;
3215 else 3222 else
3216 *stride = im->w * 4; 3223 {
3224 switch (im->cs.space)
3225 {
3226 case EVAS_COLORSPACE_ARGB8888:
3227 *stride = im->w * 4;
3228 return;
3229 case EVAS_COLORSPACE_AGRY88:
3230 *stride = im->w * 2;
3231 return;
3232 case EVAS_COLORSPACE_GRY8:
3233 *stride = im->w * 1;
3234 return;
3235 default:
3236 ERR("Requested stride on an invalid format %d", im->cs.space);
3237 *stride = 0;
3238 return;
3239 }
3240 }
3217} 3241}
3218 3242
3219static Eina_Bool 3243static Eina_Bool